From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f181.google.com (mail-qk1-f181.google.com [209.85.222.181]) (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 D633A231830 for ; Thu, 20 Nov 2025 15:54:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763654047; cv=none; b=FSHmX987occuo/fkHXPp5MFqCwMEa+Pu1jhw3pRhMF2h0O6o+YCZTrlZgdK/ESxKPeJWSA13zt4zWKB11n/liuP0seqiDkzpCj43VmRLY0vF39lJ3rtyZL/rZ85u2e/JUcdPI0QHVDOnSc1ucJeT6OXVCo5qz4Ic+/l2pxjdsjk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763654047; c=relaxed/simple; bh=VexXL8hEXx2A7PJ60gNjPSKJV/ncNunLHRJaJ0s6Bpw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=AuJJbpvCdHj9MjXRgrcz7gBH1sQfU6RayoEHoJYtuHoMh5Xe9gRpF+HMILK8I305T0u09o9+Dvt3Nb8uh7ahIDfzlwn7QsK+8f+7GQw6X/Dkd2HOkSouJy+oWqoUapVRSbKFj5XLHOxUj1dBF13HQfzxVT4AmuUNfmfRiMjnxHI= 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=J1348zJv; arc=none smtp.client-ip=209.85.222.181 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="J1348zJv" Received: by mail-qk1-f181.google.com with SMTP id af79cd13be357-8b28f983333so93958785a.3 for ; Thu, 20 Nov 2025 07:54:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1763654043; x=1764258843; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=aBtVyp/6KYGpPb5FWiDVLI3XwQC6y8USv2cshu8mB1A=; b=J1348zJvFmfa29v+FgiMmDWg3fUsO4BGZ3Ln0TgkeBXLvjoaXT6BlFkOVOkt2g7IM1 Uo4RJgmb34cBqY5T7mKW4rkAzScszL6S0A2OPNj3utC1R9QUDk7uskT9ydnu50gVO+7T vSZsfmzZ05mF757349l1eT0+8LVD5+gw4eYUi2odKrFJntBzP6GyLQI4YzlWUScCzwCD OJ5HXb4AV9oHb1KF5CBTR0+OrRrk19U/r3xqTwv57UKXWUZFEGIS1n1btCH3jjKGsDt/ rxAwLjM4mgADxmiOwvVX0dCI4TioLyHa3gkGO1N9JCrx7GDOCYyDFd7rEXykbITjbwxd nBzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763654043; x=1764258843; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aBtVyp/6KYGpPb5FWiDVLI3XwQC6y8USv2cshu8mB1A=; b=JQHwuqD2hU+6f8b2Jz8c1MK/FmPK4iN34dREIVc/uVzA0tp2CFR0f60uu1JY5/7yDa gbFHMf8Ucpw8EWifIc2AKiiY6bc510YejC8jL/bYDeTgeGFhfs64QzVnIfAxdZ7wUcxi DIulI3KisCwFxoFKL8BSWI4iKhFcBP1342e5aKNl75XdY10KQAHAH/2s/Jvi1wnQKOl8 T6zDOlrFXgqYnvI27vkj01i4gqgia6M57uFORWyk18c5egFfwr3kb7VS4dnldSfsXLQl MNvPYxHe1M+E4YUWCwt9YWo+3nDeWbte82yVD41LS4YpijGPiLftI/XCouQcMb1Rh+lz dfrQ== X-Gm-Message-State: AOJu0YyVfY+bhNWeNqWEDgzB2q884maThBI49kbgiub7JEMwYVglv85M KHsb0Xhws6EGpmkz/4DkPX9Xp3kh2GdwBkiphg4TVmg4X5xPGedZR1ue X-Gm-Gg: ASbGnctWbHR1D0q7qoRDo0ZlydGac2mnMr9R1Za3jO/rR+lhubrVR0rH4nU5TXtUVVp mSUOI47iBXdFYsGWqP/ZsmC4jM1DTl5BUn6RwSH4uwHdW4344/zhqmhmMLfOe2sHN6vEz67V/oi cHKBA6Sb1jIGanXkYtl7JzcnJgL52VvyHHqpp8mk2upHwHn4vc9vpkauWvPUQwBQy7gsvFz9IyE gMKy6L3+1aX/U/3PTnkZXntHrrxV2A/uhGI3sU+3Lu+SUpVigzsKza0eCgHnCgL/3RLIXqptv4p PL9JDCF2Tutm8z3psxbE7rLwrKRTgrNkt77JPUbzoMoWptPi/t8C1pUpeQVsJXxAR616Wn2xp1N p0r9ZHtGDXQ9d8kJODYOv6ohz694/aWFDCiK/nJObIsfFcyN+rxuyzSiMw506FFQMdxBabsaZNN sRwb4xBlW/Uj/buEP69Q== X-Google-Smtp-Source: AGHT+IFwll8Tk0o6MvcFIU94PdrpEq2/tZg7smn3k1QNqcoA8XJPOLnC0TSegX2DYJyWcDSaLiiaeA== X-Received: by 2002:a05:620a:3184:b0:890:2e24:a543 with SMTP id af79cd13be357-8b327313ab4mr531972085a.34.1763654043456; Thu, 20 Nov 2025 07:54:03 -0800 (PST) Received: from localhost ([12.22.141.131]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8b32932ba76sm179413785a.4.2025.11.20.07.54.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Nov 2025 07:54:03 -0800 (PST) Date: Thu, 20 Nov 2025 10:54:01 -0500 From: Yury Norov To: david.laight.linux@gmail.com 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: References: <20251119224140.8616-1-david.laight.linux@gmail.com> <20251119224140.8616-2-david.laight.linux@gmail.com> 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-Disposition: inline In-Reply-To: <20251119224140.8616-2-david.laight.linux@gmail.com> 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. Thanks, Yury