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

Re: [PATCH 5/9] x86emul: re-use new stub_exn field in state structure


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 17 Apr 2023 13:26:14 +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=pSp8JAdbD6alqZx8DC6iHdRefLG+btm9pOyUQkSTXUI=; b=hpPZP+DWVsJGXjLfaZSFWxqn6KhnpboytYM7L+C7iALzszRZ8o0qzmfg2KTKWhBLRiUQgIOm8SlvMJWbSrON3121AfhSuZRtUgqhfEfgV6hsXJt3tynhsCMHOAP6dIsgCOCeIvhF8V3q8j4euzXel500zxRPhE0fX7LEo0pmQc66P7c7tCajXrjXK4GpUdibx86+NDLoQLEou5nlbLUDiTf2Od7tWVxOxIXqJC/JTQ1nm6tqLprjl9GA1Xdx4JIsZXjb5wb29u6NoWnFWZDGHk7JM+o5yCEYLHFVTNqzO65o2SN3x6Fn4ZHVoUTyH0Y/RG1PWI9nTIZsSrfPLdAlRw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CikCacH62Gazd2DTsqVfGIT1TJc7y5w4nq3qaF4ztU6HNGUtt7rkVV4+u8kKuGIjyq57b53sPt3NLfEtR7cbvbvzxqEdbkJOZY+74YN+Ly2GYzruuhJPdIPZb/HByiIjum7hpzCsUR3ggPVQHa+LjG5MoZawulydm4iyCoQSLLH+7lWALZbS5ZFymflAHYTGib0WArORUvykMACO8HA6sVtqzmezq8MPGaEptH8ze+aJAvUpvPhjkHpHNcoaxu5KOBXIJ2+Nd8m64INhsakRfvB5dtblF1VhrDfVRxGjTUZtvOXuThdZZbBbXY0bGU7J9QvBB+hMc+/PaOmCZR/FnQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Mon, 17 Apr 2023 11:26:29 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 06.04.2023 21:48, Andrew Cooper wrote:
> On 04/04/2023 3:53 pm, Jan Beulich wrote:
>> This can now also be used to reduce the number of parameters
>> x86emul_fpu() needs to take.
>>
>> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
> 
> As said in the previous patch, I think this patch wants reordering
> forwards and picking up the addition into state.
> 
> "Because we're going to need it in another hook, and it simplifies an
> existing one" is a perfectly fine justification in isolation.

As said there, I'll do that.

> With that done, Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>,

Thanks.

> although...> 
>> ---
>> We could of course set the struct field once early in x86_emulate(), but
>> for now I think we're better off leaving it as NULL where not actually
>> needed.
> 
> Do we gain anything useful from not doing it once?  it's certainly more
> to remember, and more code overall, to assign when needed.

Right, that's why I did add the remark. In harness and fuzzer we'll be
able to catch stray uses of the field if we keep it at NULL. Actually
if we were to always set the pointer, perhaps it wouldn't make sense
to have a pointer in struct x86_emulate_state in the first place, but
then we'd better put the struct itself there.

>> --- a/xen/arch/x86/x86_emulate/fpu.c
>> +++ b/xen/arch/x86/x86_emulate/fpu.c
>> @@ -90,9 +90,8 @@ int x86emul_fpu(struct x86_emulate_state
>>                  unsigned int *insn_bytes,
>>                  enum x86_emulate_fpu_type *fpu_type,
>>  #define fpu_type (*fpu_type) /* for get_fpu() */
>> -                struct stub_exn *stub_exn,
>> -#define stub_exn (*stub_exn) /* for invoke_stub() */
>>                  mmval_t *mmvalp)
>> +#define stub_exn (*s->stub_exn) /* for invoke_stub() */
> 
> ... honestly, I'd really like to see these macros purged.
> 
> I know the general style was done like this to avoid code churn, but
> hiding indirection is a very rude thing to do, and none of these are
> usefully shortening the expressions they replace.

Right, getting rid of those is certainly on my radar. But it'll be
further code-churn-ish changes in an area where history tells me
things often take long to get in (and hence there may be measurable
re-basing effort in the meantime).

> Also, putting stub_exn in the K&R type space is still weird to read.

What's K&R-ish there?

Jan



 


Rackspace

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