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

Re: [PATCH v3 10/14] x86/vmx: move declarations used only by vmx code from vmx.h to private headers


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 28 Feb 2023 08:47:14 +0100
  • 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=KNnsOQiKAvQXcsiEcmuTGgXBtv+6KrlSKkhh+8Zlcc0=; b=P6NCrcVbAdcT9VXgSmnBNyA7bDLAGQCdV8j92xJf06lEoE31ZMp07BhjeXuQvocPHwfXzWruAOZ7o47zK/POEHvE3HOUs7p0POWGvzNncQf/bBgu/RtlOMOpAB0tMnCDJjXKHQJT/b/l8+qyZl+V/RLSbVDKBKlfEqGNzsl1p493FYdkqbqS4UqyVjWotjXKWMpEbPO6hkVgErEPHxDj1I25u7XQjPOW+Bf2TEJNXyOMmXTdOcvLTqSPZ+IhBR0/vvCo6awd39yMzjT0GJJNwzkdK2cnB7QTkU2kVJR9GukwgBtp3RAGbEmdU9y4Nj7OU9wxE2+SOMJkJZF9BxL84A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mGoEEMMlOLCR8iis6atl8yW3/0EBhYG6czWVV8h5s81ayWMPEJP24EJZ4E/p7vN3/Wnz4d1e7ztkqBwGR53OvlKB4Y91HWhhog5HscrJvQM8Ki3Zx3IYQtEwi5oSk4PZ/bsWhJGqimBoQFiH46H2yziFwOSKDfiGhgK4u5BXwDHmkIM/2yPuzRgogcn4bocwzZxs8r8rNWrVZrbTmHvhqKFMOngaf0hJuqk0igonhuB1mwsKPjaWmmOOhHi4CNRzz3m0rCa1lg3/94F6ZZBuU/HkIMSziyXMOQkjcPN5wRY5iCzKrihrr6YmtdSqw+2G0LYq07YiWgtlQU6p442t6g==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Jun Nakajima <jun.nakajima@xxxxxxxxx>, Kevin Tian <kevin.tian@xxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, Xenia Ragiadakou <burzalodowa@xxxxxxxxx>
  • Delivery-date: Tue, 28 Feb 2023 07:48:01 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 27.02.2023 17:26, Andrew Cooper wrote:
> On 24/02/2023 6:50 pm, Xenia Ragiadakou wrote:
>> Create two new private headers in arch/x86/hvm/vmx called vmx.h and pi.h.
>> Move all the definitions and declarations that are used solely by vmx code
>> into the private vmx.h, apart from the ones related to posted interrupts that
>> are moved into pi.h.
>>
>> EPT related declarations and definitions stay in asm/hvm/vmx/vmx.h because
>> they are used in arch/x86/mm and drivers/passthrough/vtd.
>>
>> Also, __vmread(), used in arch/x86/cpu, and consequently the opcodes stay in
>> asm/hvm/vmx/vmx.h.
> 
> Every time I read the vpmu code, I get increasingly sad.
> 
> That is dangerously unsafe, and comes with a chance of exploding completely.
> 
> That __vmread() is in NMI context, which means `current` isn't safe to
> deference (we might hit in the middle of a context switch), and more
> generally there's no guarantee that the loaded VMCS is the one
> associated with `current` (we might hit in the middle of a remote VMCS
> access).

Are you mixing up oprofile (using NMI) and vPMU (using an ordinary vectored
interrupt)? Or am I overlooking a vPMU mode of operation where NMI could be
used (i.e. other than apic_intr_init()'s calling of set_direct_apic_vector()
and other than pmu_interrupt() invoking vpmu_do_interrupt() /after/ acking
the IRQ at the LAPIC)?

Jan

> vpmu is generally not supported, and BTS needs further custom enablement
> because it is only useable with a custom bus analyser.
> 
> 
> The __vmread() needs deleting - its absolutely not safe to say.
> 
> I'm tempted to hardwire the return 0, and punt the problem to whomever
> next uses BTS.
> 
> Alternatively, MSR_DBGCTL needs wiring into the hvm_get_reg()
> infrastructure, but I'm not convinced this will actually work in either
> of the two problem cases above, hence preferring the previous option.
> 
> Thoughts?
> 
> ~Andrew




 


Rackspace

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