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

Re: [PATCH 06/16] x86/shadow: purge {write,cmpxchg}_guest_entry() hooks


  • To: Jan Beulich <jbeulich@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Thu, 23 Mar 2023 13:13:27 +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=qGW9rmQ7+rvZXm+GJ9TWLz1McuOCzimq60D9PWsMsf0=; b=croIvw2ygUCFq9j55SGZPQK3s0AUaOc9Nl7gIXHeyjEkVA/jxe5wcQn6IkoYUjPq4o5G7DpPIoVDckYzbjQro41uAEUhe1mNa1NcjI9TwWcKYZb/ZPGucJzRt5GZ+bM38XE3LJzKmDujkz3VYC+zwvQyuoyiDalfPwx+OCi1bRdx+h0Lq1k67SYvAfaTT54E8/3mSkd5MTRTIkigq2wgm77I8EConpNGtcLzXfCRCegjqXcUdIt21k4Cs8NqvxgPh/jprOEHgVeY/+XemBlV3GMD7P+liATR3XuQTYml9VmxpGGnyMzESJtTK4XSQAN5SI1yFBUZqGF/Ve6vW+0EVA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kWdMMy99u6Dq1OxzD9VTE4sewbn459OF4LDYHPsP8QpczhNYps1nlKoSS8hWn3VnpztQTpq7lJ/uho1ZinCEPAKwnJR5RZhrRWyeERCZrIag0PNja+tk6QPokaQ3lZs/TUfgy6/QQKO4rMXSStKtmpe3Ijadkx6x/IqAKPy5camspPVRILGXmd9C4E1/jeGA2LcfavSZODSgsbAn93JRe6o+bOGt3lp9es51EbKqFchdp3Ogco5R6OzzWaqSpsjKKhbVSLmN1hvTbS99n9SHOAohhSnzoobVWjKQKqFm6uqGyW1dGmRCbxuBDsLPtvjvljz0pPy44SHtRiKuy7dbVQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Tim Deegan <tim@xxxxxxx>
  • Delivery-date: Thu, 23 Mar 2023 13:13:59 +0000
  • Ironport-data: A9a23:Dj6gjKDNmjKEkBVW/xniw5YqxClBgxIJ4kV8jS/XYbTApGhw0TxWm 2dNUG6PP/iDamSmKotwboq3pBsDu8fRnYUwQQY4rX1jcSlH+JHPbTi7wuUcHAvJd5GeExg3h yk6QoOdRCzhZiaE/n9BCpC48T8nk/nOHuGmYAL9EngZbRd+Tys8gg5Ulec8g4p56fC0GArIs t7pyyHlEAbNNwVcbyRFu8pvlDs15K6p4GhC5QRnDRx2lAS2e0c9Xcp3yZ6ZdxMUcqEMdsamS uDKyq2O/2+x13/B3fv8z94X2mVTKlLjFVDmZkh+AsBOsTAbzsAG6Y4pNeJ0VKtio27hc+ada jl6ncfYpQ8BZsUgkQmGOvVSO3kW0aZuoNcrLZUj2CA6IoKvn3bEmp1T4E8K0YIwwuA0MX9W8 6UkGRM2QAKYmLuUxu3gRbw57igjBJGD0II3nFhFlGicIdN4BJfJTuPN+MNS2yo2ioZWB/HCa sEFaD1pKhPdfxlIPVRRA5U79AuqriCnL3sE9xTI+uxuvDS7IA9ZidABNPL8fNCQSNoTtUGfv m/cpEzyAw0ANczZwj2Amp6prraXx3uhBtlPS9VU8NYwknqyyFMcKyQ6D0e8uPSF0hKaXdNAf hl8Fi0G6PJaGFaQZtv3UgC8oXWElgUBQNcWGOo/gCmdx6yR7wuHC2wsSj9adMdgpMIwXSYt1 FKCg5XuHzMHmKKRYWKQ8PGTtzzaETQUKEcSaClCShEKi+QPu6k2hxPLC9pmTqi8i4SsHSmqm m/W6i8jm78UkMgHkb2h+kzKiC6toZ6PSRMp4gLQXSSu6QYRiJOZWrFEIGPztZ5oRLt1hHHb1 JTYs6ByNNwzMKw=
  • Ironport-hdrordr: A9a23:oDeOaKPV3gC32MBcTuOjsMiBIKoaSvp037B87TEXdfU1SKylfq +V98jzuSWftN9zYhAdcLK7V5VoGkmskaKdiLN5VYtKOjOKhILCFu9fBOXZrwHIKmnF+vVD1a 1tVK5hTPH1BVh+p8P77A6keuxQpeVuX8qT9IHjJ9sGd3AJV0nAhT0JaTqmLg==
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 22/03/2023 9:32 am, Jan Beulich wrote:
> --- a/xen/arch/x86/pv/mm.h
> +++ b/xen/arch/x86/pv/mm.h
> @@ -32,6 +34,35 @@ static inline l1_pgentry_t guest_get_eff
>  }
>  
>  /*
> + * Write a new value into the guest pagetable, and update the
> + * paging-assistance state appropriately.  Returns false if we page-faulted,
> + * true for success.
> + */

I know you're just moving the comments as-are, but more than half of
this is definitely wrong now, and another part is wholly redundant.

"Write a new value into the guest pagetable" is about the best I can
think of, but it is borderline whether it even needs a comment.

> +static inline void paging_write_guest_entry(
> +    struct vcpu *v, intpte_t *p, intpte_t new, mfn_t gmfn)
> +{
> +    if ( unlikely(paging_mode_shadow(v->domain)) )
> +        shadow_write_guest_entry(v, p, new, gmfn);
> +    else
> +        write_atomic(p, new);
> +}
> +
> +
> +/*
> + * Cmpxchg a new value into the guest pagetable, and update the
> + * paging-assistance state appropriately.  Returns false if we page-faulted,
> + * true if not.  N.B. caller should check the value of "old" to see if the
> + * cmpxchg itself was successful.
> + */

"Compare and exchange a guest pagetable entry.  Returns the old value." 
We don't need to teach people how to use cmpxchg as a primitive here...

The comment next to shadow_cmpxchg_guest_entry() ideally wants the
grammar fix in the first clause too, and this is probably the right
patch to do it in.

For the content of the change, definitely an improvement.  With the
comments suitably adjusted, Reviewed-by: Andrew Cooper
<andrew.cooper3@xxxxxxxxxx>



 


Rackspace

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