From patchwork Tue Jan 23 16:46:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna-Maria Behnsen X-Patchwork-Id: 191111 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp484206dyi; Tue, 23 Jan 2024 09:20:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IHT5Lv8lZ8mC1CwB4rp38+4HU7QDvOp5tltRJhCIOIb64b7Ea2V5s8aMEA6qrVdMjC1MFVA X-Received: by 2002:a17:90b:30c2:b0:28e:8012:f2b1 with SMTP id hi2-20020a17090b30c200b0028e8012f2b1mr3567187pjb.80.1706030414566; Tue, 23 Jan 2024 09:20:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706030414; cv=pass; d=google.com; s=arc-20160816; b=l76+K0hdGUJTyuzQpCjCfcU3DYN8OjjvTb2DHUvhrH0frvJ9i/1QDV5FWkRXA8Cq5N TFNkHPemax1/OCi3We27ALrm4JefqjmVw5KV0nPvZtdpLMHpH+r6EzR5gej2AKaD0/BA VCZYPYxjtsgQFuRJJaYDqLISkdk/NLu9RAZJuUem+c57eu9YCfDKywLzUQA4S8v/b/pz DZUSFlSJV3bXhPQAG2NmW7XiaGXwqw2ec6Ffo8mZVFHFHlgfx5grbSHsf4u0s51uA021 G5put0z7vhfrIGhqTfn1CYNWBFczray9IwlvXL7neumSCDnavR55K7QUz0WdWrSrsA3k hwYw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:dkim-signature:dkim-signature:from; bh=d0sxRv/SQf4nMms7k/oUwYmN6EK8PHV+d6aCUPuL/OY=; fh=nOEvUOtvIydWxxQpRdVGTZdE7oDfSvGmdNyLCMjLbrA=; b=L2cWxnu5qBQFACwNBiPSViqMZ95MN4ER8LYpV7Nl2bUq24TTWL+B1xUcXiKpeHCJyw dumJcTScguCXW8QPw0U7XAznNvmLRSFapn3e8Hj2iKPEqKN/Z5aE3cdQUkgWG4J26OPR LyU/Kichv3q49nPf5fdRoOFW+cxsbOK7EhYMd0BT++2+7v0HXFjn9cvWPMd65KhLE0Al ND9pFC/Y3LRH663LlAIyN2RbcGkt5H1U+zXsD3V+6TPMOmt14G8x3AfqzHi/yovDPzAh 5zIPqG2ppJzOCF960wjaDMxUj6YUw55y8mLF5JuZMe3c26+PfRkaHAYuyk3D7x5aZMgx eRIA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=IaV2OZp+; 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-35703-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35703-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id fw21-20020a17090b129500b0029051ddf431si7656400pjb.115.2024.01.23.09.20.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 09:20:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35703-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=IaV2OZp+; 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-35703-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35703-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id A6EFBB241FD for ; Tue, 23 Jan 2024 16:52:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5C4E6128383; Tue, 23 Jan 2024 16:47:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="IaV2OZp+"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="PZvGQp3T" 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 C11A781ADD; Tue, 23 Jan 2024 16:47:18 +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=1706028440; cv=none; b=L9Vkkcl9x3AERU7feg4Rn+9fihm5Jav9TYok5gbZjWyR0SWC0yQroz+xhz0W0CwOVqyjV/CZ0NUQGKJAsAJ7u96TxkOzi0/I/NHCc727NZiv8AxlEroJWrf+KP9+OfwYc4ds3gBLKrFq3FI+KsGpJ++zTgdniLpRpnJV46/xxCA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706028440; c=relaxed/simple; bh=d8rsDzMorDANdDMVQ3WQDhgi/FdSTHxklICIHXgHMvk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=h9F+ItRBiUVn0A0uMTBox/iZJ8sLeDFVBHi1a+0Td4r/6LjgdNJWO6cGFuRluo7ZtH7T01QFPN7ah16bH3AFZ/addpApPy5r61KMU/pOJv0cj6I5RgtXyQskIu7w/2eqNJvJbQhLORqLuvU8JLXM+Q2/jfx84u2w6YUp/5cZp2c= 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=IaV2OZp+; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=PZvGQp3T; 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: Anna-Maria Behnsen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1706028437; 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=d0sxRv/SQf4nMms7k/oUwYmN6EK8PHV+d6aCUPuL/OY=; b=IaV2OZp+82gkYOAV+dk4Zl5Pq/IpigdN4/qk/TGHR43GhajiQJlF66S9vy7HipdqedE1CD tR7/fM7p7wmhnPlcXqXpLGRWP+Lg9kpKEwq5UgVXI12WlInhyf6Dn0dkNOhMlb3zUipLJB GoYVByy4D6IOXkisiwyC4K9rdCtyWvSe/5sty5NPWBTsbmUF/SXbNZaD9HtvtCSm/G53Nv uf8uigvwGdqrT6VKFQZF/gDUC3ToIBf3Qlv0RwdVOqV5tQpsyQSAtyUrGv33enxt4qaZU+ zb8qvCrqT9TutCQttTLqWeMLnzJe72Q0r5vH3MY2fCzd/a5DhEArfgEbG5Loow== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1706028437; 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=d0sxRv/SQf4nMms7k/oUwYmN6EK8PHV+d6aCUPuL/OY=; b=PZvGQp3T7mdQiqZcppvQM3x23Dfd6TVpV11f6Zpt1zxEhdsU4qQziTKnKgr9T2LfrL1bHC dosDHgv8nHgna1Dg== To: linux-kernel@vger.kernel.org Cc: Thomas Gleixner , Frederic Weisbecker , Ingo Molnar , John Stultz , Stephen Boyd , Jonathan Corbet , Clemens Ladisch , linux-doc@vger.kernel.org, Anna-Maria Behnsen Subject: [PATCH 4/8] timers: Add struct member description for timer_base Date: Tue, 23 Jan 2024 17:46:58 +0100 Message-Id: <20240123164702.55612-5-anna-maria@linutronix.de> In-Reply-To: <20240123164702.55612-1-anna-maria@linutronix.de> References: <20240123164702.55612-1-anna-maria@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788902548247810538 X-GMAIL-MSGID: 1788902548247810538 timer_base struct lacks description of struct members. Important struct member information is sprinkled in comments or in code all over the place. Collect information and write struct description to keep track of most important information in a single place. Signed-off-by: Anna-Maria Behnsen --- kernel/time/timer.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/kernel/time/timer.c b/kernel/time/timer.c index 352b161113cd..d44dba1d4af0 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -196,6 +196,51 @@ EXPORT_SYMBOL(jiffies_64); # define BASE_DEF 0 #endif +/** + * struct timer_base - Per CPU timer base (number of base depends on config) + * @lock: Lock protecting the timer_base + * @running_timer: When expiring timers, the lock is dropped. To make + * sure not to race agains deleting/modifying a + * currently running timer, the pointer is set to the + * timer, which expires at the moment. If no timer is + * running, the pointer is NULL. + * @expiry_lock: PREEMPT_RT only: Lock is taken in softirq around + * timer expiry callback execution and when trying to + * delete a running timer and it wasn't successful in + * the first glance. It prevents priority inversion + * when callback was preempted on a remote CPU and a + * caller tries to delete the running timer. It also + * prevents a life lock, when the task which tries to + * delete a timer preempted the softirq thread which + * is running the timer callback function. + * @timer_waiters: PREEMPT_RT only: Tells, if there is a waiter + * waiting for the end of the timer callback function + * execution. + * @clk: clock of the timer base; is updated before enqueue + * of a timer; during expiry, it is 1 offset ahead of + * jiffies to avoid endless requeuing to current + * jiffies + * @next_expiry: expiry value of the first timer; it is updated when + * finding the next timer and during enqueue; the + * value is not valid, when next_expiry_recalc is set + * @cpu: Number of CPU the timer base belongs to + * @next_expiry_recalc: States, whether a recalculation of next_expiry is + * required. Value is set true, when a timer was + * deleted. + * @is_idle: Is set, when timer_base is idle. It is triggered by NOHZ + * code. This state is only used in standard + * base. Deferrable timers, which are enqueued remotely + * never wake up an idle CPU. So no matter of supporting it + * for this base. + * @timers_pending: Is set, when a timer is pending in the base. It is only + * reliable when next_expiry_recalc is not set. + * @pending_map: bitmap of the timer wheel; each bit reflects a + * bucket of the wheel. When a bit is set, at least a + * single timer is enqueued in the related bucket. + * @vectors: Array of lists; Each array member reflects a bucket + * of the timer wheel. The list contains all timers + * which are enqueued into a specific bucket. + */ struct timer_base { raw_spinlock_t lock; struct timer_list *running_timer;