From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f172.google.com (mail-qk1-f172.google.com [209.85.222.172]) (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 DEFA919CCFD for ; Thu, 20 Nov 2025 18:33:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763663597; cv=none; b=dGh3NwHQF1H4QpPBZxXxp/qzWRV0E7o9cYMwVW2No4oMTBKzRu+16DqD1quixWRhDYZNQnQHqRATlFgJdw86VFvkLmhhilPIQA+qVU2RcBfSnqCxxN8tUbSfbqUNp7YcBqQDwp4UVKj8uN4v07oHIdTXXI5iTgmMRddDl8MHkV8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763663597; c=relaxed/simple; bh=YRm07m4vw6wFQ/YToJ+drdMt5jRX/3NnVCz7qs5s3hA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=M3ELQFu1cjCcKRe0rmD+6otS61Ajx3S+BKUyHfE2PHwP0SzzlJYSTRVJTbXXvSnS+SzDZ7FZcf3THzY80pQKl14XfbApWXWmWkFnBCfGuVbbI6RDhzR84kvitTZeExEfB+G+QXbAoEO343nO++gw2azGMkyaQjGfXJsXWosiVAI= 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=WDA2KQor; arc=none smtp.client-ip=209.85.222.172 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="WDA2KQor" Received: by mail-qk1-f172.google.com with SMTP id af79cd13be357-8b1b8264c86so112226885a.1 for ; Thu, 20 Nov 2025 10:33:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1763663593; x=1764268393; 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=3uhmRqCvaFWoBnqOkf82Yli1Tjau7udI4grsQo5j6WY=; b=WDA2KQorzKNAqOM77o2QHdYmUkM/+rf7nWhYAp3+UPvaudMt3Bwb8Ncs6KUywPQCXQ R+AAQgECdEKH4PpFh0JKdBGq+MDtooGyQxTMhhXU+k+JNViMBtv9zlVr4MTcssmIA9zw 3Btp/8+o2tZ4Bc2W3vrG+MYiUs2XY1S7+gPMyshYhEie/+MMQHPKy/OqscbmpUZWPw/7 SbAjFU4qu1eBCWyr58iv7T1Zj8RSJpF4af9RZBOy1Y+OHIGmoabJJOELIDX3JmZohAma IUKqlt6VBHMMUNvj204akO6bMTPjgbwnnRzy3oAej2+pQlUTN4uxaqfXJeyHvSzTUTrK /ifg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763663593; x=1764268393; 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=3uhmRqCvaFWoBnqOkf82Yli1Tjau7udI4grsQo5j6WY=; b=H/mc6RRDDyP72A+rNPyt1hl98Ts+8wKxKyQpj8/rLVKjWiApwtEeKwi4LH/QJCclRJ qZVnvJvO53Yyc3t9hCY3/639VXjYS/5tUtDW3IFzTg5mgXnBV616U5lPkdNuthbznrgo B8P6DUNa3gzD6ufxQQmln4fuUyhcAGrRHmMR89TV/RUaaIIkMg1DUiB5O/YtUgomy5ky nXFGBSKUkkVzkquTej/lDrE8Z5iHz2sryMn1Hs3CWGPqL+H3sQZgjsCq7w84UpaCxrdy 86uK+G2Ly1pWbcumP4APoY1fz9UuqHvdDj46HJFVf4nJFTsYIDIxqbj3tZdCy/pWZty3 /4Vg== X-Gm-Message-State: AOJu0Yxu+k6cyoWhQWa8qgTHYL4+bgYKdQq48fuGfTG/1Fj3PqKARQlO /s6EWKn290aQxCd0aJFh7QNAA0g6dnOeqBRJFZTmCUJXsLGGDunVXKEv X-Gm-Gg: ASbGnctha+CEfznHQlUtvrbdObrssf9pfI9kccQzYY6zZXU2DMzAw2/yPN2qjxP4lQf D8l1qh48DUKdWP+H9nGA7njggLRN34tdaoNc+zuPUWHDdWwbwe2yVcQQPC4YLeqaSNgbLxftSlO vkr2g3oeNJBgExF8+5cGSCdpjcgDGqrHIQXobFnstOArDz0t4Rr2nUFJS9TEx2Na3/I7sHkXfgD RezqcAn7kWQ41JiDsN6SE0j+A1g2wyGEvodu2NGfm6nuDhLEhoEH5AV7LC4jCT8KaGtt6U0nFEB KGWZcX/Y+Q8OwKciDepJfoOiS048Cj6M6OM57egOWnm+sm5gvwpFR91lYIdis1rCQKWIi+mGKq1 fiCK0V04FUPDR6t/C7zARdvhFdyvqO1sWUpwcfcRE2TRqKh/lv76kIx0sbsBIOdS/VvgtxnHWe4 8A0yF9u2vG6K4LUBRmnQ== X-Google-Smtp-Source: AGHT+IE6uxnLtuBgj7VOlLKTLC4SGHImZALMo/uFS4/mD+frZl9CHUOFs+HcyyLxK+Ft1M4NigQpwQ== X-Received: by 2002:a05:620a:700a:b0:8b2:e922:528a with SMTP id af79cd13be357-8b3386006b5mr94141185a.19.1763663592910; Thu, 20 Nov 2025 10:33:12 -0800 (PST) Received: from localhost ([12.22.141.131]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8b329431429sm202328385a.14.2025.11.20.10.33.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Nov 2025 10:33:12 -0800 (PST) Date: Thu, 20 Nov 2025 13:33:11 -0500 From: Yury Norov To: David Laight 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> <20251120182909.522d58cc@pumpkin> 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: <20251120182909.522d58cc@pumpkin> On Thu, Nov 20, 2025 at 06:29:09PM +0000, David Laight wrote: > 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) The patch looks wrong to me. All the flavors of ffs(), ffz() and others should have the same signature.