From mboxrd@z Thu Jan 1 00:00:00 1970 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=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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 20612C433B4 for ; Sat, 10 Apr 2021 07:57:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CFF866113A for ; Sat, 10 Apr 2021 07:57:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230511AbhDJHxc (ORCPT ); Sat, 10 Apr 2021 03:53:32 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:55174 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229472AbhDJHxa (ORCPT ); Sat, 10 Apr 2021 03:53:30 -0400 From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1618041193; 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=gTrlIINQDxzKaJaoX5kqDJxTIH9GFxc/xXfriRQ1wYk=; b=Dxp5chLUxb8Oo2mJnBxNh5709aOIfnrnQwiw9PmFv0mcLN8gfIOfQ6bjOJ7CqRCjlDhrug YMgZ3yC2KXgxKVOdm9DYXvEQqsapGLDv0BwyX4w2KvAfgaJHsxbIPbhH5kICd4twxVjk4x RuciTRJ9NMj+B7MfyYywS34k0aYncF4K6ZlUg6p7e2DpJvhtJMggaicJwEWCLceMtzrlah f9js7z1NFrnv6OiU4wQ2ywoCDVyXVoCxNP9sM8tFx8JyxC9A6vRcfWtonqIs3LUbIOcZqq 1jSi5claN47saboM5Ynbh5DLgQx7RcENG8HKqi9+b7c1PbFh7pwNscXUuHSTGQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1618041193; 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=gTrlIINQDxzKaJaoX5kqDJxTIH9GFxc/xXfriRQ1wYk=; b=nVWQ5rhqrjHEoGV0Y+1mCYqhKaSkLXE7E6TI8Eyw5K+7xQqA/KnO2gPzrfl8Tm/YZLjrQ3 5aDXXgn1x45PQiDw== To: Marcelo Tosatti , Anna-Maria Behnsen Cc: linux-kernel@vger.kernel.org, Frederic Weisbecker , Peter Xu , Nitesh Narayan Lal , Alex Belits Subject: Re: [PATCH] hrtimer: avoid retrigger_next_event IPI In-Reply-To: <20210409165146.GA40118@fuller.cnet> References: <20210407135301.GA16985@fuller.cnet> <87o8en4k9a.ffs@nanos.tec.linutronix.de> <20210409165146.GA40118@fuller.cnet> Date: Sat, 10 Apr 2021 09:53:13 +0200 Message-ID: <87lf9q4lue.ffs@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 09 2021 at 13:51, Marcelo Tosatti wrote: > On Fri, Apr 09, 2021 at 04:15:13PM +0200, Thomas Gleixner wrote: >> On Wed, Apr 07 2021 at 10:53, Marcelo Tosatti wrote: >> ---> fail because that newly started timer is on the old offset. > > CPU0 CPU1 > > > clock_was_set() > Case-1: CPU-1 grabs base->lock before CPU-0: > CPU-0 sees active_mask[CPU1] and IPIs. > > base = lock_hrtimer_base(timer, &flags); > if (__hrtimer_start_range_ns(timer, tim, ... > hrtimer_reprogram(timer, true); > > unlock_hrtimer_base(timer, &flags); > > > raw_spin_lock_irqsave(&cpu_base->lock, flags); > if (need_reprogram_timer(cpu_base)) > cpumask_set_cpu(cpu, mask); > else > hrtimer_update_base(cpu_base); > raw_spin_unlock_irqrestore(&cpu_base->lock, flags); > > Case-2: CPU-1 grabs base->lock after CPU-0: > CPU-0 will have updated the offsets remotely. > > base = lock_hrtimer_base(timer, &flags); > if (__hrtimer_start_range_ns(timer, tim, ... > hrtimer_reprogram(timer, true); > > unlock_hrtimer_base(timer, &flags); > > > No? Yeah, you're right. I misread the loop logic. Can we please make that unconditional independent of nohz full. There is no reason to special case it. Thanks, tglx