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 84EE3C43334 for ; Sat, 2 Jul 2022 20:38:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229994AbiGBUip (ORCPT ); Sat, 2 Jul 2022 16:38:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229436AbiGBUin (ORCPT ); Sat, 2 Jul 2022 16:38:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B531B6567 for ; Sat, 2 Jul 2022 13:38:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5696361046 for ; Sat, 2 Jul 2022 20:38:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C131C34114; Sat, 2 Jul 2022 20:38:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1656794321; bh=pAkGP5Cg5E1df2IcZoJVD9X7N2JCAGNkvied0qjBj+4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=m/RTjuQsBPJUmVuA0HXs7hT49OWs7nIYkxguZXH3UyeU35kXpDaqYF58yYmXk7AaL mqFcvlkBQfjlzYCbDlhDuP2mCbBC4ens4KAbG5SCHmofP0kW0dM8AW2Q5Dr4oZpXXZ BZ5EA6H8rks5T/sNBPeqssEuEf4Tq2b6oTNf4FI8= Date: Sat, 2 Jul 2022 13:38:40 -0700 From: Andrew Morton To: Sander Vanheule 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" Subject: Re: [PATCH v4 0/5] cpumask: Fix invalid uniprocessor assumptions Message-Id: <20220702133840.943817a7694406a135bb48a9@linux-foundation.org> In-Reply-To: References: X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 2 Jul 2022 18:08:23 +0200 Sander Vanheule wrote: > On uniprocessor builds, it is currently assumed that any cpumask will > contain the single CPU: cpu0. This assumption is used to provide > optimised implementations. > > 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]. It's a little unkind to send people off to some link to explain the very core issue which this patchset addresses! So I enhanced this paragraph: : The current assumption also appears to be wrong, by ignoring the fact that : users can provide empty cpumasks. This can result in bugs as explained in : [1] - for_each_cpu() will run one iteration of the loop even when passed : an empty cpumask. > This series introduces some basic tests, and updates the optimisations > for uniprocessor builds. > > 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 the > changes to cpumask.h, in an attempt to find any other cases that fail on > !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. > > [1] https://lore.kernel.org/all/20220530082552.46113-1-sander@svanheule.net/ > [2] https://lore.kernel.org/all/202206060858.wA0FOzRy-lkp@intel.com/