From patchwork Mon Sep 21 10:37:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Borislav Petkov X-Patchwork-Id: 251569 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=-9.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED 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 88411C43465 for ; Mon, 21 Sep 2020 10:37:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 037EF2145D for ; Mon, 21 Sep 2020 10:37:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alien8.de header.i=@alien8.de header.b="T9CXOlxo" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726619AbgIUKhy (ORCPT ); Mon, 21 Sep 2020 06:37:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726436AbgIUKhv (ORCPT ); Mon, 21 Sep 2020 06:37:51 -0400 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 315C7C061755; Mon, 21 Sep 2020 03:37:51 -0700 (PDT) Received: from zn.tnic (p200300ec2f07e300a1766583a478f392.dip0.t-ipconnect.de [IPv6:2003:ec:2f07:e300:a176:6583:a478:f392]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id D80851EC03C9; Mon, 21 Sep 2020 12:37:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1600684667; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=in/bybOnAIhAdt8FQ8tWtig4T4/V4JAt7w3WooCITpM=; b=T9CXOlxoQCHIOVk3J5RboDd29f68vxB/C2aSm2tOFNyC5MonwkiSZ0E4BWcGMgIUTpaop7 QnG30Ps/uMuZ/e+7qsWAbMS0UD3lNJQgAoEU9YNjR2Wlk5JdKJ9PFH9ihrj0lhM0Wr6QUi OHqh4RDlxnPsDC1FYlUrAD7doxbHcjc= Date: Mon, 21 Sep 2020 12:37:41 +0200 From: Borislav Petkov To: Sven Joachim Cc: Peter Zijlstra , rjw@rjwysocki.net, x86@kernel.org, tony.luck@intel.com, lenb@kernel.org, daniel.lezcano@linaro.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, linux-pm@vger.kernel.org, ulf.hansson@linaro.org, paulmck@kernel.org, tglx@linutronix.de, naresh.kamboju@linaro.org, Josh Triplett , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , Joel Fernandes , rcu@vger.kernel.org Subject: [PATCH] rcu/tree: Export rcu_idle_{enter,exit} to module Message-ID: <20200921103741.GC5901@zn.tnic> References: <20200915103157.345404192@infradead.org> <20200915103806.479637218@infradead.org> <87wo0npk72.fsf@turtle.gmx.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <87wo0npk72.fsf@turtle.gmx.de> Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Lemme add whatever get_maintainer spits, to Cc. On Mon, Sep 21, 2020 at 11:12:33AM +0200, Sven Joachim wrote: > On 2020-09-15 12:32 +0200, Peter Zijlstra wrote: > > > The C3 BusMaster idle code takes lock in a number of places, some deep > > inside the ACPI code. Instead of wrapping it all in RCU_NONIDLE, have > > the driver take over RCU-idle duty and avoid flipping RCU state back > > and forth a lot. > > > > ( by marking 'C3 && bm_check' as RCU_IDLE, we _must_ call enter_bm() for > > that combination, otherwise we'll loose RCU-idle, this requires > > shuffling some code around ) > > > > Signed-off-by: Peter Zijlstra (Intel) > > I got modpost errors in 5.9-rc6 after this patch: > > ERROR: modpost: "rcu_idle_enter" [drivers/acpi/processor.ko] undefined! > ERROR: modpost: "rcu_idle_exit" [drivers/acpi/processor.ko] undefined! > > Reverting commit 1fecfdbb7acc made them go away. Notably my > configuration had CONFIG_ACPI_PROCESSOR=m, changing that > to CONFIG_ACPI_PROCESSOR=y let the build succeed as well. I guess this. Running randconfigs on it for a while, to see what else breaks. Reviewed-by: Paul E. McKenney --- From: Borislav Petkov Date: Mon, 21 Sep 2020 12:31:36 +0200 Fix this link error: ERROR: modpost: "rcu_idle_enter" [drivers/acpi/processor.ko] undefined! ERROR: modpost: "rcu_idle_exit" [drivers/acpi/processor.ko] undefined! when CONFIG_ACPI_PROCESSOR is built as module. PeterZ says that in light of ARM needing those soon too, they should simply be exported. Fixes: 1fecfdbb7acc ("ACPI: processor: Take over RCU-idle for C3-BM idle") Reported-by: Sven Joachim Suggested-by: Peter Zijlstra Signed-off-by: Borislav Petkov --- kernel/rcu/tree.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 8ce77d9ac716..f78ee759af9c 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -673,6 +673,7 @@ void rcu_idle_enter(void) lockdep_assert_irqs_disabled(); rcu_eqs_enter(false); } +EXPORT_SYMBOL_GPL(rcu_idle_enter); #ifdef CONFIG_NO_HZ_FULL /** @@ -886,6 +887,7 @@ void rcu_idle_exit(void) rcu_eqs_exit(false); local_irq_restore(flags); } +EXPORT_SYMBOL_GPL(rcu_idle_exit); #ifdef CONFIG_NO_HZ_FULL /** From patchwork Tue Sep 15 10:31:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Zijlstra X-Patchwork-Id: 251591 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=-6.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=no 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 5D50EC43461 for ; Tue, 15 Sep 2020 10:46:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E737721D7B for ; Tue, 15 Sep 2020 10:46:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="bpANDfAq" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726453AbgIOKqB (ORCPT ); Tue, 15 Sep 2020 06:46:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726384AbgIOKn5 (ORCPT ); Tue, 15 Sep 2020 06:43:57 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCC2AC061788; Tue, 15 Sep 2020 03:43:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Type:MIME-Version:References: Subject:Cc:To:From:Date:Message-ID:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:In-Reply-To; bh=mRb05QRhEgX5DGrRuAZaR2rGnerDrceJein4gsxe/Oc=; b=bpANDfAqLOkvapnR4e8RYeRGLJ K14vHjTl8QL0w6Xcm3ZFmf4Tdafh1Wc9Mo7zsHtdzLbO1fGYwsSNmy0XpgBbx3PDD5SDdv4EoyC6U Q9mMIZIfHIBTTGsB0KdkWx1DN7TUa5VRolyCJI5xWwZ5QFSLcS0S9yRyS7gk3uohejGjJvukkNWWt QyXSNJWvKj+WIyQ3jWKEIG3rgQy477DzRYEAMLw9TSJCCiYxWWGEcG1A4Z02Pzz4CUtDYz/qUyqry NAovZHIMbwOcby9iY3WKAVOGWKNtWAViAZBrjT6qXOfMTcpvBWkz6H3BPsrkNWRRm46m2shVRGfgg NJti/h/w==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kI8R3-0006uk-Jk; Tue, 15 Sep 2020 10:43:41 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id B452E30705A; Tue, 15 Sep 2020 12:43:40 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 0) id 9249A214EDD4D; Tue, 15 Sep 2020 12:43:40 +0200 (CEST) Message-ID: <20200915103806.348668768@infradead.org> User-Agent: quilt/0.66 Date: Tue, 15 Sep 2020 12:31:59 +0200 From: Peter Zijlstra To: rjw@rjwysocki.net, bp@alien8.de Cc: x86@kernel.org, tony.luck@intel.com, lenb@kernel.org, daniel.lezcano@linaro.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, linux-pm@vger.kernel.org, ulf.hansson@linaro.org, paulmck@kernel.org, tglx@linutronix.de, naresh.kamboju@linaro.org, peterz@infradead.org Subject: [RFC][PATCH 2/4] acpi: Use CPUIDLE_FLAG_TLB_FLUSHED References: <20200915103157.345404192@infradead.org> MIME-Version: 1.0 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Make acpi_processor_idle() use the generic TLB flushing code. This again removes RCU usage after rcu_idle_enter(). (XXX make every C3 invalidate TLBs, not just C3-BM) Signed-off-by: Peter Zijlstra (Intel) --- arch/ia64/include/asm/acpi.h | 2 -- arch/x86/include/asm/acpi.h | 2 -- drivers/acpi/processor_idle.c | 10 +++++----- 3 files changed, 5 insertions(+), 9 deletions(-) --- a/arch/ia64/include/asm/acpi.h +++ b/arch/ia64/include/asm/acpi.h @@ -74,8 +74,6 @@ static inline void arch_acpi_set_pdc_bit buf[2] |= ACPI_PDC_EST_CAPABILITY_SMP; } -#define acpi_unlazy_tlb(x) - #ifdef CONFIG_ACPI_NUMA extern cpumask_t early_cpu_possible_map; #define for_each_possible_early_cpu(cpu) \ --- a/arch/x86/include/asm/acpi.h +++ b/arch/x86/include/asm/acpi.h @@ -159,8 +159,6 @@ static inline u64 x86_default_get_root_p extern int x86_acpi_numa_init(void); #endif /* CONFIG_ACPI_NUMA */ -#define acpi_unlazy_tlb(x) leave_mm(x) - #ifdef CONFIG_ACPI_APEI static inline pgprot_t arch_apei_get_mem_attribute(phys_addr_t addr) { --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -565,8 +565,6 @@ static DEFINE_RAW_SPINLOCK(c3_lock); static void acpi_idle_enter_bm(struct acpi_processor *pr, struct acpi_processor_cx *cx) { - acpi_unlazy_tlb(smp_processor_id()); - /* * disable bus master * bm_check implies we need ARB_DIS @@ -666,6 +664,7 @@ static int acpi_processor_setup_cpuidle_ max_cstate = 1; for (i = 1; i < ACPI_PROCESSOR_MAX_POWER && i <= max_cstate; i++) { + state = &acpi_idle_driver.states[count]; cx = &pr->power.states[i]; if (!cx->valid) @@ -673,10 +672,11 @@ static int acpi_processor_setup_cpuidle_ per_cpu(acpi_cstate[count], dev->cpu) = cx; - if (lapic_timer_needs_broadcast(pr, cx)) { - state = &acpi_idle_driver.states[count]; + if (lapic_timer_needs_broadcast(pr, cx)) state->flags |= CPUIDLE_FLAG_TIMER_STOP; - } + + if (cx->type == ACPI_STATE_C3) + state->flags |= CPUIDLE_FLAG_TLB_FLUSHED; count++; if (count == CPUIDLE_STATE_MAX)