Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp12477045rwb; Sat, 26 Nov 2022 09:37:11 -0800 (PST) X-Google-Smtp-Source: AA0mqf6iTldQdEmoHXr2lG64rvMgbBgoTHMgHFfO07Lgl1S5Ako+OsKoo4IiJHTGlz/Aly8O4PZf X-Received: by 2002:a17:906:a294:b0:7be:1ce1:ce3b with SMTP id i20-20020a170906a29400b007be1ce1ce3bmr2242344ejz.135.1669484231444; Sat, 26 Nov 2022 09:37:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669484231; cv=none; d=google.com; s=arc-20160816; b=ji1QCIFU1lKjKbWWejUuKG/itYXdiG0IdMW/YnZ8w/mcp3LVIt8Dq/8+CtIFWas3Zr mV3eWLLCagxNBeafbQtNRrL1rcpJh5AnMzbWoDo+6+Qdi2FcOs6abvUHeVmMsaghg7B9 ZpQCXeoA0NjMWw4/QOa6HtC2k/WAaARvocEFJQZeRU3dUtURX7Gyw4En4JImFclsKJs7 ip2JNp4qrOQPfLO8qZbqQ5KmkIhQp0Qkzga2G2oNBRCoFUv0tlraFB1sxmv9tnyxlpNd RkyZIr1eiX04KfYo2hImT8Kt09GW6+jeBw9msoXdDyVrI3F7sHoQrRV6X+0W5EwIWUNb r8tQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=w5Ts30MespxUKzsUT1l7gvsIpD/wCNbmSDwi0rq7pWo=; b=t7NXQh0htjElgfmsmR7jGKoo2Zvw4jMSBGd56TFHV7YGk+wScB3gtuywQtWKoRz4J5 ms0wTzxP29zffOXGpMvk1lJ9nQkEsUFVZyEi0da7DbCJAZxQo0xbCbWwHeU0tQnb/wx2 wMvkzW6kt25taBB4NpqElkHOechzhkU6kXpXTinpOZfBUim7tfmcw808nSH5XHqFznnv iuR7wtjgjqEcuny/EssdJtnznuUcF5UHQTbzwcVpcNfB24EBqGhAYM70+wG+g1b2u57U QVoW8ac9qchBQpcG8pjKIPsLI5c0dJ9UeeJAwSrtL/JTzOAjYtabkl0X7AKzNU+2vViC 086g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=a1vG6WIH; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i21-20020a170906251500b007add6be8c86si4684103ejb.762.2022.11.26.09.36.49; Sat, 26 Nov 2022 09:37:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=a1vG6WIH; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229733AbiKZRFK (ORCPT + 84 others); Sat, 26 Nov 2022 12:05:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229531AbiKZRFJ (ORCPT ); Sat, 26 Nov 2022 12:05:09 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3029417A81 for ; Sat, 26 Nov 2022 09:05:08 -0800 (PST) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1669482305; 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: in-reply-to:in-reply-to:references:references; bh=w5Ts30MespxUKzsUT1l7gvsIpD/wCNbmSDwi0rq7pWo=; b=a1vG6WIHLX8A8l4bbess8p3ebtC0MNf7n88bWD/3PqTxJ1uhpyZ9s4hHJK5DzlNe5lhmJq DaD7vanZVw80QrUdkx4pDbIeUFASYcJ0R8qUmJKJKu5LlvELuECNSOvYLnguyeU/rNhBr9 jBdZbt1LJfYwVinnQYZHUTrz9PU0VAWM7s21Ns7DrDdaYEr14ZjT3l+3b8CsXbWhoJOxeF 3fDxV9pGenyolZ3GybsEdHv4BUst2bFjEGi5oGzmFOgveySWzE3JrjCSOORfUHqxnkBrc0 LDumya6APS4Pev3plwpVgtQ3GfSLVFWVVa1d8+r+nE3Wp/I+lxxKTgnQxz4nJw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1669482305; 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: in-reply-to:in-reply-to:references:references; bh=w5Ts30MespxUKzsUT1l7gvsIpD/wCNbmSDwi0rq7pWo=; b=dam0KkoHF7cMdxbvjVFLp64t7BNxpbeugIF7gW3X6Ip03wY3HHGZ0SDANtDVhfQCIenvje LRzxWKBGTevPKMCw== To: Zhouyi Zhou , fweisbec@gmail.com, mingo@kernel.org, dave@stgolabs.net, paulmck@kernel.org, josh@joshtriplett.org, mpe@ellerman.id.au, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Cc: Zhouyi Zhou Subject: Re: [PATCH linux-next][RFC]torture: avoid offline tick_do_timer_cpu In-Reply-To: <20221121035140.118651-1-zhouzhouyi@gmail.com> References: <20221121035140.118651-1-zhouzhouyi@gmail.com> Date: Sat, 26 Nov 2022 18:05:05 +0100 Message-ID: <87y1rxwsse.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham 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 On Mon, Nov 21 2022 at 11:51, Zhouyi Zhou wrote: > During CPU-hotplug torture (CONFIG_NO_HZ_FULL=y), if we try to > offline tick_do_timer_cpu, the operation will fail because in > function tick_nohz_cpu_down: > ``` > if (tick_nohz_full_running && tick_do_timer_cpu == cpu) > return -EBUSY; > ``` > Above bug was first discovered in torture tests performed in PPC VM How is this a bug? > of Open Source Lab of Oregon State University, and reproducable in RISC-V > and X86-64 (with additional kernel commandline cpu0_hotplug). > > In this patch, we avoid offline tick_do_timer_cpu by distribute > the offlining cpu among remaining cpus. Please read Documentation/process. Search for 'this patch'... > > Signed-off-by: Zhouyi Zhou > --- > include/linux/tick.h | 1 + > kernel/time/tick-common.c | 1 + > kernel/time/tick-internal.h | 1 - > kernel/torture.c | 10 ++++++++++ > 4 files changed, 12 insertions(+), 1 deletion(-) > > diff --git a/include/linux/tick.h b/include/linux/tick.h > index bfd571f18cfd..23cc0b205853 100644 > --- a/include/linux/tick.h > +++ b/include/linux/tick.h > @@ -14,6 +14,7 @@ > #include > > #ifdef CONFIG_GENERIC_CLOCKEVENTS > +extern int tick_do_timer_cpu __read_mostly; > extern void __init tick_init(void); > /* Should be core only, but ARM BL switcher requires it */ > extern void tick_suspend_local(void); > diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c > index 46789356f856..87b9b9afa320 100644 > --- a/kernel/time/tick-common.c > +++ b/kernel/time/tick-common.c > @@ -48,6 +48,7 @@ ktime_t tick_next_period; > * procedure also covers cpu hotplug. > */ > int tick_do_timer_cpu __read_mostly = TICK_DO_TIMER_BOOT; > +EXPORT_SYMBOL_GPL(tick_do_timer_cpu); No. We are not exporting this just to make a bogus test case happy. Fix the torture code to handle -EBUSY correctly. Thanks, tglx