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

Re: [PATCH v1.1 5/5] tests: Introduce a TSX test

  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 14 Jun 2021 16:59:34 +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-SenderADCheck; bh=wpD3cR1gk7HASzyY+f5N3PorKTwg02z3WvEFIYP4MRw=; b=AC0ucYPOPAR6/ejvNFTzl0uKaExRFnA1M1s9Go1uu7+B8iuWeUVZ8fQkiLu82QA9EkK7NhTED1yRilrE1dfb7mklLyanN5+ATVCw4qRuowDKmW1m+IX2+agOQqyqRHlKE539JtqMwBoFEFHs7hSoqHM/rksC+q3e069mLrv0s5XvVzAz0i4nGbHDUAKppmbSoizrekD8fT+0ToL1BCqMIaYKrUDmvhozGBLbfKfpZ4ufzzd9LfQYKIG1n6CcoEWTURo9lvDv4NajS4+XDFacNH4pQWjcT92hAQiJgUWHRkO8OJFYzH/KRPnqC5b8CZgd27UbEJ85RgSAtl/eEVFDEA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cXE7E7y/gW2k+wbWuCGPYlmTJPnWVbrfXGB7T0xKcby3bu+/II0wdNSlY4cBqPOyhLs+A0EvrlF0oIOdK0zBlj0aKcpssxI6DF6aAfL+BNR9FtIHEQgi32yGSsZmKDCY2fU5w9dqrsXGVoV/L2ApziuGtEERlwcujdKYbZ6hYsZRpUT261HkK1vIxVDMP263H0wwhP8sZaAW6pNtindUtc8Y+3HhdTi96/4IVIJ6qhIqNQ3qgORzLeXyw33CNvrEPJKlVnc3f/8whOea/15OFywAMVhjTrjTvIfs3w938vlvk/r1mdm7ccVsJZTLv7bPJ2ZYrNtxyLSgkSmQXzFEJg==
  • Authentication-results: lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; dmarc=none action=none header.from=suse.com;
  • Cc: Igor Druzhinin <igor.druzhinin@xxxxxxxxxx>, Edwin Torok <edvin.torok@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Mon, 14 Jun 2021 14:59:44 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 14.06.2021 16:50, Andrew Cooper wrote:
> On 14/06/2021 14:31, Jan Beulich wrote:
>> On 14.06.2021 12:47, Andrew Cooper wrote:
>>> +static void test_tsx(void)
>>> +{
>>> +    int rc;
>>> +
>>> +    /* Read all policies except raw. */
>>> +    for ( int i = XEN_SYSCTL_cpu_policy_host;
>> To avoid having this as bad precedent, even though it's "just" testing
>> code: unsigned int? (I've first spotted this here, but later I've
>> found more places elsewhere.)
> Well - I question if it even is "bad" precedent.
> For array bounds which are constants, the compiler can (and does) do
> better than anything we can write in C here, as it is arch-dependent
> whether signed or unsigned is better to use.
> Beyond that, it's just code volume.

Well, no, I disagree. Any use of variables for array indexing,
when not intentionally meaning negative indexes as well, would
better use unsigned variables. This is just so that in cases
where it does matter, people will not end up cloning from an
instance where it may not be important because of, as you say,
e.g. constant loop bounds.

As to the compiler doing better - if it can when the induction
variable is (implicitly) signed, why would it not be able to
when the variable is (explicitly) unsigned?




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