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

Re: [PATCH v3 1/2] xen/arm: exclude xen,reg from direct-map domU extended regions


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
  • Date: Fri, 6 Jun 2025 08:04:40 -0400
  • 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 (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=FDHgc0Z1OVo3mN5DyXW2eRyjhMEoj80iTby6hxyWtOM=; b=DEfQEVq/j3yW0+Y9qGUmWWXZ5aLQUCmZ2TTIe6nUkpZgiEBwfPJauA951YMoYpjb94G7jVtJDNIIbQkVam7k97CIy2E1aIhdouKUKd0RKpIAmaKR1UwImEqQW7ybgM1QBUBM45NT4l8Fd322qqwZealApfrxP3D6KrE/MriJdxdTUN61Kp2Ju4aIc5lEcn5L/ocGSB9Yo3kW3zsPfPr71fTIgNPiAZY0ja8J1d1PL4/zKcS0NtQfXCJwYfzbg6QrvR0HggBhCg9SrMRCsBqluNiFzSQB7NRmQ5uIg9RPGZljUWsz3d2fOy8Y7XwiL7xdTG2ClWAWaY9dbE+DjXjxMw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=XIgamSVNy/go73t3KWs83YbHQWVO5EbZ9LfDLFPN/Hs8goSBqaISIRRoTfP+vb+iAD8GHjeb1dXEH9JhVVXfXra0vpunNHlThl1H8U6yDptRf/QcL4LGuytCtqWL3dQwxJQl8dBemQ56ZHo4tMyzUYB+a+1ghjJxxxjb8P+50fY3QDRHVtU35HD0ozfIo9MN4DNdlr3cvy8pJPvqJIPp2nCcmVkB+uuYVEpoL1ft5HFN43dXbVo+B6sQ/MwyqedxZSDAVxmSOWFqTMh7C8kj3GbU3UWqYN2j2AVvik13dZlHSMRvTS1GxinbOIPK8Sbh6pkIjt9/xnlYg6gUXYS2IQ==
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Fri, 06 Jun 2025 12:05:05 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 5/14/25 02:49, Jan Beulich wrote:
> On 13.05.2025 21:54, Stewart Hildebrand wrote:
>> --- a/xen/common/rangeset.c
>> +++ b/xen/common/rangeset.c
>> @@ -433,6 +433,20 @@ bool rangeset_is_empty(
>>      return ((r == NULL) || list_empty(&r->range_list));
>>  }
>>  
>> +int rangeset_count_ranges(const struct rangeset *r)
>> +{
>> +    int nr = 0;
> 
> Ehem - this and the function's return type want to be unsigned.
> 
>> +    struct list_head *list;
>> +
>> +    if ( r == NULL )
>> +        return 0;
>> +
>> +    list_for_each( list, &r->range_list )
> 
> Nit: Either you deem list_for_each a pseudo-keyword (then a blank is
> missing) or you don't (then there are excess blanks).
> 
> Further I don't think this is valid to do without holding the rangeset's
> lock in read mode (irrespective of the function return value potentially
> being stale by the time the caller gets to look at it, which is no
> different from other functions, i.e. falls in the caller's
> responsibilities).
> 
>> +        nr++;
> 
> And then, if already abstraction is wanted, wouldn't this loop better be
> yet another helper (macro?) in xen/list.h?
> 
>> +    return nr;
>> +}
> 
> Finally: If this is to be commonly used in several places, having such a
> helper is likely fine. As it stands, the sole caller is an __init
> function, and hence this is unreachable code post-init (which while not
> formally a Misra violation in my eyes effectively still is one). Aiui
> the same can be achieved using rangeset_report_ranges(), with a new
> (__init and static) callback function.

Moving rangeset_count_ranges() to rangeset.h might change the situation
slightly, but I'm not aware of any other potential callers so I'll just
use rangeset_report_ranges().



 


Rackspace

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