Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp2368157rbb; Tue, 27 Feb 2024 22:16:46 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXjSd1+igtYAn9Kxi3fySu0NEg45TYAOjvDRja4t8TcNjLuNst9W+NAvdrz38VQN0fO5RCN30Pb2lPNI/FIegmLMHp49odFcGh10E7h8w== X-Google-Smtp-Source: AGHT+IGzgixAUsSyRBjXpEWH9+Jm6B9OUtUGsThjT3X65x6UaNRU6AHhJtUyBcoZmpQOasdWhPu9 X-Received: by 2002:a17:902:c211:b0:1db:8fd9:ba0d with SMTP id 17-20020a170902c21100b001db8fd9ba0dmr11492036pll.23.1709101005880; Tue, 27 Feb 2024 22:16:45 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709101005; cv=pass; d=google.com; s=arc-20160816; b=fwyXP00tHuda2xliN+D1FEW44UvLDir+NiPYhZbmeDuE8s4smqCfT6KuOsW3GTTvQm I+TPHBZhRl5tvbbNB7VOQDyG4UkiIU4H/TaHlObkYgFlL2La9EnVpk0FWQnfh8W0kn+e SbNNqvSQz0nC+aHUTuNFjrp4RCEEpnzeVr6xoliw4DCPugc05P47j1VVMNANdDJBtWBB Uh5BH2OikMoEmPUUoSrk9ecU/kktv2XGFI84F5gjDzQmAMc60RQgB81kPuQsN3Ux5MS0 o/wVt1Sn8CoxwT6MaGzgu3a2ofzVo/+bc2DdC19bxrI98IOMqyQtZY23R/GwUepS7VeP qiJg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:from:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=VTjKIhOK3qM69jCegJqoVI39eQmDbxUQOTEPlMd6XqI=; fh=UyRWar5gypakcxE9qFDy60Lixhg02or2e+hUVbYt3Y4=; b=BpoVsi1/03UhIYeMMFs1TvHIKIA8ogMiSkWNK5GQQZUjJZW0SZhw1YCVB0CHBC4jIU Q+G9WAM9LXAj4d9oGI1BADm/hwZTy/gfQYv/QIwmdeAlRuFleDi0swqGnBrCWUP3+BGn lcS2dSzJtbKUar6Ozfxmd1JhpP7hvF6Mra/wrzrubUD48twCaewGw5oLsM0v8zyC4ju9 5M0atKfNn5WOgmtk70wIMxQT+EJF4K36Lg1OH5cLmJnZKdLGE+cUBnflA/QzIrfJPE+l jz52TfXMv3i2FEmYk+tgNJQRxcnybwaqKDaVZc3J3gSXPGeQZyNznX0h47iUqtTUiYkD lckw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b=HzqEYi+b; arc=pass (i=1 spf=pass spfdomain=linux.alibaba.com dkim=pass dkdomain=linux.alibaba.com dmarc=pass fromdomain=linux.alibaba.com); spf=pass (google.com: domain of linux-kernel+bounces-84553-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84553-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.alibaba.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id h6-20020a170902f7c600b001d9a51954b1si2582558plw.527.2024.02.27.22.16.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 22:16:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-84553-linux.lists.archive=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=@linux.alibaba.com header.s=default header.b=HzqEYi+b; arc=pass (i=1 spf=pass spfdomain=linux.alibaba.com dkim=pass dkdomain=linux.alibaba.com dmarc=pass fromdomain=linux.alibaba.com); spf=pass (google.com: domain of linux-kernel+bounces-84553-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84553-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.alibaba.com 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 8FFD228A150 for ; Wed, 28 Feb 2024 06:07:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 492E221A19; Wed, 28 Feb 2024 06:07:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="HzqEYi+b" Received: from out30-111.freemail.mail.aliyun.com (out30-111.freemail.mail.aliyun.com [115.124.30.111]) (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 867674A1A; Wed, 28 Feb 2024 06:07:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.111 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709100446; cv=none; b=d9leuw/lQ2ID7TQWB97GDH6WIQSbwUI6ZAZynBFYDk0hL8SW9PAHEpaTVMomQgjb6ExOzQrc1MOKldaWWZQn5qgCSpSMtW6in04oRkleiSZwUZ+aEVhMdGRk7tuzl+ABl3+Wxzy1KjggzuSCKOo1WcQI+B9erdpamQ1dEvg6Mq4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709100446; c=relaxed/simple; bh=YViSoMR2lQJQi3H4+zFsBmb+MxoYYAqwfyQrWv5y1vs=; h=Message-ID:Date:MIME-Version:From:Subject:To:Cc:References: In-Reply-To:Content-Type; b=KSnPkYSAmVnRaCd/ybIrgwh8L79XgMNF3+nPjVUsOfkKQgJE8iCrAk+R6xP50UbWHr3zLsm4luqDKrcjcS6W84Qn3JsFtLh4FUerqLH1vet99MkpyeY4FNdanI4yXh9VpPzbppHIJMDm7qGUjiLDfsPCXqla7EtAFdJPHiVHb+c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=HzqEYi+b; arc=none smtp.client-ip=115.124.30.111 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1709100440; h=Message-ID:Date:MIME-Version:From:Subject:To:Content-Type; bh=VTjKIhOK3qM69jCegJqoVI39eQmDbxUQOTEPlMd6XqI=; b=HzqEYi+b3N0uSJLVbYlO6sgrPn75zCPFIKORn8BC+/A3dSpgLupv2xYlIvtF0punLHrhwjauWbEMu6InbOUNruIyDlQfY8/jmvJpVJCeurxb0Lylm4K6DHQkB0CuBe9RYLHCBjh4eTCLb6y2al3ZUEXnCxSrQ8AxQ2VPRO4HV+8= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R641e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046060;MF=yaoma@linux.alibaba.com;NM=1;PH=DS;RN=16;SR=0;TI=SMTPD_---0W1OnNtY_1709100436; Received: from 30.178.67.139(mailfrom:yaoma@linux.alibaba.com fp:SMTPD_---0W1OnNtY_1709100436) by smtp.aliyun-inc.com; Wed, 28 Feb 2024 14:07:18 +0800 Message-ID: <1606230b-83af-4f5f-b1ef-6ae8f73841f5@linux.alibaba.com> Date: Wed, 28 Feb 2024 14:07:15 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Bitao Hu Subject: Re: [PATCHv10 3/4] genirq: Avoid summation loops for /proc/interrupts To: Thomas Gleixner , dianders@chromium.org, 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 Cc: linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, yaoma@linux.alibaba.com References: <20240226020939.45264-1-yaoma@linux.alibaba.com> <20240226020939.45264-4-yaoma@linux.alibaba.com> <87le769s0w.ffs@tglx> <87a5nlapc2.ffs@tglx> Content-Language: en-US In-Reply-To: <87a5nlapc2.ffs@tglx> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2024/2/27 23:39, Thomas Gleixner wrote: > On Tue, Feb 27 2024 at 19:20, Bitao Hu wrote: >> On 2024/2/27 17:26, Thomas Gleixner wrote: >>> >>> and then let kstat_irqs() and show_interrupts() use it. See? >> >> I have a concern. kstat_irqs() uses for_each_possible_cpu() for >> summation. However, show_interrupts() uses for_each_online_cpu(), >> which means it only outputs interrupt statistics for online cpus. >> If we use for_each_possible_cpu() in show_interrupts() to calculate >> 'any_count', there could be a problem with the following scenario: >> If an interrupt has a count of zero on online cpus but a non-zero >> count on possible cpus, then 'any_count' would not be zero, and the >> statistics for that interrupt would be output, which is not the >> desired behavior for show_interrupts(). Therefore, I think it's not >> good to have kstat_irqs() and show_interrupts() both use the same >> logic. What do you think? > > Good point. But you simply can have > > unsigned int kstat_irq_desc(struct irq_desc *desc, const struct cpumask *mask) > > and hand in the appropriate cpumask, which still shares the code, no? > Alright, that is a good approach.