From patchwork Tue Sep 29 11:01:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 290878 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31455C4741F for ; Tue, 29 Sep 2020 12:19:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D2E1A2075A for ; Tue, 29 Sep 2020 12:19:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601381959; bh=DOwg7wsIbWSWtlF7OlVEGYVmShh1txnXKYdPZzbhWCg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=FYrQ7yLkVRPxiSjHNDE2xZnW1N7I8NYCc6fWsAvTJkYqOquTLbK9cpDGmwa9WZe5I feEei2HgBJO09eyXj8D6SlBWF+gHWrxf4F8q62dVvfay71WzJ+Y9JMtL0Tn42ConRa ZuyCcs7+BDQQr03q75rFiGgsBjr5OY/4guwdsuww= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732190AbgI2MTI (ORCPT ); Tue, 29 Sep 2020 08:19:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:50296 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728441AbgI2LgK (ORCPT ); Tue, 29 Sep 2020 07:36:10 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 95AF823D98; Tue, 29 Sep 2020 11:30:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601379057; bh=DOwg7wsIbWSWtlF7OlVEGYVmShh1txnXKYdPZzbhWCg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=crbJugdJi1SDz5AqFd7S7xDbkmukYMJGeihKFVJ4iDtgx2xVOn/TF9el3cuOTcBR6 /jFx7uJPQmXmTXFRc3dCgqvKPSbjjcTkMDHvhhyrgWqYaA7bvDCrB9/nJTvIWYRuQt AXNcgSOxyDOo8pp1BBLCt6F+sZpEHaGLeDFWcc1w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Zijlstra , Sven Schnelle , Vasily Gorbik , Sasha Levin Subject: [PATCH 4.19 211/245] lockdep: fix order in trace_hardirqs_off_caller() Date: Tue, 29 Sep 2020 13:01:02 +0200 Message-Id: <20200929105957.241506338@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200929105946.978650816@linuxfoundation.org> References: <20200929105946.978650816@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Sven Schnelle [ Upstream commit 73ac74c7d489756d2313219a108809921dbfaea1 ] Switch order so that locking state is consistent even if the IRQ tracer calls into lockdep again. Acked-by: Peter Zijlstra Signed-off-by: Sven Schnelle Signed-off-by: Vasily Gorbik Signed-off-by: Sasha Levin --- kernel/trace/trace_preemptirq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/trace/trace_preemptirq.c b/kernel/trace/trace_preemptirq.c index 71f553cceb3c1..0e373cb0106bb 100644 --- a/kernel/trace/trace_preemptirq.c +++ b/kernel/trace/trace_preemptirq.c @@ -59,14 +59,14 @@ EXPORT_SYMBOL(trace_hardirqs_on_caller); __visible void trace_hardirqs_off_caller(unsigned long caller_addr) { + lockdep_hardirqs_off(CALLER_ADDR0); + if (!this_cpu_read(tracing_irq_cpu)) { this_cpu_write(tracing_irq_cpu, 1); tracer_hardirqs_off(CALLER_ADDR0, caller_addr); if (!in_nmi()) trace_irq_disable_rcuidle(CALLER_ADDR0, caller_addr); } - - lockdep_hardirqs_off(CALLER_ADDR0); } EXPORT_SYMBOL(trace_hardirqs_off_caller); #endif /* CONFIG_TRACE_IRQFLAGS */