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

Re: [PATCH v3 6/9] x86/HVM: convert hvm_virtual_to_linear_addr() to be remote-capable


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Thu, 23 Sep 2021 10:09:40 +0200
  • 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; bh=eBu4pcbXT29mhKOgwOyv523CUW4myLMsPAhueB0Ul0o=; b=NnHYa+2oN48WH9dZWvDA6OJTsfNMeiggYzPgCeOG5TdvBbEwo7NFBGtA2Ys4h2gHoh73SUX/65vqZrJZnYl4fdRG2XNB6HbyNa0+oTv+ImR9KMXOxYd8LZzqTVqBpBgw5Z/EH/+wNj8sbo4O0cEyw0EP0BgegR1jnusUJizDF0nwjBHnOlPJ9+xdmtRp5bF9mOJfAIhYhRcZhRCwNLB9xqpZa+ay3LvGvRp01nFs+rh0DRjekJ2Pf62rXf7qLCxtLmZj5YUT3d3FUwFoxXWuKkO0+IM1LRstufawXSKSbnJyr3Yf86s1CkNT7T8O5lqSwl10ysf6jAHSk5Xq9DT80Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hUUph1iSzCHqpYhBDmpGS8ISxDq9c2al3tZpOkxcBuYEA/bJKIZlA+pVuQSjWAy+uI9/AtmUYzfA19F7XC65AH2xRRVFe+xoGyi0vOPAQHkTuq6ViibA23kmcOCFxttYzGFJkbTj7f/nm03ZiP4CpnraDf5X3RvnLYC5zp8KpoDYrznDKT/9k0wWb1MRwHzI+IeLcxe6bHw8Rj9w1qC+AKSWpoz17IOA01re/0bBCIBj9Dxga0oa9K6FUumzkAOFXGfvYX4W+7cNRlZ5MV9lnKTfBUC0M4Z9jZ/gCaORvUj62a8jOkciI9F/m5JFCphNC13r7BpdOfG92AeA0igTYQ==
  • Authentication-results: esa6.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "Andrew Cooper" <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Thu, 23 Sep 2021 08:10:03 +0000
  • Ironport-data: A9a23:ZMGUVa7fn6arX6Pq8RaBPwxRtObAchMFZxGqfqrLsTDasY5as4F+v mtNDDjQPPiMZGejL95zO4/loxwHu5/cxtVrSgY4q3xjHi5G8cbLO4+Ufxz6V8+wwmwvb67FA +E2MISowBUcFyeEzvuV3zyIQUBUjclkfJKlYAL/En03FVIMpBsJ00o5wrZo2NUw2LBVPivW0 T/Mi5yHULOa82Yc3lI8s8pvfzs24ZweEBtB1rAPTagjUG32zhH5P7pGTU2FFFPqQ5E8IwKPb 72rIIdVXI/u10xF5tuNyt4Xe6CRK1LYFVDmZnF+A8BOjvXez8CbP2lS2Pc0MC9qZzu1c99Z6 t5S6syKRgUQAYbUxONeUj1nMAVnFPgTkFPHCSDXXc27ykTHdz3nwul0DVFwNoodkgp1KTgQr 7pCcmlLN03dwbLtqF64YrAEasALNs7kMZlZonh95TrYEewnUdbIRKCiCdpwgWxs35oWR6u2i 8wxVTtjbRrYYwV0GHQJAbcloKSnuyDUbGgNwL6SjfVuuDWCpOBr65DyNPLFd9rMQt9a9m6Iq 2SD82nnDxUyMN2E1SHD4n+qnvXIny7wRMQVDrLQ3vxgjUCXx2cTIAYLTlb9qv684nNSQPoGd RZSoHB36/Fvqgr7FbERQiFUvlamtQFDC+BfEdQFwxnRzenVxzm6InEtG2sphMMdiOc6Qjkj1 1msltzvBCByvLD9dU9x5ot4vhvpZnNIdzFqiTssCFJfuoi+/NhbYg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gDQNEg/X4CePD0oTuLDr9rEmNbPZgMHPQcu7E2rgSmz4LD3PhCE1lNGOgk/josKwC zgqUjU96+ju/a0xlv10HLS1Y1fnJ/ExsFYDMKBp8AJInHHixquZq5mR7qe1QpF7N2H2RIPqp 3hsh0gN8N85zf4eXy0mwLk303a3DMn+xbZuBelqEqmhfa8aCMxCsJHi44cWADe8VAcsNZ117 8O936FtrJMZCmw3BjV1pztbVVHh0C0qX0tnao4lHpES7YTb7dXsMg24F5VKpEdByj3gbpXUd WGNPuspsq+TGnqKkww5gJUsZiRtzUIb1m7q3E5y4+oO2M8pgE/86MarPZv10vouqhNDaWtSo z/Q9BVfYp1P70rhJRGdZE8qPuMex/wqC33QRevyHTcZeo60iH22tTKCItc3pDcRHVP9upqpK j8
  • Ironport-sdr: +k7ryQpuop7DWC/lCqxNptHRWZGcu50pOP7z9X+/4+vEFMfy3WFh/IsemCPWKWTIzOFDSAadAV rDYF9n66BQsjeO4ukAPrU/YtGFdlEKt85y3qrMM5mxwhi5o19Bfq0VHENJcNSUWAeIYU3mzHY3 Y6YHmHSmMShklMoD+daAXuPHD1Algo1ytUPmT3X8NkQhJuDZ07ZEQCIcsQzDpsgUQ53GRoq7+Y 5NdT0eLEqljFRHeD+NmvdXK6pPyB5/17+Uk/tlkJ/A1WORAfnakMQ5S0qs0Y9Gm9HAJTDa/YHj 5mOusDXC/kEfnFFDsOm9gC1W
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Tue, Sep 21, 2021 at 09:19:37AM +0200, Jan Beulich wrote:
> While all present callers want to act on "current", stack dumping for
> HVM vCPU-s will require the function to be able to act on a remote vCPU.
> To avoid touching all present callers, convert the existing function to
> an inline wrapper around the extend new one.
> 
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
> ---
> Alternatively the actual dumping patch could avoid using this more
> elaborate function and, ignoring access checks, simply add in the SS
> segment base itself (if needed in the first place).
> ---
> v3: New.
> 
> --- a/xen/arch/x86/hvm/hvm.c
> +++ b/xen/arch/x86/hvm/hvm.c
> @@ -2526,7 +2526,8 @@ int hvm_set_cr4(unsigned long value, boo
>      return X86EMUL_OKAY;
>  }
>  
> -bool_t hvm_virtual_to_linear_addr(
> +bool hvm_vcpu_virtual_to_linear(
> +    struct vcpu *v,
>      enum x86_segment seg,
>      const struct segment_register *reg,
>      unsigned long offset,
> @@ -2535,8 +2536,9 @@ bool_t hvm_virtual_to_linear_addr(
>      const struct segment_register *active_cs,
>      unsigned long *linear_addr)
>  {
> -    const struct vcpu *curr = current;
>      unsigned long addr = offset, last_byte;
> +    const struct cpu_user_regs *regs = v == current ? guest_cpu_user_regs()
> +                                                    : &v->arch.user_regs;
>      bool_t okay = 0;

Since you change the function return type to bool, you should also
change the type of the returned variable IMO. It's just a two line
change.

Also is it worth adding some check that the remote vCPU is paused? Or
else you might get inconsistent results by using data that's stale  by
the time Xen acts on it.

Thanks, Roger.



 


Rackspace

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