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

Re: [PATCH RFC] rangeset: mark a few functions pure


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 29 Sep 2022 10:20:31 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; 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=IFDh9KA9ArMw2f61TIff5eVXy26rQz8dDlZsRIL7Su8=; b=C+mKdGGpcWqjUWxkOD2eKGWvftes9/oVwXi370I9qxJw1E0FqwHQpgqn6W6bn2gmaBglorniXsxT5XRAeLFF/CRontitk5g1Do+kXw97ldYSkhhlytRvrOjC2Xi3tM1cOeS10YnJqdOLvc2qEpUqfR0Sb3Ukx5Kvqw4lO1iO02iOeuTAO+Njqr2M3WHvpAc3O/svfSEcjW1YxhS/rDl8xJ+uh8W1Wb3Rkzq/Yn88C0n6LdmnDKXxcrnc8fE19E9TnyqxpW0sAm/fpc0hgFemoe04XIK2yJ6H0tQSSMlYkuikh1RPCw2yo62855aoqJLkj1NR2wNfugp4PlfWnu+mZA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SnzsTNUDRh2E0U6KCdQh+SuEwg4CM5HcJacMUksn/XC7ZlhVGi72Bw3V5QJVFI7IgIR+6bTzWzVFBS0IETYbtfXVrgWkg0+N5GymH3eVD7zkjSiiW7NKfF5ndc/wQq5yZUiN1zEbqbfeZKEp4FejASKLcKPjhJswqBjWdVm3lzcs4B3sBAVxBQ/LH41/cFpEnye1OFhCyJkZubc3EFTQnQ040YDCTXOo5o6WMD5zxhUE2HvRxYMQ7bSpNtOcqYD+EKJOS46y1MUZERV1xsbHRc2refJAvESdcmfR0YbPF2+9krkVh/ZNXb8dert5RCUudV4DmRuJjT8WY5qglxXw2w==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Thu, 29 Sep 2022 08:20:37 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 28.09.2022 16:27, Roger Pau Monné wrote:
> On Wed, Sep 28, 2022 at 02:12:30PM +0200, Jan Beulich wrote:
>> While for some of the functions there's locking involved, the acquiring
>> and releasing of a lock doesn't alter program state when comparing
>> "before" and "after" the function invocations. Furthermore without
>> (further) locking by callers, return values are stale anyway by the time
>> they can be evaluated. Hence both CSE and DCE are okay to occur for
>> invocations of these functions.
>>
>> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
>> ---
>> RFC for the (imo) ambiguous wording in documentation.
> 
> What happens if the contents of the rangeset is modified outside of
> the scope of the function.  Ie: would for example:
> 
> while ( !rangeset_is_empty(...) );
> 
> Become an infinite loop then, without taking into account that the
> rangeset can be externally modified?
> 
> It's not clear to me whether the elimination of repeated calls take
> into account that the observed variable can be externally modified?

Hmm, right, this actually matches the feof() counter-example that the
gcc doc has. So I guess I need to withdraw the patch and we will need
to live with these functions not being possible to eliminate even in
cases where it would be okay (and helpful).

Jan



 


Rackspace

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