Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp798652ybe; Wed, 4 Sep 2019 07:56:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqyZx6OLtT7oX1IEWloy30VE+toUaxK8i11dGORHS2LN5cXPZfgYbWcoscxMq4ZV6dt3WLlW X-Received: by 2002:a63:3009:: with SMTP id w9mr36919782pgw.260.1567609003194; Wed, 04 Sep 2019 07:56:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567609003; cv=none; d=google.com; s=arc-20160816; b=YqjZ3PlpzfoUfYjc7mH+GpDo9XNubEp4OwZN8xrZ2SKOn7CZhUJJAL1QxT2CFEBOMe YqNA8gqJyeVJg/XiyvIaE+y/sa8VTJfh2iS21WWegVMOHKdowu8RUlgTuCpeC5y4hJrB Ag4OekdF8/Mpzw9wLWUJtTwQlj0jLslP7CTOpM86WjjTmxzvMXFuP2P2H+hSJxjOLFiv lsvDMoKxchdcEp3Iu8e777e9JypoQKze4dtNeoFtXcJDSu5JSIuHl0xS9Wf47XyBXxpC TnG2gIccYTLuAPBQD6kK+nSxR90vxkuI+Is9KcQBPTbSIoeojOWV1/GGNALF8kaSfFwO ufQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=AaHGClC/vAtwzo2Vjk3YPZSI2It0I9unnRFfbGxqgsg=; b=Uoz4twFQJHHPsrwP+AuE6K+JkkfEY2XF3e6XeAkeJNQHOHzD8GqvgBexYp/M4cXHTb 8ISdzAs4tXwGzH2shmxiQ9QFhrOBz3iubDDD/nIc3hzghuhpP4ptKCsYAPSTUurLIcty AmZFwqrg4Vo0HOLREbGCxHNB3ypsj9rothCUncKPT1ylnGfJA943NkrcczjujB4c9GTx 4a/D84fdOU9akJMBnHYBbSu3wA6KQezZURo9HaA42z1HwMIdr3Zhusif1Nvm804nSWH9 7eu5dMZuDBeRYsnW0RuW62le869h+Y/EvDnJdnxnpyBP+67Y3w/6ze+ucITiXbyXw/2D fYaA== 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 16si6256528pfo.234.2019.09.04.07.56.25; Wed, 04 Sep 2019 07:56:43 -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 S1730965AbfIDOzb convert rfc822-to-8bit (ORCPT + 99 others); Wed, 4 Sep 2019 10:55:31 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:39502 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730324AbfIDOza (ORCPT ); Wed, 4 Sep 2019 10:55:30 -0400 Received: from bigeasy by Galois.linutronix.de with local (Exim 4.80) (envelope-from ) id 1i5Wgx-0006VY-UK; Wed, 04 Sep 2019 16:55:27 +0200 Date: Wed, 4 Sep 2019 16:55:27 +0200 From: Sebastian Andrzej Siewior To: Thomas Gleixner Cc: linux-kernel@vger.kernel.org, Julien Grall Subject: [PATCH v2] hrtimer: Add a missing bracket and hide `migration_base' on !SMP Message-ID: <20190904145527.eah7z56ntwobqm6j@linutronix.de> References: <20190821092409.13225-4-julien.grall@arm.com> <156652633520.11649.15892124550118329976.tip-bot2@tip-bot2> <20190904141540.xucehzbndjmgkrio@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8BIT In-Reply-To: User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The recent change to avoid taking the expiry lock when a timer is currently migrated 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 --- v1…v2: - use is_migration_base() as a helper function - slightly reword the commit message kernel/time/hrtimer.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c index f5a1a5e16216c..eaf31ac38efbb 100644 --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c @@ -140,6 +140,11 @@ static struct hrtimer_cpu_base migration_cpu_base = { #define migration_base migration_cpu_base.clock_base[0] +static bool is_migration_base(struct hrtimer_clock_base *base) +{ + return base == &migration_base; +} + /* * We are using hashed locking: holding per_cpu(hrtimer_bases)[n].lock * means that all timers which are tied to this base via timer->base are @@ -264,6 +269,11 @@ switch_hrtimer_base(struct hrtimer *timer, struct hrtimer_clock_base *base, #else /* CONFIG_SMP */ +static bool is_migration_base(struct hrtimer_clock_base *base) +{ + return false; +} + static inline struct hrtimer_clock_base * lock_hrtimer_base(const struct hrtimer *timer, unsigned long *flags) { @@ -1221,7 +1231,7 @@ void hrtimer_cancel_wait_running(const struct hrtimer *timer) * 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) + if (!timer->is_soft || is_migration_base(base)) { cpu_relax(); return; } -- 2.23.0