From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (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 31F2C1624C5 for ; Thu, 20 Nov 2025 21:18:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763673495; cv=none; b=PU5X/Qs7byKGEB5olQIafPCjAKJckblUeLE+3ft1R8Z9RYe/Kw0B7fFJtHEu/t0bZaIyS6fx0jMj+Ca/QaCLADshOJFbe7RPK5rLFMo+WsoH2NaXal0n5dLy8vDO0iaxJ54b1nih80ahftr811DMSjWZVKPLBpyrt8XtTZw15Vw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763673495; c=relaxed/simple; bh=zMXmMoSWB/LrRAm5I83lhSou5mrKBICk0b96xCNyXGg=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=GEjBrD/MGhU7NBDcgafSoBBZ6YsmZZeEe3PS8KSLKe+XoEtrQOWi9I6zUtj7l8SCvu86U57KITHIL6LCKrALWeG4D9Wi9BfCNoViF4WlBxIydrClQ1ZRDX2hnRhHV+NdR+Zv9AQId5IJLz+evLe4tab2fdRrbSnYgzGj29f4mec= 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=GvJIMa6l; arc=none smtp.client-ip=209.85.128.49 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="GvJIMa6l" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-4775ae5684fso6425705e9.1 for ; Thu, 20 Nov 2025 13:18:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1763673492; x=1764278292; 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=z372DWb47EeB2LowQMB5T+JH2Q9e2JqbRjpHT3H9n8o=; b=GvJIMa6lD4HcVvHIft3bgHhMubFt1nbN9uqf+WOHUcj0M4KsqhOn4T6zjD6kQc1ItL VYSRLr2jy4FJVutBujIKSccEL+aRKW8GuZl0u7F7tT7sjyjg79gECFPQC05fKcN6VJC/ QB3amy6N/QRPb6ZYT5xSWOJ1E5IycRJWricWjsjrzC1o2Kzv4kVx4qS1lIVtTaMtVRVs WMKNtWnPvD4QZ1hi1gW9k96gBgCnjCgSqGKe3ajq81lQKa3Akr72/FrYUcv0J5RkYct+ XobkP8GWnYE55sJvI/hUYgJPqSC8do7lFzo1XVDVFpiaQ4xVpyZALOyG9La/LvEiHXdd Qn8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763673492; x=1764278292; 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=z372DWb47EeB2LowQMB5T+JH2Q9e2JqbRjpHT3H9n8o=; b=uYITnRl6C+YPQQHUR84neTPzoVltrZeDJJdMgmVhSilrr6mYdZIZns3P7LkcPFNESE p5aaeUwUxV8jDtT/Yx0Rm8/CYhZSlrdYmN9nhhcEcaDR4XYciZMm0RUmd2tuEYp5qxWd ZVPcQzjAMTizdY3M//OG3nu92TPHzbZTd3vSyhUT/Jmk8k6SSM3pydfp9xTXmfUBIP37 4ceja731Sq3u69/8105iVeszKGxXRWitchzlk6fkpkGYDi+f3K7U7PCFt2qzMe7cY5xq MAAH6dkNe7f8rohrV74IwScMvC2hR2w5TysqjiTbMyYrPw1y4I5JEizC2yBwXgiQmcUc R2gQ== X-Gm-Message-State: AOJu0Yz/orpbGUZxg1ECb9VRrtvZ3X+l8A+Aq7/MY+jzrDMLQxV+3VfI Su/WudAAPI6J9NoyiQ+kHVGKdXoc6VOyfdd9+QyltsKDeFiMUJH0wfrY X-Gm-Gg: ASbGnctCC3aPV3IsoZBuQhSX1eHHivNaCBWN585cwaVXJBj3L3OmUZCnGMKXp383cq2 gtDRuyp3pkuP0x0RedTX+G0f8pTYZ73Z1jmnahcrEklfwNxrcxaOx/AmZ4xIpmPQNwyDtDSqnmU U/DArva2l6uPYgRzeMlxuiUGbD7zdwscbKHRmJBM/7Ox5uOXAe0zU81keVFxd/L/V+xA1CPKoVk RWiv5f8PKlDvxArTqqjyr2ukcdn8McpWHDZ+W5VztWXyML00JqXQzpoffxG8xmJxO1ZbdKvrZ0P bOFkHQqQoHfXUBX8iX/VNabuaN0HwETF+JdGmL4ba9IupaWT7sf01Q73MDYVZbhDwzFg61VOV7l 2SypyJ9WtmpxJt55c845goXkoess3D+3zXEaR9F++RYQZaeIuFw+QzqiLBtRWF8mkC6llaCne3y o4kWoh+GDBX8gtydDAr/oSqGChA76uK2Y6vm7VyBcKbIKpXvR4wOX1 X-Google-Smtp-Source: AGHT+IF+x+Cx36Zwvu4kkwD5HkUC4JVI/SyEr2XswRz2FFER3MjUj3an3B94l/5BPw6M3P7CmUjEZw== X-Received: by 2002:a05:600c:46c3:b0:477:54cd:200a with SMTP id 5b1f17b1804b1-477c016e798mr1108665e9.6.1763673492213; Thu, 20 Nov 2025 13:18:12 -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 5b1f17b1804b1-477a9e0c802sm69217395e9.15.2025.11.20.13.18.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Nov 2025 13:18:11 -0800 (PST) Date: Thu, 20 Nov 2025 21:18:10 +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: <20251120211810.60f53cb7@pumpkin> In-Reply-To: References: <20251119224140.8616-1-david.laight.linux@gmail.com> <20251119224140.8616-2-david.laight.linux@gmail.com> <20251120182909.522d58cc@pumpkin> 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 13:33:11 -0500 Yury Norov wrote: > 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. I only changed 'long' to 'int', all the generic (and builtin) ones are 'int'. So I'm not sure which difference you are talking about. IIRC the __attribute_const__ just lets the compiler do CSE. David