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 DE23AC433FE for ; Thu, 3 Nov 2022 14:27:01 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4N35g818Npz3cMw for ; Fri, 4 Nov 2022 01:27:00 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ventanamicro.com header.i=@ventanamicro.com header.a=rsa-sha256 header.s=google header.b=WTZ/fhxM; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ventanamicro.com (client-ip=2a00:1450:4864:20::433; helo=mail-wr1-x433.google.com; envelope-from=ajones@ventanamicro.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ventanamicro.com header.i=@ventanamicro.com header.a=rsa-sha256 header.s=google header.b=WTZ/fhxM; dkim-atps=neutral Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) (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 4N35d43nj3z3cBP for ; Fri, 4 Nov 2022 01:25:09 +1100 (AEDT) Received: by mail-wr1-x433.google.com with SMTP id a14so3031649wru.5 for ; Thu, 03 Nov 2022 07:25:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=yyXCEm+SN4JTuAX2T0R90Ie6jT6YR0PIuexybyKvkXE=; b=WTZ/fhxMJ71jLlitDHXKYaXGnn95ODQizEyx4pjZLu/FU2YdbKeNAo0B/NktNH9Hif 0ihHLDxTp8U29NT+XMIjwbpXih+rDpGbzPso+IRrM4OQEis6MRNHdhg2+L+2iQ5ZiErf H2C2UNKqEdpYeg1ou6yBgu5uGp5t6In0MkSQENq2IWAYTPdvvddzhf9M2SUHCjdkNqlP pTfB+d1W2bpoY+NqsMD0CmY3+w2XyTZf6ZrvG8psupb3sY6BjQWTaeaT9RFdOarIdWjn Jj663Dqz2gYFZNCYKSrBaU2MDDJrY91RmxP0f4HXzCqrYeVlqsItUMv2dSlq4XkDrWmi x2Hw== 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:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=yyXCEm+SN4JTuAX2T0R90Ie6jT6YR0PIuexybyKvkXE=; b=ftf5xwjzQd+USbAidhwhU70h+/VD+Q2EGddZstSWGANJcDvLDqnAwer1QWjt1LJVdm rxxcUU3gdlrwjQGCXxrF9qjlUlmj+isxeioXilmjbv3ZGeFgGo0pjpBnj7FwPIS/SILy tL6OJZaaL8B36Qh4RQOfG70z1wgZsxwSgXaQce51uA90VRqB9gcPBJMWlhw9q41vY5Cn QeDadryMUP/r6SwEqf1EfbtK5iTqYcNnS99P22L2RCVsy6oNxaQHa8vJA1xGblOBBopF ktUf3eemCh5UsZB5X3X4PZnFTQyroc0EAT28v/q4OJqYKSbRLb1asTbkKmjG2+5jBU9L YhdQ== X-Gm-Message-State: ACrzQf3W2lD/l3GQd6R72VcuUoOIV/n+BqX6sO55i8Cnm4LL9zdjhlC+ 2inl45uOEpThHUdHYCZVZ+KHIg== X-Google-Smtp-Source: AMsMyM5hdXBUu8yo8VO7zyELnZCeDW54TPy5bvl1rmzeZB7u0GPP01rGpP4zIsPcikd5aOtl3C5pdw== X-Received: by 2002:a5d:654d:0:b0:235:197d:72d1 with SMTP id z13-20020a5d654d000000b00235197d72d1mr18800468wrv.680.1667485505908; Thu, 03 Nov 2022 07:25:05 -0700 (PDT) Received: from localhost (2001-1ae9-1c2-4c00-748-2a9a-a2a6-1362.ip6.tmcz.cz. [2001:1ae9:1c2:4c00:748:2a9a:a2a6:1362]) by smtp.gmail.com with ESMTPSA id z7-20020a5d6547000000b0023662245d3csm992994wrv.95.2022.11.03.07.25.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Nov 2022 07:25:05 -0700 (PDT) From: Andrew Jones To: x86@kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 0/1] Fix /proc/cpuinfo cpumask warning Date: Thu, 3 Nov 2022 15:25:03 +0100 Message-Id: <20221103142504.278543-1-ajones@ventanamicro.com> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 Content-type: text/plain 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 Bonn , linux-s390@vger.kernel.org, Alexander Gordeev , Albert Ou , Vasily Gorbik , Yury Norov , Heiko Carstens , Dave Hansen , Stefan Kristiansson , Ingo Molnar , Borislav Petkov , Paul Walmsley , Palmer Dabbelt , Thomas Gleixner , linuxppc-dev@lists.ozlabs.org, Stafford Horne , openrisc@lists.librecores.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" Commit 78e5a3399421 ("cpumask: fix checking valid cpu range") started issuing warnings[1] when cpu indices equal to nr_cpu_ids - 1 were passed to cpumask_next* functions. The commit has since been reverted with commit 80493877d7d0 ("Revert "cpumask: fix checking valid cpu range"."), which raises the question as to how much this proposed patch is needed. Additionally, there's some discussion as to whether or not cpumask_next() should even be validating its inputs[2]. So, with that in mind, I'm fine with the patch being dropped. However, it may still be reasonable to add the checking to /proc/cpuinfo until cpumask_next has made changes and better documented its API. [1] Warnings will only appear with DEBUG_PER_CPU_MAPS enabled. [2] https://lore.kernel.org/all/CAHk-=wihz-GXx66MmEyaADgS1fQE_LDcB9wrHAmkvXkd8nx9tA@mail.gmail.com/ This series addresses the issue for x86. riscv has already merged an equivalent patch (v3 of this series). Also, from a quick grep of cpuinfo seq operations, I think at least openrisc, powerpc, and s390 could get 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. v4: - The riscv patch has already been merged. - Mostly rewrote the cover letter as the situation has changed since 78e5a3399421 was reverted. - Rewrote the commit message in order to try an better clarify things and also to add the reference to the revert commit, which results in the commit no longer claiming its a 'fix' in its summary. [Boris] 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 (1): x86: cpuinfo: Ensure inputs to cpumask_next are valid arch/x86/kernel/cpu/proc.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.37.3