From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13EE6ECAAA1 for ; Thu, 27 Oct 2022 23:07:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235547AbiJ0XH0 (ORCPT ); Thu, 27 Oct 2022 19:07:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234377AbiJ0XHV (ORCPT ); Thu, 27 Oct 2022 19:07:21 -0400 Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA9EC8F97E for ; Thu, 27 Oct 2022 16:07:20 -0700 (PDT) Received: by mail-pg1-x52e.google.com with SMTP id f193so3208307pgc.0 for ; Thu, 27 Oct 2022 16:07:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dabbelt-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:to:from:cc :in-reply-to:subject:date:from:to:cc:subject:date:message-id :reply-to; bh=3gyfpmFe14VJ3jdYNVJ0rx3Ah2uaRzNTmMnT4495S4I=; b=ZNNSYZLMCiTx3pCpdTSLaMqTAwcT0XD23hboDkck2m1sj0K18I/wiwFIJBnxkxlMh1 TMOX+6v0XNUWVLrMkaS7nFMD6HK3C70ZLK5411vF56AMxZrrEveIWdn7U/wWYAX6hu8f z7X+MhLcDZ2abQ+JkeJnFiHqWkFba2HtnVwkX4LhmKXO9kCXDrbkBH+MQc0VlITciM7I DQ4GGK7LnrmeObtOo33dthlXeC/HBl0rQRBuyHKeRHXZmYYPUrcsYqTcTlXIWwUSoL9i Op+9awjoXqXajuMDeHaLc5MvW/7/blHnT1v9JwgcyUng9A7q3UoZ9aZNVukbXbfjaCwz UOQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:to:from:cc :in-reply-to:subject:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=3gyfpmFe14VJ3jdYNVJ0rx3Ah2uaRzNTmMnT4495S4I=; b=aNuJZaEFuemXFQ3A9P5PBNrQWZYJ/+lnaUCqzBxlmv8G93zN4zuY7nyLFGbHSmrBhM FCa3B1k8DKq4mD32QPyACzh5Y4xTSgws9hkFMI3TmnTdB/V/7QUnkQnq1PS5GWuQt2yD MzVCzpD1E7/Davk2ZT2eX9uPTIgAOl5rY1r7izwe3OFNyPmuEnrdDpbdzCuogFB5LmIw IjmfQNOVtTOmfIH9sRwafu7yu/vjrpWqVkn/Ltahd5dxfZ46y5nVvtJr+vuqx6XLe1Fp 8sjymKxW6qPm/pk+ZzySy/8N0/27SgV6sLY3kUseYtSaIaTyMi3oN3JdFlzI8BKkZPPQ adNg== X-Gm-Message-State: ACrzQf3jWTpEpCFR4MuqI89KM5PeRgRDqMeKX3Wv1Xi7jRtWN4h4DPXz qz+jqQmSNQeyDv62qVpEIVrqcQ== X-Google-Smtp-Source: AMsMyM48cCCOaGHpcUrqKPuvLPqi8N0s0YHUDIkD3gXkNLjihHit7dpsoFkfZbjAvACH4Z61kt9rCg== X-Received: by 2002:a65:44c1:0:b0:428:ab8f:62dd with SMTP id g1-20020a6544c1000000b00428ab8f62ddmr44319504pgs.211.1666912040505; Thu, 27 Oct 2022 16:07:20 -0700 (PDT) Received: from localhost ([50.221.140.188]) by smtp.gmail.com with ESMTPSA id bf4-20020a170902b90400b00186e8526790sm1675818plb.127.2022.10.27.16.07.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Oct 2022 16:07:18 -0700 (PDT) Date: Thu, 27 Oct 2022 16:07:18 -0700 (PDT) X-Google-Original-Date: Thu, 27 Oct 2022 15:22:27 PDT (-0700) Subject: Re: [PATCH v3 0/2] Fix /proc/cpuinfo cpumask warning In-Reply-To: <20221014155845.1986223-1-ajones@ventanamicro.com> CC: x86@kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, yury.norov@gmail.com, Paul Walmsley , aou@eecs.berkeley.edu, jonas@southpole.se, stefan.kristiansson@saunalahti.fi, shorne@gmail.com, openrisc@lists.librecores.org, mpe@ellerman.id.au, linuxppc-dev@lists.ozlabs.org, hca@linux.ibm.com, gor@linux.ibm.com, agordeev@linux.ibm.com, linux-s390@vger.kernel.org From: Palmer Dabbelt To: ajones@ventanamicro.com Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 14 Oct 2022 08:58:43 PDT (-0700), ajones@ventanamicro.com wrote: > Commit 78e5a3399421 ("cpumask: fix checking valid cpu range") has > started issuing warnings[*] when cpu indices equal to nr_cpu_ids - 1 > are passed to cpumask_next* functions. seq_read_iter() and cpuinfo's > start and next seq operations implement a pattern like > > n = cpumask_next(n - 1, mask); > show(n); > while (1) { > ++n; > n = cpumask_next(n - 1, mask); > if (n >= nr_cpu_ids) > break; > show(n); > } > > which will issue the warning when reading /proc/cpuinfo. > > [*] Warnings will only appear with DEBUG_PER_CPU_MAPS enabled. > > This series address the issue for x86 and riscv, but from a quick > grep of cpuinfo seq operations, I think at least openrisc, powerpc, > and s390 also need an equivalent patch. While the test is simple (see > next paragraph) I'm not equipped to test on each architecture. > > To test, just build a kernel with DEBUG_PER_CPU_MAPS enabled, boot to > a shell, do 'cat /proc/cpuinfo', and look for a kernel warning. > > While the patches are being posted together in a series since they're > for two different architectures they don't necessarily need to go > through the same tree. > > v3: > - Change condition from >= to == in order to still get a warning > for > as that's unexpected. [Yury] > - Picked up tags on the riscv patch > > v2: > - Added all the information I should have in the first place > to the commit message [Boris] > - Changed style of fix [Boris] > > Andrew Jones (2): > RISC-V: Fix /proc/cpuinfo cpumask warning I just took the RISC-V fix, might be worth re-sending the x86 one alone as nobody's replied over there so it may be lost. Thanks! > x86: Fix /proc/cpuinfo cpumask warning > > arch/riscv/kernel/cpu.c | 3 +++ > arch/x86/kernel/cpu/proc.c | 3 +++ > 2 files changed, 6 insertions(+) From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 343B3ECAAA1 for ; Thu, 27 Oct 2022 23:07:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Mime-Version:Message-ID:To:From:CC:In-Reply-To: Subject:Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References:List-Owner; bh=oUaswphrnMLyJtKgj1GybQl4nLiL6Jn19827U+4uA1U=; b=yVKldhZtYt4d5RHcNPYVBQq6NJ 6Bt+8LyrulHX9PUM8rKSBaJU961eLT4DBHNZ6XYrB1bYb9RBELMpa+1vl5Csbxu5EyKsTDF/M2rL/ uc0ogZ9rrXcpZAdyPZIWbfy2Qe30jVYq/v5CZarqzz9aSA2OfYZJ9vB4u80CvT0psyVfaddZpvUo8 vV8Nq4zdkHLX5EGOcAqYeY4G62c29Tz3pq1Z2c2BhoZ2HG4kBrusUHYSDEu+7+MxEf8JR6kl1btT+ UPgTWaHSgnXLAbscYt4NaaLxdKhPg6t57T/n9sc7n0rDgRkfQkWkrrqiM242rmZxcDnFjqC/52w+O s8WlzHoQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ooBy8-00FApR-Sc; Thu, 27 Oct 2022 23:07:24 +0000 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ooBy6-00FAno-JY for linux-riscv@lists.infradead.org; Thu, 27 Oct 2022 23:07:24 +0000 Received: by mail-pg1-x532.google.com with SMTP id 78so3139263pgb.13 for ; Thu, 27 Oct 2022 16:07:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dabbelt-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:to:from:cc :in-reply-to:subject:date:from:to:cc:subject:date:message-id :reply-to; bh=3gyfpmFe14VJ3jdYNVJ0rx3Ah2uaRzNTmMnT4495S4I=; b=ZNNSYZLMCiTx3pCpdTSLaMqTAwcT0XD23hboDkck2m1sj0K18I/wiwFIJBnxkxlMh1 TMOX+6v0XNUWVLrMkaS7nFMD6HK3C70ZLK5411vF56AMxZrrEveIWdn7U/wWYAX6hu8f z7X+MhLcDZ2abQ+JkeJnFiHqWkFba2HtnVwkX4LhmKXO9kCXDrbkBH+MQc0VlITciM7I DQ4GGK7LnrmeObtOo33dthlXeC/HBl0rQRBuyHKeRHXZmYYPUrcsYqTcTlXIWwUSoL9i Op+9awjoXqXajuMDeHaLc5MvW/7/blHnT1v9JwgcyUng9A7q3UoZ9aZNVukbXbfjaCwz UOQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:to:from:cc :in-reply-to:subject:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=3gyfpmFe14VJ3jdYNVJ0rx3Ah2uaRzNTmMnT4495S4I=; b=6XngVXjiRNELaZ4ULimIInv6lDS+RgT9ooOW6SYoi+0o2ppFkIS9lXNca46d+/hO/W 3WbQLxfSeS+NuNdwGTboJ9ROLV1TGdSgABELcz74koqbDD3+LsRNdkkKuyE/rj9JcUtD PgDTsRSt/vKZqmg5zv9O21TYSlB7PukVHLjKmrS9+hdHKCklkugZ4RTjxdtT1gZPSC+f gOlAoqvHroCjEAXADq7ItLll2LB7ojnCO+rGtzMQ0joCCmReFy/UBZ5NmqBkUfbdUpiM HazFDXroU1K8pI/N80NYSuP45k1ir49SiOMalr1S22RsROI5Ov+GzdFnSF/D1ljD0+Z+ p0RQ== X-Gm-Message-State: ACrzQf3or8OwoXReF4Mfq7Z3LL4DoIqALdAnbf6EvJ5iuNmGzxrsJLuQ ZvFRKKeS+B1zY/driTP9h2Bv1Q== X-Google-Smtp-Source: AMsMyM48cCCOaGHpcUrqKPuvLPqi8N0s0YHUDIkD3gXkNLjihHit7dpsoFkfZbjAvACH4Z61kt9rCg== X-Received: by 2002:a65:44c1:0:b0:428:ab8f:62dd with SMTP id g1-20020a6544c1000000b00428ab8f62ddmr44319504pgs.211.1666912040505; Thu, 27 Oct 2022 16:07:20 -0700 (PDT) Received: from localhost ([50.221.140.188]) by smtp.gmail.com with ESMTPSA id bf4-20020a170902b90400b00186e8526790sm1675818plb.127.2022.10.27.16.07.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Oct 2022 16:07:18 -0700 (PDT) Date: Thu, 27 Oct 2022 16:07:18 -0700 (PDT) X-Google-Original-Date: Thu, 27 Oct 2022 15:22:27 PDT (-0700) Subject: Re: [PATCH v3 0/2] Fix /proc/cpuinfo cpumask warning In-Reply-To: <20221014155845.1986223-1-ajones@ventanamicro.com> CC: x86@kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, yury.norov@gmail.com, Paul Walmsley , aou@eecs.berkeley.edu, jonas@southpole.se, stefan.kristiansson@saunalahti.fi, shorne@gmail.com, openrisc@lists.librecores.org, mpe@ellerman.id.au, linuxppc-dev@lists.ozlabs.org, hca@linux.ibm.com, gor@linux.ibm.com, agordeev@linux.ibm.com, linux-s390@vger.kernel.org From: Palmer Dabbelt To: ajones@ventanamicro.com Message-ID: Mime-Version: 1.0 (MHng) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221027_160722_664912_B8053542 X-CRM114-Status: GOOD ( 23.53 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org On Fri, 14 Oct 2022 08:58:43 PDT (-0700), ajones@ventanamicro.com wrote: > Commit 78e5a3399421 ("cpumask: fix checking valid cpu range") has > started issuing warnings[*] when cpu indices equal to nr_cpu_ids - 1 > are passed to cpumask_next* functions. seq_read_iter() and cpuinfo's > start and next seq operations implement a pattern like > > n = cpumask_next(n - 1, mask); > show(n); > while (1) { > ++n; > n = cpumask_next(n - 1, mask); > if (n >= nr_cpu_ids) > break; > show(n); > } > > which will issue the warning when reading /proc/cpuinfo. > > [*] Warnings will only appear with DEBUG_PER_CPU_MAPS enabled. > > This series address the issue for x86 and riscv, but from a quick > grep of cpuinfo seq operations, I think at least openrisc, powerpc, > and s390 also need an equivalent patch. While the test is simple (see > next paragraph) I'm not equipped to test on each architecture. > > To test, just build a kernel with DEBUG_PER_CPU_MAPS enabled, boot to > a shell, do 'cat /proc/cpuinfo', and look for a kernel warning. > > While the patches are being posted together in a series since they're > for two different architectures they don't necessarily need to go > through the same tree. > > v3: > - Change condition from >= to == in order to still get a warning > for > as that's unexpected. [Yury] > - Picked up tags on the riscv patch > > v2: > - Added all the information I should have in the first place > to the commit message [Boris] > - Changed style of fix [Boris] > > Andrew Jones (2): > RISC-V: Fix /proc/cpuinfo cpumask warning I just took the RISC-V fix, might be worth re-sending the x86 one alone as nobody's replied over there so it may be lost. Thanks! > x86: Fix /proc/cpuinfo cpumask warning > > arch/riscv/kernel/cpu.c | 3 +++ > arch/x86/kernel/cpu/proc.c | 3 +++ > 2 files changed, 6 insertions(+) _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.librecores.org (lists.librecores.org [88.198.125.70]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F683FA3743 for ; Thu, 27 Oct 2022 23:07:23 +0000 (UTC) Received: from [172.31.1.100] (localhost.localdomain [127.0.0.1]) by mail.librecores.org (Postfix) with ESMTP id 0EAE824B70; Fri, 28 Oct 2022 01:07:23 +0200 (CEST) Received: from mail-pg1-f178.google.com (mail-pg1-f178.google.com [209.85.215.178]) by mail.librecores.org (Postfix) with ESMTPS id 25AAF24B3B for ; Fri, 28 Oct 2022 01:07:22 +0200 (CEST) Received: by mail-pg1-f178.google.com with SMTP id q71so3160899pgq.8 for ; Thu, 27 Oct 2022 16:07:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dabbelt-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:to:from:cc :in-reply-to:subject:date:from:to:cc:subject:date:message-id :reply-to; bh=3gyfpmFe14VJ3jdYNVJ0rx3Ah2uaRzNTmMnT4495S4I=; b=ZNNSYZLMCiTx3pCpdTSLaMqTAwcT0XD23hboDkck2m1sj0K18I/wiwFIJBnxkxlMh1 TMOX+6v0XNUWVLrMkaS7nFMD6HK3C70ZLK5411vF56AMxZrrEveIWdn7U/wWYAX6hu8f z7X+MhLcDZ2abQ+JkeJnFiHqWkFba2HtnVwkX4LhmKXO9kCXDrbkBH+MQc0VlITciM7I DQ4GGK7LnrmeObtOo33dthlXeC/HBl0rQRBuyHKeRHXZmYYPUrcsYqTcTlXIWwUSoL9i Op+9awjoXqXajuMDeHaLc5MvW/7/blHnT1v9JwgcyUng9A7q3UoZ9aZNVukbXbfjaCwz UOQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:to:from:cc :in-reply-to:subject:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=3gyfpmFe14VJ3jdYNVJ0rx3Ah2uaRzNTmMnT4495S4I=; b=TZeEgiZoLV9Gkj4jQm6jEtqkZJbzywqsdDznRXMQbgYfXFKJ9hKbM4ZW7FzCvGdeEf 46Zb2L/nTWxtHdo3Qd6MdYJ/nkk7vTUcfiyNGCHnBLIGbw/82JE5sloulLKWDQr+eNs+ rt5atQvTRHTx2NEnLSif7ytNMM4Q7pC0MKy2Z5W/2H2CtTI2+XZ3SkOHRFo1uq1C+SiV f6XHR0LrRUnSorrmcVBAqeBDwP4lMX/5PWZR2n1OKGQNwfONhKdzWLWYlHEwBWwhB7na hoVtaidazXS1C79CFUc+6soilxhQOXLxdgDipiEdyAsYCsJ/EykYn7IHDeq+Efd9pmeV E0LA== X-Gm-Message-State: ACrzQf0gNWov9oUwYi0PdNL7tP1yyTkIXxwnZ4y0rGu0iClciDik6vh2 8pv3OFTXL8QMrTi9fGmydg/3lQ== X-Google-Smtp-Source: AMsMyM48cCCOaGHpcUrqKPuvLPqi8N0s0YHUDIkD3gXkNLjihHit7dpsoFkfZbjAvACH4Z61kt9rCg== X-Received: by 2002:a65:44c1:0:b0:428:ab8f:62dd with SMTP id g1-20020a6544c1000000b00428ab8f62ddmr44319504pgs.211.1666912040505; Thu, 27 Oct 2022 16:07:20 -0700 (PDT) Received: from localhost ([50.221.140.188]) by smtp.gmail.com with ESMTPSA id bf4-20020a170902b90400b00186e8526790sm1675818plb.127.2022.10.27.16.07.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Oct 2022 16:07:18 -0700 (PDT) Date: Thu, 27 Oct 2022 16:07:18 -0700 (PDT) X-Google-Original-Date: Thu, 27 Oct 2022 15:22:27 PDT (-0700) Subject: Re: [PATCH v3 0/2] Fix /proc/cpuinfo cpumask warning In-Reply-To: <20221014155845.1986223-1-ajones@ventanamicro.com> From: Palmer Dabbelt To: ajones@ventanamicro.com Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: openrisc@lists.librecores.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Discussion around the OpenRISC processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jonas@southpole.se, linux-s390@vger.kernel.org, agordeev@linux.ibm.com, dave.hansen@linux.intel.com, gor@linux.ibm.com, yury.norov@gmail.com, mpe@ellerman.id.au, hca@linux.ibm.com, x86@kernel.org, linux-kernel@vger.kernel.org, openrisc@lists.librecores.org, mingo@redhat.com, bp@alien8.de, Paul Walmsley , linux-riscv@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, tglx@linutronix.de, aou@eecs.berkeley.edu Errors-To: openrisc-bounces@lists.librecores.org Sender: "OpenRISC" On Fri, 14 Oct 2022 08:58:43 PDT (-0700), ajones@ventanamicro.com wrote: > Commit 78e5a3399421 ("cpumask: fix checking valid cpu range") has > started issuing warnings[*] when cpu indices equal to nr_cpu_ids - 1 > are passed to cpumask_next* functions. seq_read_iter() and cpuinfo's > start and next seq operations implement a pattern like > > n = cpumask_next(n - 1, mask); > show(n); > while (1) { > ++n; > n = cpumask_next(n - 1, mask); > if (n >= nr_cpu_ids) > break; > show(n); > } > > which will issue the warning when reading /proc/cpuinfo. > > [*] Warnings will only appear with DEBUG_PER_CPU_MAPS enabled. > > This series address the issue for x86 and riscv, but from a quick > grep of cpuinfo seq operations, I think at least openrisc, powerpc, > and s390 also need an equivalent patch. While the test is simple (see > next paragraph) I'm not equipped to test on each architecture. > > To test, just build a kernel with DEBUG_PER_CPU_MAPS enabled, boot to > a shell, do 'cat /proc/cpuinfo', and look for a kernel warning. > > While the patches are being posted together in a series since they're > for two different architectures they don't necessarily need to go > through the same tree. > > v3: > - Change condition from >= to == in order to still get a warning > for > as that's unexpected. [Yury] > - Picked up tags on the riscv patch > > v2: > - Added all the information I should have in the first place > to the commit message [Boris] > - Changed style of fix [Boris] > > Andrew Jones (2): > RISC-V: Fix /proc/cpuinfo cpumask warning I just took the RISC-V fix, might be worth re-sending the x86 one alone as nobody's replied over there so it may be lost. Thanks! > x86: Fix /proc/cpuinfo cpumask warning > > arch/riscv/kernel/cpu.c | 3 +++ > arch/x86/kernel/cpu/proc.c | 3 +++ > 2 files changed, 6 insertions(+) From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D4BAAECAAA1 for ; Thu, 27 Oct 2022 23:08:20 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4Mz1Yv11Z2z3cHG for ; Fri, 28 Oct 2022 10:08:19 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=dabbelt-com.20210112.gappssmtp.com header.i=@dabbelt-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=ZNNSYZLM; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=dabbelt.com (client-ip=2607:f8b0:4864:20::535; helo=mail-pg1-x535.google.com; envelope-from=palmer@dabbelt.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=dabbelt-com.20210112.gappssmtp.com header.i=@dabbelt-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=ZNNSYZLM; dkim-atps=neutral Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4Mz1Xs4CX8z3c7H for ; Fri, 28 Oct 2022 10:07:25 +1100 (AEDT) Received: by mail-pg1-x535.google.com with SMTP id 20so3169431pgc.5 for ; Thu, 27 Oct 2022 16:07:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dabbelt-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:to:from:cc :in-reply-to:subject:date:from:to:cc:subject:date:message-id :reply-to; bh=3gyfpmFe14VJ3jdYNVJ0rx3Ah2uaRzNTmMnT4495S4I=; b=ZNNSYZLMCiTx3pCpdTSLaMqTAwcT0XD23hboDkck2m1sj0K18I/wiwFIJBnxkxlMh1 TMOX+6v0XNUWVLrMkaS7nFMD6HK3C70ZLK5411vF56AMxZrrEveIWdn7U/wWYAX6hu8f z7X+MhLcDZ2abQ+JkeJnFiHqWkFba2HtnVwkX4LhmKXO9kCXDrbkBH+MQc0VlITciM7I DQ4GGK7LnrmeObtOo33dthlXeC/HBl0rQRBuyHKeRHXZmYYPUrcsYqTcTlXIWwUSoL9i Op+9awjoXqXajuMDeHaLc5MvW/7/blHnT1v9JwgcyUng9A7q3UoZ9aZNVukbXbfjaCwz UOQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:to:from:cc :in-reply-to:subject:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=3gyfpmFe14VJ3jdYNVJ0rx3Ah2uaRzNTmMnT4495S4I=; b=jTVTxmCvyM52reFYPCNUF03OKZV409KlUnTTlV+XG3XXtV8Vi/nCyAUORqKRTC9BEh x86cdCRfPNBAe4NE9qUOo9yhlmuSW32x3Vj7nYTh+8V+6AlpydforaRwlCcXd0kl8Lme VhuRvc3Z3aPceAVEAx5upOKhGNCm2hoKittMQp3/DWQBaL12RBabG1PKWu2cFxLrCA/5 YFYH184DJlslHlayRGazheEXPozeJcEJY0z1vTaL/o7qB7oMT23KKrz6lf4ximMUDiIp BThI4Y12jmC1HpCbhbJ4ZJ8Q91LOkowDK2B8EeCLdB83g1EW6TBydmimhdoTIspSIbYj n9cw== X-Gm-Message-State: ACrzQf1u8wbejrfQyPQjFFjRTi42VcR3X6A0PtGdId7AnScSMrIXfTZe 8LDMPFCIQ8TxI8RvDI2sAhxChA== X-Google-Smtp-Source: AMsMyM48cCCOaGHpcUrqKPuvLPqi8N0s0YHUDIkD3gXkNLjihHit7dpsoFkfZbjAvACH4Z61kt9rCg== X-Received: by 2002:a65:44c1:0:b0:428:ab8f:62dd with SMTP id g1-20020a6544c1000000b00428ab8f62ddmr44319504pgs.211.1666912040505; Thu, 27 Oct 2022 16:07:20 -0700 (PDT) Received: from localhost ([50.221.140.188]) by smtp.gmail.com with ESMTPSA id bf4-20020a170902b90400b00186e8526790sm1675818plb.127.2022.10.27.16.07.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Oct 2022 16:07:18 -0700 (PDT) Date: Thu, 27 Oct 2022 16:07:18 -0700 (PDT) X-Google-Original-Date: Thu, 27 Oct 2022 15:22:27 PDT (-0700) Subject: Re: [PATCH v3 0/2] Fix /proc/cpuinfo cpumask warning In-Reply-To: <20221014155845.1986223-1-ajones@ventanamicro.com> From: Palmer Dabbelt To: ajones@ventanamicro.com Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jonas@southpole.se, linux-s390@vger.kernel.org, agordeev@linux.ibm.com, dave.hansen@linux.intel.com, gor@linux.ibm.com, yury.norov@gmail.com, hca@linux.ibm.com, x86@kernel.org, linux-kernel@vger.kernel.org, stefan.kristiansson@saunalahti.fi, openrisc@lists.librecores.org, mingo@redhat.com, bp@alien8.de, Paul Walmsley , shorne@gmail.com, linux-riscv@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, tglx@linutronix.de, aou@eecs.berkeley.edu Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Fri, 14 Oct 2022 08:58:43 PDT (-0700), ajones@ventanamicro.com wrote: > Commit 78e5a3399421 ("cpumask: fix checking valid cpu range") has > started issuing warnings[*] when cpu indices equal to nr_cpu_ids - 1 > are passed to cpumask_next* functions. seq_read_iter() and cpuinfo's > start and next seq operations implement a pattern like > > n = cpumask_next(n - 1, mask); > show(n); > while (1) { > ++n; > n = cpumask_next(n - 1, mask); > if (n >= nr_cpu_ids) > break; > show(n); > } > > which will issue the warning when reading /proc/cpuinfo. > > [*] Warnings will only appear with DEBUG_PER_CPU_MAPS enabled. > > This series address the issue for x86 and riscv, but from a quick > grep of cpuinfo seq operations, I think at least openrisc, powerpc, > and s390 also need an equivalent patch. While the test is simple (see > next paragraph) I'm not equipped to test on each architecture. > > To test, just build a kernel with DEBUG_PER_CPU_MAPS enabled, boot to > a shell, do 'cat /proc/cpuinfo', and look for a kernel warning. > > While the patches are being posted together in a series since they're > for two different architectures they don't necessarily need to go > through the same tree. > > v3: > - Change condition from >= to == in order to still get a warning > for > as that's unexpected. [Yury] > - Picked up tags on the riscv patch > > v2: > - Added all the information I should have in the first place > to the commit message [Boris] > - Changed style of fix [Boris] > > Andrew Jones (2): > RISC-V: Fix /proc/cpuinfo cpumask warning I just took the RISC-V fix, might be worth re-sending the x86 one alone as nobody's replied over there so it may be lost. Thanks! > x86: Fix /proc/cpuinfo cpumask warning > > arch/riscv/kernel/cpu.c | 3 +++ > arch/x86/kernel/cpu/proc.c | 3 +++ > 2 files changed, 6 insertions(+)