[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] x86/hvm: Improve hvm_set_guest_pat() code generation again
- To: Jan Beulich <jbeulich@xxxxxxxx>
- From: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>
- Date: Fri, 24 Mar 2023 00:59:15 +0000
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.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=n/HrkrxERqn0yUqYmnFPk0U/F1xuWcG6atPbU/wV/ag=; b=R4xfWpUnqeRCIIRa8IRTxkkVjCJsuh8i+5eQ/yh/T8lsJlSBBkAZqBxQjuNprRINxIqLz6kFJFcGenggVb7iQQmjZdHJbcBVJxXSeGxlBg3nsn51Sr8ZT83nRmC3Jz0aN/l7syWoyJpW0aaznIzI2aUngAE75FtUhh9as8qXE6KC8Hszk38HxaybMi4FkgcfwvcjG9KUDIEj4JYWv5r+81aR86rqXXnFcsyE8jnRUcH9ZGMlWYG/n/nzzw3iiIF7SFRAUG54qEFj54+0MbfigERg2X/C7ghjJu+SBKeJVK8JOCahLkP//rXhpJSfyYcds9NMdWJJZirUkTJ4YWeTlQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EwoJFO7TfMZAQ4hKom4iy6nOk/Vpg/z3Y5qFwtn1VG7UWYFJpkzzlAQXCs+AfDPGk2cXT53qir3pG6qfdxCKXnEODQR1cAm+S//sL2FgRFWTlcC41mmrGebLxJo9+3VlVqohfCEDFJZakHuxdriLqO873TdHmQNr+Mkr57DT9ivBNQmUXtRGxhKZMhtAGVfTg5SbZuEuTa2zUA8r4pafCPmXEpZeNRpyyw8DJRqca60C/1CMvDOcnRY7ijs0tdzd6cY5GpCxd4Afe51NDR4Qm6c/mNx0kP5Yn98/aGpdBgDyUdSQNEtnV6zLFVWyfiwkUVrgvM7NI0GZCuhpTWtGyA==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
- Cc: Roger Pau Monne <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Demi Marie Obenour <demi@xxxxxxxxxxxxxxxxxxxxxx>, Edwin Torok <edvin.torok@xxxxxxxxxx>
- Delivery-date: Fri, 24 Mar 2023 00:59:47 +0000
- Ironport-data: A9a23:2lzjcqAx0p+qhxVW/+jiw5YqxClBgxIJ4kV8jS/XYbTApDhwgjQBx 2cfDTiGM/fZY2v8L9gkPYjjpB4Pvp/XyoNqQQY4rX1jcSlH+JHPbTi7wuUcHAvJd5GeExg3h yk6QoOdRCzhZiaE/n9BCpC48T8nk/nOHuGmYAL9EngZbRd+Tys8gg5Ulec8g4p56fC0GArIs t7pyyHlEAbNNwVcbyRFu8pvlDs15K6p4GhC5QRlDRx2lAS2e0c9Xcp3yZ6ZdxMUcqEMdsamS uDKyq2O/2+x13/B3fv8z94X2mVTKlLjFVDmZkh+AsBOsTAbzsAG6Y4pNeJ0VKtio27hc+ada jl6ncfYpQ8BZsUgkQmGOvVSO3kW0aZuoNcrLZUj2CA6IoKvn3bEmp1T4E8K0YIw47tIKyJl/ LsidRMVdRyd3u+O8bfrVbw57igjBJGD0II3nFhFlWucIdN9BJfJTuPN+MNS2yo2ioZWB/HCa sEFaD1pKhPdfxlIPVRRA5U79AuqriCnL3sE9xTI++xruwA/zyQouFTpGPPTdsaHWoN+mUGAq 3id12/4HgsbJJqUzj/tHneE37eVxXmjBNtIfFG+3v06p3mt929MND01e2ugqN20rlGUXN0Kf iT4/QJr98De7neDTNPwQhm5q36spQMHVpxbFO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Xen developer discussion <xen-devel.lists.xenproject.org>
On 19/12/2022 7:28 am, Jan Beulich wrote:
> On 16.12.2022 21:53, Andrew Cooper wrote:
> Again - one way to look at things. Plus, with Demi's series now also in
> mind, what's done here is moving us in exactly the opposite direction.
> Is this hot enough a function to warrant that?
Yes - from the first cset, 9ce0a5e207f3 - it's used on virtual
vmentry/exit so is (or will be) reasonably hot in due course.
What is more important in the short term is avoiding the catastrophic
code generation that Clang still does with default Xen build settings,
also linked from the commit message.
>>>> --- a/xen/arch/x86/hvm/hvm.c
>>>> +++ b/xen/arch/x86/hvm/hvm.c
>>>> @@ -302,24 +302,43 @@ void hvm_get_guest_pat(struct vcpu *v, u64
>>>> *guest_pat)
>>>> *guest_pat = v->arch.hvm.pat_cr;
>>>> }
>>>>
>>>> -int hvm_set_guest_pat(struct vcpu *v, uint64_t guest_pat)
>>>> +/*
>>>> + * MSR_PAT takes 8 uniform fields, each of which must be a valid
>>>> architectural
>>>> + * memory type (0, 1, 4-7). This is a fully vectorised form of the
>>>> + * 8-iteration loop over bytes looking for PAT_TYPE_* constants.
>>> While grep-ing for PAT_TYPE_ will hit this line, I think we want
>>> every individual type to also be found here when grep-ing for one.
>>> The actual values aren't going to change, but perhaps the beast
>>> way to do so would still be by way of BUILD_BUG_ON()s.
>> Why? What does that solve or improve?
>>
>> "pat" is the thing people are going to be looking for if they're
>> actually trying to find this logic.
>>
>> (And I bring this patch up specifically after reviewing Demi's series,
>> where PAT_TYPE_* changes to X86_MT_* but "pat" is still the useful
>> search term IMO.)
> I don't think "PAT" is a good thing to grep for when trying to find uses
> of particular memory types.
This is not a logical use of a particular memory type. Being an
architectural auditing function, the only legitimate use of these
constants here is all of them at once. This is the one place you firmly
don't care about finding when asking the question "How does Xen go about
handling WP mappings".
I have swapped PAT_TYPE_* for X86_MT_* now that Demi's series has been
committed, but that is the extent to which I think there are relevant
changes to be made.
~Andrew
|