Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp781032ybe; Wed, 4 Sep 2019 07:40:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqw7OFBhE4LPcFGc3LsCdgL9NGlv5jXi9cedbNT1H7F4B12WaAzQtHDX7EjOQC2//aI/JMxj X-Received: by 2002:a17:902:b583:: with SMTP id a3mr17174724pls.52.1567608035914; Wed, 04 Sep 2019 07:40:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567608035; cv=none; d=google.com; s=arc-20160816; b=TFwVUphgVax0YBpbMhW/DGZvINcphNii7fZwA6IH/wRiJXQ8V82oPADCpzZW8t2Zwk bzMGHARWfmkuKILuI2J2kOmXMGqDzIB1EAEAI/DxCTrWKAYQ6tpR8vVoD1o6T9flVWPb ypPFKfyfK/LLUASqR+Taa4TMqUF2vssDzw38uPFizPVd69IiMu2CO5pxFLSujsynQJtb blvlTFZ2SF1Kz9D4EiLo13SQ/v8m40WNUMz4108DmuwN5gax79l2lfY2EBCH7kFnFF+1 AhKroBrrszP2FXChi+Az1v6Lm5egb76pLx7v11mTf7KAJn22K83GJ0bTHJKzEbOtiMln SiNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=ZboQpbzohj95k1076qnjLn1WqfPdn1c0eKfauE3vI+g=; b=okIlfHyU5IXgSundX3jxNWJUD7KmI0HEe2X6ZW3/MHG62ts8wFwQO7nywY+F7bl99Z SzwpHTLLKoet7k2VB7vBu0N6Zo+93npWeIrqeeCBk5ZyyOmzOWekkl4tDqAqMkF+pHQm V5KiIvffOLaGNFlfTIFYSz9lgPFH3G1WWXP07Zbr9+nEGYGVSeVXqJA6a+dTlOs1CAMj ml3okH+LrQs0tdkNjf42drKypQjDwx5ca4OCDyhVdo63EGCdUaNxD1fvXX/TO248LA4L 4/hQRRFMvCzVMQA5J8/yo/0H28VuAlFvgePJAUafuEZKlbWDmmJ1LO8Y0aNZLub2/WyG w30w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d9si17318159pgq.119.2019.09.04.07.40.19; Wed, 04 Sep 2019 07:40:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730737AbfIDOjW (ORCPT + 99 others); Wed, 4 Sep 2019 10:39:22 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:39476 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730153AbfIDOjW (ORCPT ); Wed, 4 Sep 2019 10:39:22 -0400 Received: from p5de0b6c5.dip0.t-ipconnect.de ([93.224.182.197] helo=nanos) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1i5WRL-000628-TT; Wed, 04 Sep 2019 16:39:20 +0200 Date: Wed, 4 Sep 2019 16:39:18 +0200 (CEST) From: Thomas Gleixner To: Sebastian Andrzej Siewior cc: linux-kernel@vger.kernel.org, Julien Grall Subject: Re: [PATCH] hrtimer: Add a missing bracket and hide `migration_base' on !SMP In-Reply-To: <20190904141540.xucehzbndjmgkrio@linutronix.de> Message-ID: References: <20190821092409.13225-4-julien.grall@arm.com> <156652633520.11649.15892124550118329976.tip-bot2@tip-bot2> <20190904141540.xucehzbndjmgkrio@linutronix.de> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 4 Sep 2019, Sebastian Andrzej Siewior wrote: > Commit > 68b2c8c1e4210 ("hrtimer: Don't take expiry_lock when timer is currently migrated") That is the same information as in the fixes tag. So you can say something like this: The recent change to avoid taking the expiry lock when a timer is currently migrated missed ..... > missed to add a bracket at the end of the if statement leading to > compile errors. > Since that commit the variable `migration_base' is always used but only > available on SMP configuration thus leading to another compile error. > The changelog says > "The timer base and base->cpu_base cannot be NULL in the code path" > > so it is safe to limit this check to SMP configurations only. > > Add the missing bracket to the if statement and hide `migration_base' > behind CONFIG_SMP bars. > > Fixes: 68b2c8c1e4210 ("hrtimer: Don't take expiry_lock when timer is currently migrated") > Signed-off-by: Sebastian Andrzej Siewior > --- > kernel/time/hrtimer.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c > index f5a1a5e16216c..bc84c74ae5b96 100644 > --- a/kernel/time/hrtimer.c > +++ b/kernel/time/hrtimer.c > @@ -1216,12 +1216,16 @@ void hrtimer_cancel_wait_running(const struct hrtimer *timer) > { > /* Lockless read. Prevent the compiler from reloading it below */ > struct hrtimer_clock_base *base = READ_ONCE(timer->base); > + bool is_migration_base = false; > > /* > * Just relax if the timer expires in hard interrupt context or if > * it is currently on the migration base. > */ > - if (!timer->is_soft || base == &migration_base) > +#ifdef CONFIG_SMP > + is_migration_base = base == &migration_base; > +#endif That's beyond ugly. What's wrong with: if (!timer->is_soft || is_migration_base(base)) and have two helpers in the relevant ifdeffed section? Thanks, tglx