From patchwork Mon Feb 26 22:24:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 206956 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2365819dyb; Mon, 26 Feb 2024 14:26:10 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV9p9jcbm2CZK7nlkVM1TpJkr5kD+BRLJbvi4Os4jUyN0ncd8ZZGlTTXXqhhaJQ18eHiVORkVxBe0p5cY2KG5XVTaM48g== X-Google-Smtp-Source: AGHT+IFnIBvrvjd3CLDz5Tc8wPOKS6w3YVlUlj3DfPgRT7VTBaeWA+CT4fVl2bxfkYiA8DBDsggr X-Received: by 2002:a17:90a:9af:b0:299:906b:488e with SMTP id 44-20020a17090a09af00b00299906b488emr7267212pjo.18.1708986370083; Mon, 26 Feb 2024 14:26:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708986370; cv=pass; d=google.com; s=arc-20160816; b=uTZ6VHZ7ZrkqRvEAfWSqdU+rey2xGMBGJtiqIFee+z4kg9dx7VwsSCrEcdxYo9zVH2 OGYGzZxe6MReV2jKHHvBFyDDm8PIDJlvKz4zNEDPANkRzLo0o2UfDns34jWl1I3h7v06 NkJBi+1l4EsrQ+Df0h/gdPDKyAuklcLqCPwoFVjIQgONwsuYBGzLN8Na31Zf33FMFsP0 J1IPLvFvoYewtrxFZT/yE4hZGmtWkyfK89DqpNucM6OA/j0jCifSfuOXGe6/QkYTfTED JjDX60PjraO4mFzeWdYwLg6FTJV8IKFTBJ0XebhRinaq4GSz83G5FpeeZ1fO4GqNJ9CW SycA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:precedence:robot-unsubscribe:robot-id :message-id:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:in-reply-to:cc:subject:to:reply-to:sender :from:dkim-signature:dkim-signature:date; bh=N/vcZ6pcdKVZi5Z+UKncqylpibfLy4U/GGaLZVaCKeQ=; fh=9Ax9dUTktkw7GUAcxhp/hScrn1H6VeDItxi6qdujZxg=; b=WGxl5Rw7YjrPmWlwwRBhOJkBkzu/QCYEfkSzQhnA6wii8DduBN4zua/IFGfnP73xhB EjZLpZMZO6L6/C8In62VWcIQ8ofkNlPWneZlBBkKTZzGqcZyUVtUA74B6eACgY5P3iBY aLgdaWMKhZRV8i8leZ3OBTV+jiqzwuve0Y4lO4is0fJnWM36kEfE59S/wK4Dfk9SGiAC R/q5idsYWe22g27dhBdBo0nWZifq61SEwY5+ysKjvHmmTHKlmVNOnnRTurqrIibRu3SQ FvxooJhTGvjEo6GI+g/iIvorQjuGfPg/RUvFxDxTYpWpZ6tOVuR1Li+sFI2MEXNoBXeh xxjQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=dRe72MT4; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-82391-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82391-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id h7-20020a17090a470700b002992d2f3518si6265630pjg.40.2024.02.26.14.26.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 14:26:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-82391-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=dRe72MT4; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-82391-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82391-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id A841628A774 for ; Mon, 26 Feb 2024 22:25:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A4F10134CDE; Mon, 26 Feb 2024 22:24:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="dRe72MT4"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="tnh3pNDH" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D1A111332A3; Mon, 26 Feb 2024 22:24:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708986276; cv=none; b=D/YSGW3g3r8YLxf88RpfKvZF74OE6D6a1oviGswf2TQtoivMRKcn8VMm2ZnGLLGY7/v1P3qzuZCxFfbPCzyRcGRiChxbTirrTym8Pd+UEDIGDhB4GQ3kNh08Kst7lCRP3ucYKNtLU6uHo55dorF0PZT89tj5RTqsIlUo44tzDQE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708986276; c=relaxed/simple; bh=MXYuqddvAgScwlDuDC2mLdCth928Zms9L8JCQc6Bm48=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=WKZm4ta7Ykpbx+eL5D6lS5qjVRttaog3bE8m1ACKEYx9ltnpPxQLhnLuJ3eSsIwR1e8r2RoXPqYD4EfyjC9RktdVHHrGv6AEY8qu45s1F2Pd9D0W2t+q1ab2UNE8+eviT1zcd5tOq1fCkXykqGpj9dwigkLx7b4axx9gIhiVOXs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=dRe72MT4; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=tnh3pNDH; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Date: Mon, 26 Feb 2024 22:24:32 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1708986272; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=N/vcZ6pcdKVZi5Z+UKncqylpibfLy4U/GGaLZVaCKeQ=; b=dRe72MT4TbthnpZsT4LbqXhC0oFy7foVTfRIcPUR/Ivqg0jF4yRn9rC0PDqJeVeGGm8OTl NeuMxbTsO6YbOhg8+zcpAvhK2hYI5l3fKHPIO/F8EWGoqUVle6j4NQYwIO9wUBE5LBpB2/ q++4SaeI6yN8bR0+zT8fHrsctonBP88puXHSDvl3J/raxPFx6PACb0LAGt2weyyA4qBi/w f9ts3g699NvRrblbC1bA6O0hZwBlH3P94ohwwL9guxmA4u2x1cuCkO4Kd5Pe5bM0llkOCg hRnfXREPgv5W97uL07CDZLAnkvckJy6l3JpvQ/frLY8Zkw5sz6tPr+gquPDlSQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1708986272; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=N/vcZ6pcdKVZi5Z+UKncqylpibfLy4U/GGaLZVaCKeQ=; b=tnh3pNDHCsiVpauYcDQDFZwBE3pwkRof34M0nZWHoZfrxnwM1Xe6nHYXWigqz3ZEEauDVP GiNh4cwyyFv114Dw== From: "tip-bot2 for Frederic Weisbecker" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: timers/core] tick: Move got_idle_tick away from common flags Cc: Frederic Weisbecker , Thomas Gleixner , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20240225225508.11587-12-frederic@kernel.org> References: <20240225225508.11587-12-frederic@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <170898627211.398.9037031004873986695.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791913483579797503 X-GMAIL-MSGID: 1792002092489503950 The following commit has been merged into the timers/core branch of tip: Commit-ID: 3ce74f1a8566dbbc9774f85fb0ce781fe290fd32 Gitweb: https://git.kernel.org/tip/3ce74f1a8566dbbc9774f85fb0ce781fe290fd32 Author: Frederic Weisbecker AuthorDate: Sun, 25 Feb 2024 23:55:03 +01:00 Committer: Thomas Gleixner CommitterDate: Mon, 26 Feb 2024 11:37:32 +01:00 tick: Move got_idle_tick away from common flags tick_nohz_idle_got_tick() is called by cpuidle_reflect() within the idle loop with interrupts enabled. This function modifies the struct tick_sched's bitfield "got_idle_tick". However this bitfield is stored within the same mask as other bitfields that can be modified from interrupts. Fortunately so far it looks like the only race that can happen is while writing ->got_idle_tick to 0, an interrupt fires and writes the ->idle_active field to 0. It's then possible that the interrupted write to ->got_idle_tick writes back the old value of ->idle_active back to 1. However if that happens, the worst possible outcome is that the time spent between that interrupt and the upcoming call to tick_nohz_idle_exit() is accounted as idle, which is negligible quantity. Still all the bitfield writes within this struct tick_sched's shadow mask should be IRQ-safe. Therefore move this bitfield out to its own storage to avoid further suprises. Signed-off-by: Frederic Weisbecker Signed-off-by: Thomas Gleixner Reviewed-by: Thomas Gleixner Link: https://lore.kernel.org/r/20240225225508.11587-12-frederic@kernel.org --- kernel/time/tick-sched.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/time/tick-sched.h b/kernel/time/tick-sched.h index 35808bb..3b555e0 100644 --- a/kernel/time/tick-sched.h +++ b/kernel/time/tick-sched.h @@ -61,7 +61,6 @@ struct tick_sched { unsigned int tick_stopped : 1; unsigned int idle_active : 1; unsigned int do_timer_last : 1; - unsigned int got_idle_tick : 1; /* Tick handling: jiffies stall check */ unsigned int stalled_jiffies; @@ -73,6 +72,7 @@ struct tick_sched { ktime_t next_tick; unsigned long idle_jiffies; ktime_t idle_waketime; + unsigned int got_idle_tick; /* Idle entry */ seqcount_t idle_sleeptime_seq;