Received: by 2002:a05:6358:16cd:b0:dc:6189:e246 with SMTP id r13csp1131778rwl; Fri, 4 Nov 2022 10:06:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7q95Iy1+FcQ/69AvJbScUUWvBbhvUC0FLMzRlsB2nGF5Hyb8ykFMcqs3XzDVSesyJP683E X-Received: by 2002:aa7:8687:0:b0:560:3299:a6c0 with SMTP id d7-20020aa78687000000b005603299a6c0mr36847322pfo.81.1667581617861; Fri, 04 Nov 2022 10:06:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667581617; cv=none; d=google.com; s=arc-20160816; b=xG4+7ln0upOz6p0wu50uPtknlXvMTEu2mEvVvI+zKhMXlTg061l3wf+Ubg4WomoWRe R8wwqTV/snr0+4VQl0MxHKgXklBQ18ITvqoWczOHuURsxTwnbIsSg1D83Zz6H6BoCGO9 WLeTTMOKKaW65S17QuEMfHjI88VHukWfXS/6gAnOFXl3/LrXP2Q5EZcGIBIWxsAwWV1y SnNXivE17RPtiDD4OELOrGpav/cZnTgwzvh8JHrdRT6vm1V+IFw5uWJ151w3fhefEyjc PGgcVeux52gUMX70FSPep1v6e/hhMZ+FoLhBNykDpUlLGKKOK2HrU+Ms3GGd5M5Xl2kc ZPlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=f4Xb1kWUsIVwOUhjOboDBCyMcBp7XPQ0DqrWFAKSR9Q=; b=gHK5TBShbvSyGcL/9jy3hvsDmLLLVK6vmOXHiojGHc+TumYngSCTJsEgK4+b2qd1YM Wfoka827jwE6KL+2IpjeiHytONvrpUzIhUc0/lMcRRjwZ/eoHt9kIBzq27SP412eKqLL 1zFhc8ceZowmCioJ4Z31Zz8140X51JRgTHEgi+Ml2YQFUArMYYLDyO3iEQZpfqQ1VbPT DSmVMj+1+lnr8Inphk3j80DfmoPqbHbrOPQQyXUxTGtQTyN17u3lERTfV2WVvYFh5xjA 8ZVBEyOOM2vpdTnEjqHFy9Gw6Izfc7D28Pb2qgLTGOYL7NmYhEH5QIem2Jhe2X0IxZKw Kt4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kk5AVgkk; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i22-20020a635416000000b0046f72960506si6136119pgb.422.2022.11.04.10.06.44; Fri, 04 Nov 2022 10:06:57 -0700 (PDT) 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=@kernel.org header.s=k20201202 header.b=kk5AVgkk; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230185AbiKDQoJ (ORCPT + 96 others); Fri, 4 Nov 2022 12:44:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231693AbiKDQnt (ORCPT ); Fri, 4 Nov 2022 12:43:49 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DA0B31EF9 for ; Fri, 4 Nov 2022 09:43:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DE9D4B82E72 for ; Fri, 4 Nov 2022 16:43:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0D007C433D6; Fri, 4 Nov 2022 16:43:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1667580225; bh=vrLFKGbB+WonWostWlSiKuz27yHax/ThgTlKqQVTgQc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=kk5AVgkkcTwryvrh2TJfl7NM2BKytqTBHdEgOXT2xqFY+wl4POYrFfa4QAamr5vqb reNy8dz5iWRdgDjEpLGBavDGqCNLPvHf98qJIqxZCvG1kdEDXhz6RkpMar1Fdc88Up B+j5D1mZGSIg5QCWtZIN7/Fqh1+HtA4Q4/Ke18nBket/nuElg7fRMyDwiAx/ntwPDK IAKEICkjRbmYwqcvyU5o72UCKZqTeBYPGHavvVhSyyGHhEoXRdIx4fEnXHNqWfwmnr 4Ud4W72vgP2U1aitNzu9F//GNbqosFqagOixG5lRdJbos2UgFqpdBOmTtE53p4fIMI LRlMZH2v1QjJQ== Date: Fri, 4 Nov 2022 17:43:42 +0100 From: Frederic Weisbecker To: Anna-Maria Behnsen Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , John Stultz , Thomas Gleixner , Eric Dumazet , "Rafael J . Wysocki" , Arjan van de Ven , "Paul E . McKenney" , Frederic Weisbecker , Rik van Riel , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Theodore Ts'o , "Jason A. Donenfeld" , Stephen Boyd , Tejun Heo , Lai Jiangshan Subject: Re: [PATCH v4 05/16] add_timer_on(): Make sure callers have TIMER_PINNED flag Message-ID: <20221104164342.GA1440400@lothringen> References: <20221104145737.71236-1-anna-maria@linutronix.de> <20221104145737.71236-6-anna-maria@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221104145737.71236-6-anna-maria@linutronix.de> X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 Fri, Nov 04, 2022 at 03:57:26PM +0100, Anna-Maria Behnsen wrote: > The implementation of the hierachical timer pull model will change the > timer bases per CPU. Timers, that have to expire on a specific CPU, require > the TIMER_PINNED flag. Otherwise they will be queued on the dedicated CPU > but in global timer base and those timers could also expire on other > CPUs. Timers with TIMER_DEFERRABLE flag end up in a separate base anyway > and are executed on the local CPU only. > > Therefore add the missing TIMER_PINNED flag for those callers who use > add_timer_on() without the flag. No functional change. You're fixing the current callers but what about the future ones? add_timer_on() should always guarantee that a timer runs on the right destination, which is not the case after your patchset if the timer hasn't been set to TIMER_PINNED. Therefore I think we should either have: * add_timer_on() enforce TIMER_PINNED (doesn't work because if the timer is later called with mod_timer(), we should expect it to run anywhere) or * add_timer_on() warns if !TIMER_PINNED or * have an internal flag TIMER_LOCAL, that is turned on when add_timer_on() is called or add_timer()/mod_timer() is called on a TIMER_PINNED. Otherwise it is turned off. The last solution should work with existing API and you don't need to chase the current and future users of add_timer_on(). Thanks.