Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp498735lqg; Fri, 1 Mar 2024 11:23:06 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVpg9FBbxPhnkOUOzv7W8r8LprbmoWEOUwY/gXTOdrWfdq1KcRW/igYrtmWxaUB8jztSUT1B49eI36l5tBsEa774a+d9hJSUa9V6t3gfQ== X-Google-Smtp-Source: AGHT+IEFP2Dd7r38kQ9WLQ1/csZ1dfLaxgLcS1KKTfgBFJnUlkrpnAc6PjOAoxQ9a5jDA7R7ZOBK X-Received: by 2002:a05:6870:15c2:b0:21e:8a73:f45e with SMTP id k2-20020a05687015c200b0021e8a73f45emr2640223oad.16.1709320985842; Fri, 01 Mar 2024 11:23:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709320985; cv=pass; d=google.com; s=arc-20160816; b=MyBvKt5Llby3UtLPZrhNN4eSCq2KnIRf84qZFOMOqd7M9NdQqk8WOOF1NkbpsxvE1o 4YqyPm8VrPf5SZdi2tq7COi8Rxlcfh82/BXJDqRHisv8EoGzXg6Zp7s/H1Xl8ZFN6mlv n/aPg6Er0rkhrW0qxUvOUvnIdPihdIdfB0PObWlZH7T0KkJmJi2O5ekVupYi4n+vbD7O Yg6qxxyDukz8BNw8utKcTbuaVZSFFN/zaDzRQTc4JFXW0EZYE2U9+uWXuiauftUnVAZg rX4HiUuqIT2LOtpemmniuoUzuMUm3Zp14bmCHFA5iuRGayzbO6iy7p+/DGnXBG7XSBUy oL8Q== 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=4YMpY8/JpqyvoIt2gTWiMpRfebnk0Oqv1/khPRGpbCE=; fh=eVLGd1UNT2gNcvsk6j2J5Q39/OI59Lle+QJPCHc1b8s=; b=JEr1fQfVimPEBRJwQPHWVuXvTYfiKS3dzYOfz4ZBClJsFzCD7MXTzd1+QqAYDevk2O c+bS3h5SMHvw3ciYbNDToNE+FkuM01P9qMoCwubYMgxsFf8v7oFzKxbsEkIknIIpJSZT fjgWASQ/PnYhT7NNsKzt4Qe7oBlCbHK+59PJz/1JNDpmVBzdRncjC5/Wbpyds0aaE2us hKc5L+SarsRWMey47cj7vw6i2Vc6nXEuwsfRATRY0IeHbgJIwSivxNxeizTX78qL7poo 3OlvvLaMuRgnpV4L6LO2cSP1XQ7LpqlxcN2gHxzlLFqyCbFYbIrHsbwCyABTl+Htq3Io tswA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=lt5xGL4i; 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-89010-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89010-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id b31-20020a05620a271f00b00787fd91df2bsi3975021qkp.408.2024.03.01.11.23.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 11:23:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-89010-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=lt5xGL4i; 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-89010-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89010-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 858521C20E5D for ; Fri, 1 Mar 2024 19:23:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 113B33A294; Fri, 1 Mar 2024 19:22:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="lt5xGL4i"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="GQe+ObDJ" 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 AB0DC4411; Fri, 1 Mar 2024 19:22:56 +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=1709320978; cv=none; b=TynzYToiLEs3F7gwqM+I0Wvc4vQphf7Rg+g8iV0Of1Mnv8KVD1LbRBEbXWB9WalYSyB8++kdRn6WJkCKGpsru4FFEoikzGNXKiMsv4sSKvnsQ+8nINDt8/yOTDdesttAkDMIroK7LbtOx9Dfcmbz17+8u19hgSlo+nOoEfhE8BU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709320978; c=relaxed/simple; bh=RnWq3/w3b5O1R4cAPn/Hl295cghGBKImtXIoeFUspHQ=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=a1rmPTtm9YaPp8npyTYYmIZn1RaFMBjJtajHix1zQS5ubbEKz2qXYbc48uZeGelYzfTtG+i911uMgqNcKERyeTG8FmvLT0no0fL8nTA7h/2MJWYQhQvYvMUGSXRPCCC/brDlJxSinuYByCJaNezVrCNTyVCEkQRtZWNH5IKVBhA= 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=lt5xGL4i; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=GQe+ObDJ; 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=1709320974; 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=4YMpY8/JpqyvoIt2gTWiMpRfebnk0Oqv1/khPRGpbCE=; b=lt5xGL4ikp2rMYJDfZ7HvTc51J0sK0wPz+5c8vFx1SuS27stYaJOWuKM8UWBr5+pgOT4Px /zf1ECIiqu/o9bDNXwd0OmwFvn3wr5s6TWTh22XQgJnd6zNcYHvNw3H+EjqkCRzzHyGlCK 9c0McLTbOgJYwbxjj3ufVtBUaYTbp1OW9F0wWwGg67WLBjIW6BXQ6uACYMaX/U19dW7hVE 7YFSbHNtjH9wi+H5aXUENJ0WYyrEuLnL22HQ9pNMUw1GoSzpgNifD5GbZh1qfFM9H40tVf 8sahtMCI3rvRxY+czEM18S9Ga4W7B19CKnB0D8BHfOsg6bSvXKNzJzKLNOWfWA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1709320974; 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=4YMpY8/JpqyvoIt2gTWiMpRfebnk0Oqv1/khPRGpbCE=; b=GQe+ObDJ3PZr8qn2Ba8iOXvXOcVj7SM/gbg0My85H7/CKDbtY8JoxFhCmURN3Iwmiu2nfV rZD31bO4dKD6t8DQ== To: Doug Anderson , Bitao Hu Cc: liusong@linux.alibaba.com, akpm@linux-foundation.org, pmladek@suse.com, kernelfans@gmail.com, deller@gmx.de, npiggin@gmail.com, tsbogend@alpha.franken.de, James.Bottomley@hansenpartnership.com, jan.kiszka@siemens.com, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCHv11 2/4] genirq: Provide a snapshot mechanism for interrupt statistics In-Reply-To: References: <20240228072216.95130-1-yaoma@linux.alibaba.com> <20240228072216.95130-3-yaoma@linux.alibaba.com> Date: Fri, 01 Mar 2024 20:22:54 +0100 Message-ID: <87plwdwycx.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 Doug! On Wed, Feb 28 2024 at 14:44, Doug Anderson wrote: > I won't insist on it, but I continue to worry about memory > implications with large numbers of CPUs. With a 4-byte int, 8192 max > CPUs, and 100 IRQs the extra "ref" value takes up over 3MB of memory > (8192 * 4 bytes * 100). > > Technically, you could add a new symbol like "config > NEED_IRQ_SNAPSHOTS". This wouldn't be a symbol selectable by the end > user but would automatically be selected by "config > SOFTLOCKUP_DETECTOR_INTR_STORM". If the config wasn't defined then the > struct wouldn't contain "ref" and the snapshot routines would just be > static inline stubs. > > Maybe Thomas has an opinion about whether this is something to worry > about. Worst case it wouldn't be hard to do in a follow-up patch. I'd say it makes sense to give people a choice to save memory especially when the softlock detector code is not enabled. It's rather straight forward to do. Thanks, tglx --- --- a/include/linux/irqdesc.h +++ b/include/linux/irqdesc.h @@ -24,7 +24,9 @@ struct pt_regs; */ struct irqstat { unsigned int cnt; +#ifdef CONFIG_GENIRQ_STAT_SNAPSHOT unsigned int ref; +#endif }; /** --- a/kernel/irq/irqdesc.c +++ b/kernel/irq/irqdesc.c @@ -978,6 +978,7 @@ static unsigned int kstat_irqs(unsigned return sum; } +#ifdef CONFIG_GENIRQ_STAT_SNAPSHOT void kstat_snapshot_irqs(void) { struct irq_desc *desc; @@ -998,6 +999,7 @@ unsigned int kstat_get_irq_since_snapsho return 0; return this_cpu_read(desc->kstat_irqs->cnt) - this_cpu_read(desc->kstat_irqs->ref); } +#endif /** * kstat_irqs_usr - Get the statistics for an interrupt from thread context --- a/kernel/irq/Kconfig +++ b/kernel/irq/Kconfig @@ -108,6 +108,10 @@ config GENERIC_IRQ_MATRIX_ALLOCATOR config GENERIC_IRQ_RESERVATION_MODE bool +# Snapshot for interrupt statistics +config GENERIC_IRQ_STAT_SNAPSHOT + bool + # Support forced irq threading config IRQ_FORCED_THREADING bool