[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/2] xen: Change parameter of generic_fls() to unsigned int


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Michal Orzel <michal.orzel@xxxxxxx>
  • Date: Mon, 4 Sep 2023 16:03:53 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=suse.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=WP8xNuXL0PAriXUf5AHCn8c4rfj0NpsovbDCdgUptzM=; b=bxwyE6sTQtLxEwl9hPJBCiYKv8Xh3xIWFnBRPdo4mEtl4wZ7Rvq3hcwSpnPQB784gfNDJZ4Mx98JxKqD57+167SUvT1cUYWl/1W2VY7FJq9P4TS96uXEk0Sqw/QcQh/YC0cthNq0IwL0QXfXWFUYYp7fLYhRKJotAMeXD6mMPOKJpLjKRaOcbb5jIzUq0hJdruiEn1vPvE5j4TWFObQABnWz1jwM/3bK4XNZ/iXRsTShApkJAmp539idWaMge73ij6cGvaAMKrsvjkkfIdLGJUHbcqWR92tStH04EAQBEdqX8ECjOXzhQmqjOI/dR0qYxynj6K/kmFEi3K2QkF7Ckw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mZOltmfR7PaYWuWegK3MZPzKqvcs4arjanyq82dVIEbxUiTTfPZl0UtH5OR3cy6YPl3Nr0rt/SuN8rDxbmyhBYQvL+tWVmW9KWmWXWdDVQZHsM9QpSN1d0QJ2dGqlOA2CoboBQjJUak+VXiPiprXhbUbkgD/zMfDcpzavnFue2QFblJ5KGHIk6hdY5S5NwQF53ufck5KIxq43pcoiCqs+DziiIkvWYm6rGgQmzNTGIce7kyZ/Ci4kHtgZyN36p0BM7wFKD/USYg27jDE7Qfxinv4peCrgJNiel4RnmQJk6FfZy/F61EEy7pui/rJm4PzXxVwrnj4AKA/IBylkwJRvQ==
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Mon, 04 Sep 2023 14:04:10 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 04/09/2023 15:28, Jan Beulich wrote:
> 
> 
> On 04.09.2023 11:14, Michal Orzel wrote:
>> --- a/xen/include/xen/bitops.h
>> +++ b/xen/include/xen/bitops.h
>> @@ -51,7 +51,7 @@ static inline int generic_ffs(int x)
>>   * fls: find last bit set.
>>   */
>>
>> -static __inline__ int generic_fls(int x)
>> +static __inline__ int generic_fls(unsigned int x)
>>  {
>>      int r = 32;
>>
> 
> Even if perhaps not affected by UBSAN, generic_ffs() then wants taking care
> of as well, imo. If additionally you switch __inline__ to inline, things
> will become nicely symmetric with generic_f{f,l}sl().
If others agree, I can switch generic_ffs() to take unsigned as well (together 
with s/__inline__/inline/).
However, such change would no longer fall in fixes category (i.e. nothing wrong 
with ffs() taking int):
- is it ok at this stage of release? (not sure but no problem for me to do this)
- is it ok to mix a fix with non-fix change? (I always prefer fixes to be done 
as standalone changes)

> 
> Another aspect that may be nice to take care of at this occasion is their
> return values: None of them can return negative values, so return type
> would better be unsigned int.
Looking at all the variations (including arch asm specific) of helpers to find 
first set/clear in the codebase, returning int is the de-facto standard.
So, this would result in some inconsistency or require changing at least the 
direct callers to also return unsigned.
I'd prefer not to be required to add this extra churn at this release stage.

~Michal



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.