Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2257539iof; Wed, 8 Jun 2022 00:38:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxELIb7X54N8hJRM6WhZyn/y7TUwh9bIDeu2KlPpuQnNGoDKwkYGgdwJzjuwtYbBFE57s4W X-Received: by 2002:a17:902:c402:b0:163:fa50:b345 with SMTP id k2-20020a170902c40200b00163fa50b345mr33159374plk.94.1654673919358; Wed, 08 Jun 2022 00:38:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654673919; cv=none; d=google.com; s=arc-20160816; b=zhIDD44Ez2EV6Rpevkz8pM6c6tx/fsecf6w+qfzjPLGrFU1vavpCWnsOJZlNqRemll 2V5AYY6O8ImG7pe6ra1318GeMlKLR+/BZynBDF1J6n3+44PpuZZgm5JQ9jquoUsWxRVO RhpwfG9xTkaAGVtC2pE1H8htIHDVH71Jmrk52BaVoa8ejfLffrh01vCLNubQ03HXWKiD 4D3CE/7pg1nv2DP8USNC2ErqpRjW1gxnqZB9AQufS2d3d05H2p+e8aPnNxwtPVDu3Oun X0wIDqsMPIjACgbVIEN3vL76hK4ao02KoTIK7dcebS3O/U5Wy3Y3OmnwIs0TF7+PoR9n 5BCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WdaOnzTXIUjg7ItWp56ka5gu6TRXvy2AI6Q/wu4492M=; b=EYx67RcHWLjoLVH55MAv1ZweBJBgeR0VO9h1e2WwNtZRbLPP8/iKpnqX9mvTto6Xt/ tyDzx0uRfC1zJhMUE1qYEAa78GLm7qCQ/Yt8JCMQH1rrf/UAtX33Bm7duQ1bOLpOXc11 D2yKd/5CT/GFct4uV8DMEVXI2UERVdkgoO/9eLC1FQ7LFsW8m/WP8ewxt6pqbIHRiFhF 43S7P8Xqm1jnhKmcvPbeZvGGDhgKsQCeTaF4UFbgllpsEiGJsU6JgEcal2qxt8b9halr ZGdfRfvfDdICrfBNqbkj1EagAExHvNd0lc1O000eWfMGwwwi9kmVseFbkKZJgnh5WHJ0 xBcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=db8ufcIa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id iw19-20020a170903045300b0016252715440si25996020plb.494.2022.06.08.00.38.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 00:38:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=db8ufcIa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EE10327C24F; Wed, 8 Jun 2022 00:09:42 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358032AbiFGWLy (ORCPT + 99 others); Tue, 7 Jun 2022 18:11:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379215AbiFGVJX (ORCPT ); Tue, 7 Jun 2022 17:09:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 893BD213E40; Tue, 7 Jun 2022 11:51:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1A52DB82182; Tue, 7 Jun 2022 18:51:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 630C3C385A2; Tue, 7 Jun 2022 18:51:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627865; bh=agAvA2UlDjU1S+805plgMgA31btECECZRC2FbGPFZ+k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=db8ufcIahlPoFEjJGEHd0OOxv7DiNtXbb9nNyB7VUW64t9IIOaTwe0h9Fot9+VuXb 6YRoBX4N8Lu+Dk7G/ZxIuJTtYEW6wQiH5eqUsXvziavtUpv5/U7/1AafQ9cHIykQ2L qy1Z53vR/qP17nPwgN0R2BDi4H1VBrzJtLMYnoDQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Max Filippov , Sasha Levin Subject: [PATCH 5.18 122/879] xtensa: move trace_hardirqs_off call back to entry.S Date: Tue, 7 Jun 2022 18:54:00 +0200 Message-Id: <20220607165006.242073367@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Max Filippov [ Upstream commit de4415d0bac91192ee9c74e849bc61429efa9b42 ] Context tracking call must be done after hardirq tracking call, otherwise lockdep_assert_irqs_disabled called from rcu_eqs_exit gives a warning. To avoid context tracking logic duplication for IRQ/exception entry paths move trace_hardirqs_off call back to common entry code. Signed-off-by: Max Filippov Signed-off-by: Sasha Levin --- arch/xtensa/kernel/entry.S | 19 +++++++++++++------ arch/xtensa/kernel/traps.c | 11 ++--------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/arch/xtensa/kernel/entry.S b/arch/xtensa/kernel/entry.S index 6b6eff658795..07d683d94e17 100644 --- a/arch/xtensa/kernel/entry.S +++ b/arch/xtensa/kernel/entry.S @@ -442,7 +442,6 @@ KABI_W or a3, a3, a0 moveqz a3, a0, a2 # a3 = LOCKLEVEL iff interrupt KABI_W movi a2, PS_WOE_MASK KABI_W or a3, a3, a2 - rsr a2, exccause #endif /* restore return address (or 0 if return to userspace) */ @@ -469,19 +468,27 @@ KABI_W or a3, a3, a2 save_xtregs_opt a1 a3 a4 a5 a6 a7 PT_XTREGS_OPT +#ifdef CONFIG_TRACE_IRQFLAGS + rsr abi_tmp0, ps + extui abi_tmp0, abi_tmp0, PS_INTLEVEL_SHIFT, PS_INTLEVEL_WIDTH + beqz abi_tmp0, 1f + abi_call trace_hardirqs_off +1: +#endif + /* Go to second-level dispatcher. Set up parameters to pass to the * exception handler and call the exception handler. */ - rsr a4, excsave1 - addx4 a4, a2, a4 - l32i a4, a4, EXC_TABLE_DEFAULT # load handler - mov abi_arg1, a2 # pass EXCCAUSE + l32i abi_arg1, a1, PT_EXCCAUSE # pass EXCCAUSE + rsr abi_tmp0, excsave1 + addx4 abi_tmp0, abi_arg1, abi_tmp0 + l32i abi_tmp0, abi_tmp0, EXC_TABLE_DEFAULT # load handler mov abi_arg0, a1 # pass stack frame /* Call the second-level handler */ - abi_callx a4 + abi_callx abi_tmp0 /* Jump here for exception exit */ .global common_exception_return diff --git a/arch/xtensa/kernel/traps.c b/arch/xtensa/kernel/traps.c index 9345007d474d..5f86208c67c8 100644 --- a/arch/xtensa/kernel/traps.c +++ b/arch/xtensa/kernel/traps.c @@ -242,12 +242,8 @@ DEFINE_PER_CPU(unsigned long, nmi_count); void do_nmi(struct pt_regs *regs) { - struct pt_regs *old_regs; + struct pt_regs *old_regs = set_irq_regs(regs); - if ((regs->ps & PS_INTLEVEL_MASK) < LOCKLEVEL) - trace_hardirqs_off(); - - old_regs = set_irq_regs(regs); nmi_enter(); ++*this_cpu_ptr(&nmi_count); check_valid_nmi(); @@ -269,12 +265,9 @@ void do_interrupt(struct pt_regs *regs) XCHAL_INTLEVEL6_MASK, XCHAL_INTLEVEL7_MASK, }; - struct pt_regs *old_regs; + struct pt_regs *old_regs = set_irq_regs(regs); unsigned unhandled = ~0u; - trace_hardirqs_off(); - - old_regs = set_irq_regs(regs); irq_enter(); for (;;) { -- 2.35.1