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

Re: [PATCH] xen/x86: Make XEN_DOMCTL_get_vcpu_msrs more configurable


  • To: Tamas K Lengyel <tamas.k.lengyel@xxxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Wed, 26 Oct 2022 12:02:54 +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:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=arextXejh538XjVgOLGFjhVzAL5duyki9VJ4w6Ki4wc=; b=KPYYJf4fr5tve2QxJ/p5Zk2DI2RBtqYMm/gDtAIH78v+YnJxD8X7sxXQxYvT1p0mpZ4QmmxOUUwLTOeH8YwFbDeq5GF1o2Jpqxf87qV/Cyy3wpW1bf8wGDYsweaDcu/FtZZPkaY7fdzT4wlXkaaEGuL937bkevCxODPy5QCDgifCWCTdR8hCNX5lojmQ1dR4gVfuRXJ0U0RzdWoXBuiviE307lbdKWLbCM5/ZCeCiqV5pk9kOO05ntNry6mFfzbvcSz16R3Nw5/SX1tWIE3pUSSTAwUS8krYdtk2HVWSdifxEapXr60HJUBzsPEelIaYa2hXBcSe11lCS3SBYazPvw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EN4H5J9s84e+/aKihC1k7EB9DcRyk0T4OtQGQ9zOoVp5F1vJ5rbhaxMgbJ6DlTGykGN1NbIXkP7l4EokFKKSg2HSV8Sjpd0mXysjOLFLIw7tg7kr4kkKUzPdnAIoLY6JTzabo0YwNGLHKEtNJC2zBt1SeNmPI2CPvNIiI1C194f7Ia/3bOLbNltYKfJn1lkOU6TNVzNmOQ4xuh1Xr4Xg/azodXkDnF7k9KMxyHg7EW51WI/GOIAPbykvLaOOnCbjFjWNjOmkrFY2RcLAkBkbJs7rmDSS0zhBFLFl9v2el+sQxBTNQs/WDk3mc7bsoqoHRehuBcjbmmxj3sOBcswY+A==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Tamas K Lengyel <tamas.lengyel@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, Wei Liu <wl@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Jun Nakajima <jun.nakajima@xxxxxxxxx>, Kevin Tian <kevin.tian@xxxxxxxxx>
  • Delivery-date: Wed, 26 Oct 2022 10:03:23 +0000
  • Ironport-data: A9a23:4hlfVa7atqKQ+d7jEhEmdwxRtK3GchMFZxGqfqrLsTDasY5as4F+v jNJCzvTOa2OMWHweo9/bYSwoRwFsZ+AzIdiTAM4qyBmHi5G8cbLO4+Ufxz6V8+wwm8vb2o8t plDNYOQRCwQZiWBzvt4GuG59RGQ7YnRGvymTras1hlZHWdMUD0mhQ9oh9k3i4tphcnRKw6Ws Jb5rta31GWNglaYCUpJrfPewP9TlK6q4mlB5gZgPakjUGL2zBH5MrpOfcldEFOgKmVkNrbSb /rOyri/4lTY838FYj9yuu+mGqGiaue60Tmm0hK6aYD76vRxjnVaPpIAHOgdcS9qZwChxLid/ jnvWauYEm/FNoWU8AgUvoIx/ytWZcWq85efSZSzXFD6I+QrvBIAzt03ZHzaM7H09c4vX1oe7 fETFApXRRaKnbzt24ixRvBV05FLwMnDZOvzu1lG5BSBV7MMZ8mGRK/Ho9hFwD03m8ZCW+7EY NYUYiZuaxKGZABTPlAQC9Q1m+LAanvXKmUE7g7K4/dupTSOpOBy+OGF3N79YNuFSN8Thk+Fj mnH4374ElcRM9n3JT+toiz02LeWzX6TtIQ6Lo285994rHSo5W03CgUOfn+Hu9KdlRvrMz5YA wlOksY0loAu/UmiVZ/+GRm1pnGVsxo0VN9ZEul84waIooLI6gOQHS4AQzhOedEinM4wWTEuk FSOmrvBFTFp9bGYV3+Z3rOVti+pfzgYK3cYYi0JRhdD5MPsyKksijrfQ9AlF7S65vX3Fiv32 CuitzUlivMYistj/6ex8E3DgjmsjoPUVQNz7QLSNkqn8wU/Yoembo6p7FHz7PBcIYLfRV6E1 FAHltaf6qYSDJiLvC2LXOgJWrqu4p643Cb0hFduG9wr8W2r8nv7IoRIumkieQFuL9oOfiLvb AnLowRN6ZRPPXysK6hqf4a2DMdsxq/lfTj4as3pghN1SsAZXGe6EOtGPCZ8A0iFfJAQrJwC
  • Ironport-hdrordr: A9a23:6/REFqvffkqPwJ8qii//Nc8O7skDjNV00zEX/kB9WHVpm6yj+v xGUs566faUskd0ZJhEo7q90ca7Lk80maQa3WBzB8bGYOCFghrKEGgK1+KLrwEIcxeUygc379 YDT0ERMrzN5VgRt7eG3OG7eexQvOVuJsqT9JjjJ3QGd3AVV0l5hT0JbTpyiidNNXJ77ZxSLu v72uN34wCOVF4wdcqBCnwMT4H41qf2fMKPW29+O/Y/gjP+9Q+V1A==
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Tue, Oct 25, 2022 at 01:48:36PM -0400, Tamas K Lengyel wrote:
> On Tue, Oct 25, 2022 at 4:13 AM Roger Pau Monné <roger.pau@xxxxxxxxxx>
> wrote:
> >
> > On Mon, Oct 24, 2022 at 12:58:54PM -0400, Tamas K Lengyel wrote:
> > > Currently the XEN_DOMCTL_get_vcpu_msrs is only capable of gathering a
> handful
> > > of predetermined vcpu MSRs. In our use-case gathering the vPMU MSRs by
> an
> > > external privileged tool is necessary, thus we extend the domctl to
> allow for
> > > querying for any guest MSRs. To remain compatible with the existing
> setup if
> > > no specific MSR is requested via the domctl the default list is
> returned.
> >
> > I'm afraid I would benefit from some extra description about why you
> > need to introduce a separate hook instead of using the existing
> > do_rdmsr hook in arch_vpmu_ops (which is already hooked into
> > guest_rdmsr()).
> >
> > Are the MSRs you are trying to fetch not accessible for the guest
> > itself to read?
> 
> No, the reason we need this different hook is because do_rdmsr assumes the
> guest is reading the MSRs that are currently loaded. For external tools
> where v != current the vpmu context needs to be saved by pausing the vcpu
> first and then the MSR content returned from the saved context.

Hm, I see.

We need to dump the CPU MSR contents into the structure so they can be
read from a different pCPU differently than the currently running one.

It would be nice if this could all be somehow wired into
guest_rdmsr(), but the function executing a vcpu_pause() as part of
it's operations would be quite weird, also it having a vcpu parameter
is kind of misleading, as under some circumstances it will perform a
rdmsr and that's likely only correct when v == current.

I guess I will ask for others opinion, but having that specific vPMU
function call in XEN_DOMCTL_get_vcpu_msrs on the side of guest_rdmsr()
seems like a layering violation, as it should all be contained in
guest_rdmsr().

Thanks, Roger.



 


Rackspace

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