Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp1658257rdb; Thu, 25 Jan 2024 02:14:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IGTFR0LAy/+KFknUutddos7PXNYbxFgl267mLd8C1ARODQ22gs5lAtKQfNNm01+3dzjcxZs X-Received: by 2002:a05:6a20:3c8c:b0:19c:65ac:5d0a with SMTP id b12-20020a056a203c8c00b0019c65ac5d0amr1131973pzj.18.1706177651996; Thu, 25 Jan 2024 02:14:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706177651; cv=pass; d=google.com; s=arc-20160816; b=rVmbsdLYHowVd0HfGCRrKfjhIrCW9EWUlb4e3Mvr/3udjngPVEiN1CgLgG+n8RB8IA 0fjcgIaJwFj/3ndYajlVZ+1Swavi/RoQPQU/24ruvi+O/a1QFWjXK8OC4tYsOvjifVhx 0skbC55/nJeuUY3QQuPzy1y9OKbp+Po6+8nwm4KtAObJZCMU39Xn+2JhK3swP27C4OQ0 zbhG4uOCqeZpeku79epgT/XSqlmMkcjRQJ1DpD7sB68v5JJ9EZgr0rWAN36V1SjMtlzA qSPLKjgFZ8tEAiJd05THZf65i2vt8XjHXdlReYszQTmBj3WC5WvL2D8NTnsqX8bF7yVy 278g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:date:references:in-reply-to:subject:cc:to:dkim-signature :dkim-signature:from; bh=qWekMXGaQK39zDTcL7PmP47XrpVgN69sD1/oaIMhHmM=; fh=ArO5S2f1rvOnBmBk4qnXzbNnl1G0evdbqv5Z8pM5RrA=; b=KoEt9Os0EMMDNtkyLrzcWoWuU5HL3czL5Y40dnhwvf3GEA61JtoNjQxSmmP2t5gK7Y wEn2OsHr9iIeEHPS4VwKyifxsE6TOpWbxT8b7ZN4XgKVTdCiG3JvluHLQdH69gPkfzB8 n9DAm13qjMVB5yQZ0glWxnznNYfYjmS/kRAEg0Md+kv+S6ps3huxQPEDjJWl0vDh9q6b njS2/WwJ2tMzggnrApeKGAriqIIV94zw+10FOEjfDvuSxhuRXmWEQq5jiNFzsYT+YP99 7Yr8SAhho8oINCgvB4yfaxHAuOCfXm1lq0VMYZd6VJ+OcyI4XPplAk47InBJ6CmzNUCA 0KvA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=vmyyic7S; 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-38296-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38296-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id o1-20020a17090a5b0100b0028e69509986si1082086pji.68.2024.01.25.02.14.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 02:14:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-38296-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=vmyyic7S; 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-38296-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38296-linux.lists.archive=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 45BD3B31DFE for ; Thu, 25 Jan 2024 09:41:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C877E1BF3B; Thu, 25 Jan 2024 09:40:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="vmyyic7S"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Po1pHhTR" 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 A54331BC22 for ; Thu, 25 Jan 2024 09:40:26 +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=1706175628; cv=none; b=L2TFmWpP91bJ38F6Cy9IupgFNd7X296HtkTikDWNUclJPCqjbm1ePIAUKRKAxEI6UiDbg0E2iqbcNlNRZDLC1BNl4wSHK6PJnu2Sdf3DviPu7QLx8+FQF/9QtaMn13DbYDMVNlzdtK+nAJSjf56Lrv1u2tUkDp/9NnuCjRVAmd8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706175628; c=relaxed/simple; bh=qWekMXGaQK39zDTcL7PmP47XrpVgN69sD1/oaIMhHmM=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=Uaf8LLMtCofxMhqooEUfwzEXdNUsQ7TWalRotKMnBNTMw2G7nNYHkWC4YNr8kTXC+ZVLVxvuxJGdpeY9SrLFNgEVmkyjvegIHkMyKzDbYr/TnSqOK7MBRvkk0gZ92H4MTJghhW/4A4oWOHuHobttxk6l2+GnE8UDO15aTKQNUn4= 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=vmyyic7S; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=Po1pHhTR; 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 From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1706175624; 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=qWekMXGaQK39zDTcL7PmP47XrpVgN69sD1/oaIMhHmM=; b=vmyyic7SmDEZW/soglbW7ZGsbltzjrFewxgZ6sLT5mlGn8Qn7OEQ17BnopeO17QkE2S/5B 42vYpbnrQjOVYwr0t0YQGXK2N1ry/mRMDEjpobll84RuBPLm44vluGpzhOmlywjeRwxmYv 6rFq6l1+W1y8rVGDIqxD5oXK2UlXDlrmGgRqUC4q5BJqpVD+OkjUWg9Gq5fbGBJ0plDhDd L0+frOsiAlE+2yg0M+aCrgpJ81jofkMTSLhI2QD3D+DTOzqqzTqZPwHRQKS2eNFnLwpINo ydqmcDJg0n9KGDSzGBGqU0PkkzfX+IMDiHrMzXlTwV/vmlz83iWS0iUbJbysqQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1706175624; 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=qWekMXGaQK39zDTcL7PmP47XrpVgN69sD1/oaIMhHmM=; b=Po1pHhTRqSqmQwXca1mAuEvp78kxfpm21tEcV+BRZlrjjETSTCCQ3TZWhov54R++qz9cjl 9XmqrO8FWy2Ib/BQ== To: Frederic Weisbecker , LKML Cc: Frederic Weisbecker , Ingo Molnar , Anna-Maria Behnsen , Peng Liu , Joel Fernandes Subject: Re: [PATCH 11/15] tick: Move got_idle_tick away from common flags In-Reply-To: <20240124170459.24850-12-frederic@kernel.org> References: <20240124170459.24850-1-frederic@kernel.org> <20240124170459.24850-12-frederic@kernel.org> Date: Thu, 25 Jan 2024 10:40:24 +0100 Message-ID: <87o7d9iwdz.ffs@tglx> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain On Wed, Jan 24 2024 at 18:04, Frederic Weisbecker wrote: > 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 Reviewed-by: Thomas Gleixner