Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2018119rdb; Sun, 11 Feb 2024 07:41:44 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUhKd2Y3LRlThOviYD20k193TECEvG//U8vuKMTVZprdVklmddtFAeOCiSrutWUF5M8MnobcPvF2dwx5WE8JR9a5OwbpXVftYVr2wIdtQ== X-Google-Smtp-Source: AGHT+IHLL6rpxEE0w35tlC5ySxX39uY5yUsOnjMtsNOaVVKAHqXpLm/VBp8LZORbg8D517S4rYHN X-Received: by 2002:a05:6808:1186:b0:3c0:3724:e2 with SMTP id j6-20020a056808118600b003c0372400e2mr751070oil.27.1707666103886; Sun, 11 Feb 2024 07:41:43 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707666103; cv=pass; d=google.com; s=arc-20160816; b=SXrTXUCKnTP6d0c4C+wCpNy75I7KXliSG0E4fxvIcFREiij2SqRHaKBkVv/Dhkmype c3sKRaZoTvUMRHkO5qA05RtH23Ts77Zc0DvlGAlnK4lVglvEvbDnqmyZJWrLZbfIlZ1a 1EzJ2fsf9swO4fmbWbUJpGylpKqvNTSd6NQsiwaIm52chgv8CRyADNiHEc1B6GztGYFG eiPDNcrI8Z26quR84ilKAu709NFXRVzk2l5vBhxuvTgESoYCH9KkGB+U0CS3ZtbxxunS wNwDZYoNavm+MOvs937d3lL8gm6MBcq2aN/IfDrESOGAAqBkdOcX97V3pvku/FHGDnV5 wQNg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=Aw4Jj3qtUe+zeWB3BpSnQaMW9sQiXys3qy4Y4qroNJA=; fh=2dv2r0J3ADSntG3cQ6/+MCtXk9B16DxxXeqAysr9Z2o=; b=M5niQUkwwBQ/qwRQfQYlMzdGcXU2qQEyYnvActlvm5AL06KBFs51c5+3vyDyOpWpfg YjFVjnTPgfL7sEVf8qFtu725GTWLtNd4SdOkeXaHQoukS0c7CbCpRcRciWFlYRT5OurP TToJVfkbB5lK4MTX2fjnIhs4LoHRihTKMYsCl5VEnGx1I4p5NsQ1/N3lG+CYnlJUyDgj gHbs5ECsOueDTZ+tKtjcKlvbFaHNbFMvM4ZghaVPbbGioM7BgemiFNIpcJSWq4oKMhsi cMKYy6kkaqMAr8dIUchJPL3m1J7yJtTwsFt1Pzb5+9FOCIk+M9PZF96xKyEUU5pIpMTa 6DCw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b=cLw3Z9jq; 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-60840-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60840-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.alibaba.com X-Forwarded-Encrypted: i=2; AJvYcCWIV6AZ49+omcG3bUWPg+d5awQR1OmZ4KmYF6L3/mvTIaJdQSanWI1siCYZb2Jpy45wRu4SwaY3OXlF6PHyKWkmdiJwCu3YWRXdJxIyyg== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id b16-20020ac84f10000000b0042c718f95d4si1461672qte.11.2024.02.11.07.41.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 07:41:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60840-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b=cLw3Z9jq; 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-60840-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60840-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 9DCCB1C20E00 for ; Sun, 11 Feb 2024 15:41:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 823D75B67C; Sun, 11 Feb 2024 15:41:38 +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="cLw3Z9jq" Received: from out30-101.freemail.mail.aliyun.com (out30-101.freemail.mail.aliyun.com [115.124.30.101]) (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 A85E144C9E for ; Sun, 11 Feb 2024 15:41:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.101 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707666097; cv=none; b=XyKfL46BbWJwPqDpHfEU2NiUtjw9/WG/+KXTKBDUJwRH/7tksqFDzF3jeDQJzYXeXvDRDgmiZDs5v/pQdjYOj5toPFsEuIrSeFJBrwcY2u37sMNMjj5o+hOxKXwpjGXmU6uxC87ls9Gh53WkA91Qlm138/Ll3cmHnelT/pJz5m0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707666097; c=relaxed/simple; bh=nF+C2Wmo+HoCSViqCFxLWaM/5OmHs22JTBYSU3sawpg=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=o7gWO9Z3lIUi2mlH4bYD0OTPW+NgTjmgW4djWKhKL/dfc30mqes6H54UZZbBObKlPgHQpaYfhxzOXq2RVAmZuogqKzo3s6kyF9ZlQbuuC0ccURl4o8ZqfTNImcLW4CtFreyJ+Ro+4ay7dmdwU+1PVEQKupxqPvkynZQh2cBitTo= 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=cLw3Z9jq; arc=none smtp.client-ip=115.124.30.101 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=1707666086; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=Aw4Jj3qtUe+zeWB3BpSnQaMW9sQiXys3qy4Y4qroNJA=; b=cLw3Z9jqdIjfsoe+ifO94bPHxX22Zbmg0KIQg1nlAhxf9xMOnZg2qDEMYjVq0kQir3GI5xn8r1rzjFRhtvUTk6z4NEmmZg4TzZvPKXFdvx5VD1TnzlWaHd/WPxI31xA7RiVFPPhbUCIU/PQPdJDJj2xriWAb+0T1v03+WOp7jE8= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R321e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045170;MF=yaoma@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0W0QTTMQ_1707666083; Received: from 192.168.0.104(mailfrom:yaoma@linux.alibaba.com fp:SMTPD_---0W0QTTMQ_1707666083) by smtp.aliyun-inc.com; Sun, 11 Feb 2024 23:41:25 +0800 Message-ID: <05563a26-9c3f-4a3b-ade6-c417feca70e6@linux.alibaba.com> Date: Sun, 11 Feb 2024 23:41:23 +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 Subject: Re: [PATCHv6 2/2] watchdog/softlockup: report the most frequent interrupts Content-Language: en-US To: Doug Anderson Cc: akpm@linux-foundation.org, pmladek@suse.com, kernelfans@gmail.com, liusong@linux.alibaba.com, linux-kernel@vger.kernel.org, yaoma@linux.alibaba.com References: <20240208125426.70511-1-yaoma@linux.alibaba.com> <20240208125426.70511-3-yaoma@linux.alibaba.com> From: Bitao Hu In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 2024/2/9 00:03, Doug Anderson wrote: > Hi, > > On Thu, Feb 8, 2024 at 4:54 AM Bitao Hu wrote: >> >> +static void start_counting_irqs(void) >> +{ >> + int i; >> + int local_nr_irqs; >> + struct irq_desc *desc; >> + u32 *counts = __this_cpu_read(hardirq_counts); >> + >> + if (!counts) { >> + /* >> + * nr_irqs has the potential to grow at runtime. We should read >> + * it and store locally to avoid array out-of-bounds access. >> + */ >> + local_nr_irqs = READ_ONCE(nr_irqs); > > nit: I don't think the READ_ONCE() is actually needed above. All that > matters is that you're consistently using the same local variable > ("local_nr_irqs") for allocating the array, looping, and then storing. > No matter what optimizations might be happening and what else might be > happening on other CPUs, once you put it in a local variable the > compiler _must_ keep it consistent. Oh, yes, READ_ONCE() is not necessary here. > > That being said, I don't think it really matters, so I'm not sure it's > worth spinning your series just for that. > > In any case, this patch looks good to me now. Thanks! > > Reviewed-by: Douglas Anderson