From patchwork Wed May 10 07:28:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna-Maria Behnsen X-Patchwork-Id: 91934 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp3436464vqo; Wed, 10 May 2023 00:47:26 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4Mz+CyH+3w6EBmwfCcvSsbqxpUcSHYv9rxc7p/uyAkf33Bh/rK8cOj0WgJJZXd/KTmO2ht X-Received: by 2002:a05:6a00:2e9b:b0:642:ffef:1d03 with SMTP id fd27-20020a056a002e9b00b00642ffef1d03mr25170795pfb.32.1683704845750; Wed, 10 May 2023 00:47:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683704845; cv=none; d=google.com; s=arc-20160816; b=0dj/SvB6nMVrNbKJ2K2m2Auww4XlZggprXNb5/aVhN26FUZ5IJa/uR88m9hMNNhtEv m7OA6eCdzgGQmaGjnstCnvOqtwQ7RXC/THRwN9gQBE4Ieg+DqJ8dJ7wFQ68fLG8YSC9t FX4dv8GoRExZYxdgbD8bsKzyCyhNUXre+KIP67W0egLQGA5xL5qVHqSYZ9nja3WmhDxO NqZ0O0q4VAY+XRA2wSkJ7DWhvrf96EyE5Cb/y3r9BveNud5u0jECY769Hxfl3IyFVWQU d/E8loAC5YU+601IIpTyiS7d5EKdM9sB95EsZcBPWqfEnlWOQGgcjLI1J3TknrzmlIRX uPXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:dkim-signature :dkim-signature:from; bh=lT6/GGqloCM8AGirZHb7HkPsMCoi/5vNo/Me8IGb/1s=; b=y0FqGiP1geQnRqcfNjXHkgklxx+1wZwqLZVJ99tNgSd2zQVA3xsI5nhITQM04Oj/PW 5BvJFgm78eGZR49St3diWXnB0g/E5+R0NUSw4rYpa+9tlYP444SX3TKO7XMSvUsp8u54 K34fZTBkAfR0uNbvip58cROfrD87aqyR53VUQj6WmyqbZlBuEF8qXclu6FBXeQZvJtNu 16u3j6g8/C2gOKHU6kbKNg/8YvT+A+9VZZ1E/KNUSwgXvCRBQBHUtlop8o5rAUjsXYmr mJz+Hz+LhcOYK4rQ5AYogGXp9mOtsYzanzEKdFFaNZOq+7FPNVmjA0MrTJZAP/UKchBy nsWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=2Mqiuo92; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v29-20020aa799dd000000b00643ae7da34bsi4467107pfi.221.2023.05.10.00.47.13; Wed, 10 May 2023 00:47:25 -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=@linutronix.de header.s=2020 header.b=2Mqiuo92; 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 S236115AbjEJH3x (ORCPT + 99 others); Wed, 10 May 2023 03:29:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235960AbjEJH3Y (ORCPT ); Wed, 10 May 2023 03:29:24 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D8B57D8C for ; Wed, 10 May 2023 00:28:56 -0700 (PDT) From: Anna-Maria Behnsen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1683703720; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lT6/GGqloCM8AGirZHb7HkPsMCoi/5vNo/Me8IGb/1s=; b=2Mqiuo92z48phqeRXqWoUMsZPEFrzIhRVT+J1YshgWz2+4P5b0LOYTvyGZNPUacrQPW48v Z7kIMwxy5G2iejQIhaNULoIdStlvO7o6vUpR93xf70jDDcfA+wrTJUua0n+Rn9v4Rq2sE/ pyw7HGciP4RjJowBhZob4+L3wNVRygHGARQV6i4FKn82r/W+mANXqfck9Gp6tGIkCm6zfY zYrx15iXJ2PRmdN2uZ3WlZmi3YV0AD9oGDQKDN8HN39PfysngFvs3EAj48ntPDTt0l4JsT qxAQ2/xArJL5MNJyTUXUkHAk4xtb0Mfv6dQU9pvMSFWgxlcF7yP7E9xbezfzPg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1683703720; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lT6/GGqloCM8AGirZHb7HkPsMCoi/5vNo/Me8IGb/1s=; b=oTESrKHaMqa70qHNvL8JepL8nZJkSya/Ea+0tjziXKVDAwcT7cKPQBsgFKvRQlfPqEk502 7tq0z6BFiVGrC5BQ== To: linux-kernel@vger.kernel.org Cc: Peter Zijlstra , John Stultz , Thomas Gleixner , Eric Dumazet , "Rafael J . Wysocki" , Arjan van de Ven , "Paul E . McKenney" , Frederic Weisbecker , Rik van Riel , Steven Rostedt , Sebastian Siewior , Giovanni Gherdovich , Lukasz Luba , "Gautham R . Shenoy" , Anna-Maria Behnsen Subject: [PATCH v6 09/21] timer: add_timer_on(): Make sure TIMER_PINNED flag is set Date: Wed, 10 May 2023 09:28:05 +0200 Message-Id: <20230510072817.116056-10-anna-maria@linutronix.de> In-Reply-To: <20230510072817.116056-1-anna-maria@linutronix.de> References: <20230510072817.116056-1-anna-maria@linutronix.de> MIME-Version: 1.0 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,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765492492108591862?= X-GMAIL-MSGID: =?utf-8?q?1765492492108591862?= When adding a timer to the timer wheel using add_timer_on(), it is an implicitly pinned timer. With the timer pull at expiry time model in place, TIMER_PINNED flag is required to make sure timers end up in proper base. Add TIMER_PINNED flag unconditionally when add_timer_on() is executed. Signed-off-by: Anna-Maria Behnsen Reviewed-by: Frederic Weisbecker --- kernel/time/timer.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/kernel/time/timer.c b/kernel/time/timer.c index ab9a8bb11a8a..b7599216d183 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -1281,7 +1281,10 @@ EXPORT_SYMBOL(add_timer_global); * @timer: The timer to be started * @cpu: The CPU to start it on * - * Same as add_timer() except that it starts the timer on the given CPU. + * Same as add_timer() except that it starts the timer on the given CPU and + * the TIMER_PINNED flag is set. When timer shouldn't be a pinned timer in + * the next round, add_timer_global() should be used instead as it unsets + * the TIMER_PINNED flag. * * See add_timer() for further details. */ @@ -1295,6 +1298,9 @@ void add_timer_on(struct timer_list *timer, int cpu) if (WARN_ON_ONCE(timer_pending(timer))) return; + /* Make sure timer flags have TIMER_PINNED flag set */ + timer->flags |= TIMER_PINNED; + new_base = get_timer_cpu_base(timer->flags, cpu); /*