From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 221F93242D3 for ; Thu, 20 Nov 2025 18:29:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763663354; cv=none; b=gRS0CpUK8lqWa8f2jXosumbahCbAOjpoM0BbJV1MXnRVmJPGeH+l9DpOs2/ltD4eYMsAdv1cO+t2qF+oNO6sE1yRsZ8+rSD+ZSDeHDYyvHT7EUSOPUb9NVsfL0HJ145826WTT11hYErtl6jbFffxUFYujkco77zKKtzcPBLXxio= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763663354; c=relaxed/simple; bh=qybRM9ZWLPDhV9sq1pKmIDQ+XxpPXtc4IzzBxiGTXog=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=dLbK2QasyUpX+wyjnHTpPp17OM1JClyD0h5PNA+hi1jPBaeVjaDhJV7oDGsXPxUwdxGQf6yNGK44I9IJW8lcoQS6BBH1YB3AUaUr6YngCvhBQcudlxHeBPN7uS23aecuxH8fp3Kbxv+8NafFiHtc0RO6StGghOmNiphzy5V+yVQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=TfI5qG/G; arc=none smtp.client-ip=209.85.221.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TfI5qG/G" Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-42b38693c4dso627986f8f.3 for ; Thu, 20 Nov 2025 10:29:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1763663351; x=1764268151; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=1GzRj5JjCz14ivGlOvj5wY6q/BiR1p/ePsR3tt6kttk=; b=TfI5qG/GSAcza7PCzGlmq+GDwV4SRWIZNT7EwLUej9JyQIvhur7goR505MH/BhUT6X oo4w/DutAv/2+FGiVf/R32GvHW70bScq5DlI+9FNwH8LtWKO6SRCZBLXQ//o7heAqPLU PBdENWMxUhuqASkNtxCPH+NDmnPDcnVZW6HK097PVWljz1ajS9K6Jpstdjn1eHcplF5W PuHJkFFCQlMGCHbHi8wTc5anX8ZMC2BRprtyM255e/fLUGiPE4690jSreQgmQk76YD8O meQo8NjzGWS2OHvSwizJlj8ocsVbDUKrW0jAPaLViz6Je7XMWFTfRjQMhN69dGgJODcK pfjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763663351; x=1764268151; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=1GzRj5JjCz14ivGlOvj5wY6q/BiR1p/ePsR3tt6kttk=; b=eibC6Y1i21kniCM2BPaCnflCBeN/LJFcM5BGHWVn74ZYgEkNGJz87FoVdM1PZO1COv B2N2AeRyz5oaljDNkYzwj5bS0tq9MvAL/AHAaebOVD34y05YyxEZz0BmXvpuHnue3BdW YJzcvEAR3ShKTIvmOc5aSBNJVCc8AwSGavzNJTlzBIfHiXJ7aYShFZuBTmXemRZWdSrX 1aQJgvOrVrFVz4h9PhPXgTst5wFETF4nIc/uGu2LTDy+YdpSxN1Z72yipZZvIM36dzrX uf2gwWL6Q/agqPO1Lhyw1syO7ki9nug/qAS+E3n1ibGmX3MzlcMK+WCU/kZjgZ0vm39Z ev8g== X-Gm-Message-State: AOJu0Yxt6K54Fgvvfwn2QH82y8gs9SdLjJKvE0pyHaO6fx53LIe3JfPF PzEGd/xaOZXijp+F/mkzKcd7W25k+DkFnzM6NJPA3ffZtLCIa5ApByHG X-Gm-Gg: ASbGncu4M5UNY69ciKcdzI3sfJSQ20QxCF5Yu56HxZNwSTLsswDz+CbFnk4vohSbgRg kDnqUGvSCx3+ggqt/u/4UQ6RuGPmS+KbtSRfI+fNiJtWI0Ga85agTKoJwT2bI+x04MDQY4Itc3T 6CKuU4MbjUXSxaOP/JTaxlP/filGg+4nRdnJ1BIivN18ZTirKbSJ3bHDc1mLS9vdRE8JskUqf76 xks3u3HyZqY5XOLdsSsg9iYaMHe7n8bhwcM29VyLCjumrAK4AAe2KORfvYD8r8xtUwf1+B2fmcK tnEdPT1VWAGymhKskS8m7cWX0r12hey9a2Tk9ag2GuTHfiIlbNp1UrAzx1lFF1txBzlfy8X72TV a4eEmbiWZETjqP90+OKEylpPgYbjMA59uh5U1nJVxKwF4eW0Xy+ra1C1kMl58aFynLvmsiqN2m1 Mg45gjJ7n+G5s7MyOhkk3ofMnS3n7xpjzGCakAOk4OZfqSkeVj98ey X-Google-Smtp-Source: AGHT+IHjJg825VoVZTkOkWI5/COFSXIoahlrKGeHE+jX1cjfjiBIClItwdUIKNf9aJtm65rsqajoZw== X-Received: by 2002:a05:6000:1ace:b0:42b:2e65:655e with SMTP id ffacd0b85a97d-42cb9a6069cmr4322355f8f.27.1763663351303; Thu, 20 Nov 2025 10:29:11 -0800 (PST) Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42cb7fb8ff3sm7252124f8f.29.2025.11.20.10.29.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Nov 2025 10:29:10 -0800 (PST) Date: Thu, 20 Nov 2025 18:29:09 +0000 From: David Laight To: Yury Norov Cc: linux-kernel@vger.kernel.org, Borislav Petkov , Dave Hansen , Ingo Molnar , Thomas Gleixner , x86@kernel.org Subject: Re: [PATCH 01/44] x86/asm/bitops: Change the return type of variable__ffs() to unsigned int Message-ID: <20251120182909.522d58cc@pumpkin> In-Reply-To: References: <20251119224140.8616-1-david.laight.linux@gmail.com> <20251119224140.8616-2-david.laight.linux@gmail.com> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Thu, 20 Nov 2025 10:54:01 -0500 Yury Norov wrote: > On Wed, Nov 19, 2025 at 10:40:57PM +0000, david.laight.linux@gmail.com wrote: > > From: David Laight > > > > The return type of variable__ffs() is currently 'unsigned long'. > > This makes the x86 __ffs() be 'unsigned long' whereas the generic > > version is 'unsigned int'. > > > > Similarly change variable_ffz() and ffz(). > > > > This may save some REX prefix on 64bit. > > > > Detected by some extra checks added to min_t() to detect possible > > truncation of large values. > > > > Signed-off-by: David Laight > > --- > > arch/x86/include/asm/bitops.h | 18 +++++++----------- > > 1 file changed, 7 insertions(+), 11 deletions(-) > > > > diff --git a/arch/x86/include/asm/bitops.h b/arch/x86/include/asm/bitops.h > > index c2ce213f2b9b..2e8a954d2e2d 100644 > > --- a/arch/x86/include/asm/bitops.h > > +++ b/arch/x86/include/asm/bitops.h > > @@ -240,7 +240,7 @@ arch_test_bit_acquire(unsigned long nr, const volatile unsigned long *addr) > > variable_test_bit(nr, addr); > > } > > > > -static __always_inline __attribute_const__ unsigned long variable__ffs(unsigned long word) > > +static __always_inline __attribute_const__ unsigned int variable__ffs(unsigned long word) > > There's a mismatch with the generic ffs() in asm-generic/bitops/ffs.h. > > The generic_ffs() returns int. There is another variable__ffs() defined > in arch/risk, also returning int. > > So I believe, the correct fix would be to switch x86 to int as well. > And anyways, I believe this deserves a separate series. It is a single patch, do you want me to resend the patch on its own? (With a different commit message) David > > Thanks, > Yury >