Received: by 2002:ac0:de83:0:0:0:0:0 with SMTP id b3csp480934imk; Sun, 3 Jul 2022 01:15:48 -0700 (PDT) X-Google-Smtp-Source: AGRyM1udZxp++sCmAyfrMG3eLvmdoQAeVEu2cSHk0PXcHMmssRmhmxpZHH66W4pnX7p/11hOxERT X-Received: by 2002:a05:6402:2933:b0:435:80dd:f75c with SMTP id ee51-20020a056402293300b0043580ddf75cmr30262913edb.302.1656836148519; Sun, 03 Jul 2022 01:15:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656836148; cv=none; d=google.com; s=arc-20160816; b=CZuDAUXPpbRNSYu9+Hv/sowLvLrOFgjEU4IrmbzEcvd1QysMh2vZO3d2CMpAYnryqb PM12wYjPVtPw+f76pv9basKNZfGfwh7WoUzZSEUuL4UXNxGY0trFces72lde6PDr8ix5 WdElk0kjxSH33jNnXWkZ+9DRTtevOFYAUcFRQthKLhrm3qPaf1a7hmSKHGO8jf6OGvQu qolkfN7SN8Juj/iKkkDVAe/J21XaCVgTPnu1kC+nzFgvdkW+b+iEtTEUgYrLEYkAh4wJ C2MypNLy4sJUYn2MVhFhwDpXID5Kqw0Dc1crBQWG+nQWl1cEwEvauVSjv/bFa0Pgbe2b /GOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=S8YcGqEHjJHk34HSjQbYqB2GjJJsnBUKB4IdSCKHySo=; b=Nz12rKNxYGcJy9ivoosN0aVooCGGwlY15ULp6a9R3yteRuVH6Aof18izMb8OFHhXuH uqOlgd+/ENkhhwyCU0LM+XeasGDG/EmO4WkrNnLfWBtHmS8oIcHrAp3gr3vMe35Kr54I jUS5zTqKUOxf4ABaCRRK7WdqqU7NQczISmyPNZKKoXrv5ZmwO5eK64soLPVD6nw9r1xV Tky9Gk9wrJ1Y/TL1JiMy11xNhlEhxhHSfJVX4RXiePv1oChQtNiDjRE1GQ3Ff+qSezDE Pg2rnMb8/h5SpO8Nbz+LrTfUg1sXj8q5Ccn+JrPbE+D7q5GnGbjRKKUhByYAFJn83yzV vdOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@svanheule.net header.s=mail1707 header.b=434PAj6h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=svanheule.net Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w24-20020a50fa98000000b0042afe8df656si7688781edr.248.2022.07.03.01.15.18; Sun, 03 Jul 2022 01:15:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@svanheule.net header.s=mail1707 header.b=434PAj6h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=svanheule.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231874AbiGCHu4 (ORCPT + 99 others); Sun, 3 Jul 2022 03:50:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230468AbiGCHuz (ORCPT ); Sun, 3 Jul 2022 03:50:55 -0400 Received: from polaris.svanheule.net (polaris.svanheule.net [84.16.241.116]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F6A164CD for ; Sun, 3 Jul 2022 00:50:54 -0700 (PDT) Received: from [IPv6:2a02:a03f:eaf9:8401:aa9f:5d01:1b2a:e3cd] (unknown [IPv6:2a02:a03f:eaf9:8401:aa9f:5d01:1b2a:e3cd]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) (Authenticated sender: sander@svanheule.net) by polaris.svanheule.net (Postfix) with ESMTPSA id 5DD052F2F8B; Sun, 3 Jul 2022 09:50:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=svanheule.net; s=mail1707; t=1656834652; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=S8YcGqEHjJHk34HSjQbYqB2GjJJsnBUKB4IdSCKHySo=; b=434PAj6heVFX7rIt/CJoYwBbrDHYgDJZRnQHeFtCZzKQ5n/rTxPqz2osuLW6Fap8wakYmU Mr4VbzkDpVtXyf/MSdgiuByqwsDUXTKAS/KoFMr5pvtsRHQpx395Zx6InmNks9a8K5Jb5/ 4j2nTU1aT4PPJarPNBQavrmefWgIYpbCLuyEiaSsd+K+mbk+zzx5aloUxmGuLlPUbaVCrF r/O/lLtpFxRua4dF2W9nkMUDe6P/vzth3722EBkKW3EYKsMhBumPvracLuWdNvEm9BvmU9 2Z6TUshMpxv+ph6RXNFCdBpsr2G45/eoH/gi8H2fdl9ne/NREV8mPlQm66B/mw== Message-ID: <6a4ea3d21bfb4c692d257d3f38ba28c83f242dfc.camel@svanheule.net> Subject: Re: [PATCH v4 0/5] cpumask: Fix invalid uniprocessor assumptions From: Sander Vanheule To: Andrew Morton Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Andy Shevchenko , elver@google.com, gregkh@linuxfoundation.org, Peter Zijlstra , Thomas Gleixner , vschneid@redhat.com, Yury Norov , Ingo Molnar , Borislav Petkov , Dave Hansen , "H . Peter Anvin" Date: Sun, 03 Jul 2022 09:50:51 +0200 In-Reply-To: <20220702133840.943817a7694406a135bb48a9@linux-foundation.org> References: <20220702133840.943817a7694406a135bb48a9@linux-foundation.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.2 (3.44.2-1.fc36) MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 2022-07-02 at 13:38 -0700, Andrew Morton wrote: > On Sat,=C2=A0 2 Jul 2022 18:08:23 +0200 Sander Vanheule wrote: >=20 > > On uniprocessor builds, it is currently assumed that any cpumask will > > contain the single CPU: cpu0. This assumption is used to provide > > optimised implementations. > >=20 > > The current assumption also appears to be wrong, by ignoring the fact > > that users can provide empty cpumask-s. This can result in bugs as > > explained in [1]. >=20 > It's a little unkind to send people off to some link to explain the > very core issue which this patchset addresses!=C2=A0 So I enhanced this > paragraph: >=20 > : The current assumption also appears to be wrong, by ignoring the fact t= hat > : users can provide empty cpumasks.=C2=A0 This can result in bugs as expl= ained in > : [1] - for_each_cpu() will run one iteration of the loop even when passe= d > : an empty cpumask. Makes sense to add this, sorry for the inconvenience. Just to make sure, since I'm not familiar with the process for patches goin= g through the mm tree, can I still send a v5 to move the last patch forward in the series, and to = include Yury's tags? Best, Sander > > This series introduces some basic tests, and updates the optimisations > > for uniprocessor builds. > >=20 > > The x86 patch was written after the kernel test robot [2] ran into a > > failed build. I have tried to list the files potentially affected by th= e > > changes to cpumask.h, in an attempt to find any other cases that fail o= n > > !SMP. I've gone through some of the files manually, and ran a few cross > > builds, but nothing else popped up. I (build) checked about half of the > > potientally affected files, but I do not have the resources to do them > > all. I hope we can fix other issues if/when they pop up later. > >=20 > > [1] https://lore.kernel.org/all/20220530082552.46113-1-sander@svanheule= .net/ > > [2] https://lore.kernel.org/all/202206060858.wA0FOzRy-lkp@intel.com/ >=20