Re: [PATCH] xen-pciback: allow compiling on other archs than x86

2021-09-21 Thread Oleksandr Andrushchenko
On 21.09.21 09:49, Juergen Gross wrote: > On 21.09.21 08:38, Oleksandr Andrushchenko wrote: >> >> On 21.09.21 09:07, Juergen Gross wrote: >>> On 21.09.21 07:51, Oleksandr Andrushchenko wrote: On 21.09.21 08:20, Juergen Gross wrote: > On 21.09.21 01:16, Stefano Stabellini wrote: >

[PATCH] x86/xen: remove unneeded preempt_disable() from xen_irq_enable()

2021-09-21 Thread Juergen Gross
Disabling preemption in xen_irq_enable() is not needed. There is no risk of missing events due to preemption, as preemption can happen only in case an event is being received, which is just the opposite of missing an event. Signed-off-by: Juergen Gross --- arch/x86/xen/irq.c | 18 +++

Re: [PATCH] xen-pciback: allow compiling on other archs than x86

2021-09-21 Thread Juergen Gross
On 21.09.21 09:00, Oleksandr Andrushchenko wrote: On 21.09.21 09:49, Juergen Gross wrote: On 21.09.21 08:38, Oleksandr Andrushchenko wrote: On 21.09.21 09:07, Juergen Gross wrote: On 21.09.21 07:51, Oleksandr Andrushchenko wrote: On 21.09.21 08:20, Juergen Gross wrote: On 21.09.21 01:16,

[PATCH v3 0/9] x86/PVH: Dom0 building adjustments

2021-09-21 Thread Jan Beulich
In the course of fixing XSA-378 fallout I ran into a number of issues, which this series is trying to deal with. The majority of the changes is pretty much independent of one another. There was another rather basic issue to fight first (patch was submitted separately as RFC): vPCI wasn't aware of

[PATCH v3 1/9] x86/PVH: improve Dom0 memory size calculation

2021-09-21 Thread Jan Beulich
Assuming that the accounting for IOMMU page tables will also take care of the P2M needs was wrong: dom0_paging_pages() can determine a far higher value, high enough for the system to run out of memory while setting up Dom0. Hence in the case of shared page tables the larger of the two values needs

Re: [PATCH] xen-pciback: allow compiling on other archs than x86

2021-09-21 Thread Oleksandr Andrushchenko
On 21.09.21 10:09, Juergen Gross wrote: > On 21.09.21 09:00, Oleksandr Andrushchenko wrote: >> >> On 21.09.21 09:49, Juergen Gross wrote: >>> On 21.09.21 08:38, Oleksandr Andrushchenko wrote: On 21.09.21 09:07, Juergen Gross wrote: > On 21.09.21 07:51, Oleksandr Andrushchenko wrote:

[PATCH v3 2/9] x86/PV: properly set shadow allocation for Dom0

2021-09-21 Thread Jan Beulich
Leaving shadow setup just to the L1TF tasklet means running Dom0 on a minimally acceptable shadow memory pool, rather than what normally would be used (also, for example, for PVH). Populate the pool before triggering the tasklet, on a best effort basis (again like done for PVH). Signed-off-by: Jan

[PATCH v3 3/9] x86/PVH: permit more physdevop-s to be used by Dom0

2021-09-21 Thread Jan Beulich
Certain notifications of Dom0 to Xen are independent of the mode Dom0 is running in. Permit further PCI related ones (only their modern forms). Also include the USB2 debug port operation at this occasion. Signed-off-by: Jan Beulich --- I'm uncertain about the has_vpci() part of the check: I would

[PATCH v3 4/9] x86/PVH: provide VGA console info to Dom0

2021-09-21 Thread Jan Beulich
Like PV Dom0 in order to use the console if in a mode other than text 80x25 the kernel needs to be provided information about this mode. Bump HVM start info's "current" version to 2 and use a previously reserved 32-bit field to provide struct dom0_vga_console_info's position and size. Signed-off-b

[PATCH v3 5/9] x86/PVH: actually show Dom0's register state from debug key '0'

2021-09-21 Thread Jan Beulich
vcpu_show_registers() didn't do anything for HVM so far. Note though that some extra hackery is needed for VMX - see the code comment. Note further that the show_guest_stack() invocation is left alone here: While strictly speaking guest_kernel_mode() should be predicated by a PV / !HVM check, show

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

2021-09-21 Thread Jan Beulich
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 --- Altern

[PATCH v3 7/9] x86/PVH: actually show Dom0's stacks from debug key '0'

2021-09-21 Thread Jan Beulich
show_guest_stack() does nothing for HVM. Introduce a HVM-specific dumping function, paralleling the 64- and 32-bit PV ones. We don't know the real stack size, so only dump up to the next page boundary. Rather than adding a vcpu parameter to hvm_copy_from_guest_linear(), introduce hvm_copy_from_vcp

[PATCH v3 8/9] x86/HVM: skip offline vCPU-s when dumping VMCBs/VMCSes

2021-09-21 Thread Jan Beulich
There's not really any register state associated with offline vCPU-s, so avoid spamming the log with largely useless information while still leaving an indication of the fact. Signed-off-by: Jan Beulich --- v2: New. --- a/xen/arch/x86/hvm/svm/vmcb.c +++ b/xen/arch/x86/hvm/svm/vmcb.c @@ -242,6 +2

[PATCH v3 9/9] x86/P2M: relax permissions of PVH Dom0's MMIO entries

2021-09-21 Thread Jan Beulich
To become independent of the sequence of mapping operations, permit "access" to accumulate for Dom0, noting that there's not going to be an introspection agent for it which this might interfere with. While e.g. ideally only ROM regions would get mapped with X set, getting there is quite a bit of wo

Re: [PATCH v7 1/8] AMD/IOMMU: check / convert IVMD ranges for being / to be reserved

2021-09-21 Thread Jan Beulich
On 26.08.2021 14:31, Jan Beulich wrote: > On 26.08.2021 14:10, Andrew Cooper wrote: >> On 26/08/2021 08:23, Jan Beulich wrote: >>> While the specification doesn't say so, just like for VT-d's RMRRs no >>> good can come from these ranges being e.g. conventional RAM or entirely >>> unmarked and hence

Re: [PATCH v2] xen/x86: fix PV trap handling on secondary processors

2021-09-21 Thread Juergen Gross
On 20.09.21 18:15, Jan Beulich wrote: The initial observation was that in PV mode under Xen 32-bit user space didn't work anymore. Attempts of system calls ended in #GP(0x402). All of the sudden the vector 0x80 handler was not in place anymore. As it turns out up to 5.13 redundant initialization

Re: [PATCH] x86/xen: remove unneeded preempt_disable() from xen_irq_enable()

2021-09-21 Thread Jan Beulich
On 21.09.2021 09:02, Juergen Gross wrote: > --- a/arch/x86/xen/irq.c > +++ b/arch/x86/xen/irq.c > @@ -57,24 +57,20 @@ asmlinkage __visible void xen_irq_enable(void) > { > struct vcpu_info *vcpu; > > - /* > - * We may be preempted as soon as vcpu->evtchn_upcall_mask is > - * c

Re: [PATCH] xen-pciback: allow compiling on other archs than x86

2021-09-21 Thread Juergen Gross
On 17.09.21 15:01, Oleksandr Andrushchenko wrote: From: Oleksandr Andrushchenko Xen-pciback driver was designed to be built for x86 only. But it can also be used by other architectures, e.g. Arm. Re-structure the driver in a way that it can be built for other platforms as well. Signed-off-by:

Re: [PATCH] x86: drop a bogus SHARED_M2P() check from Dom0 building code

2021-09-21 Thread Roger Pau Monné
Could you explicitly mention PV somewhere in the subject? On Mon, Jun 28, 2021 at 01:52:52PM +0200, Jan Beulich wrote: > If anything, a check covering a wider range of invalid M2P entries ought > to be used (e.g. VALID_M2P()). But since everything is fully under Xen's > control at this stage, simp

Re: Ping²: [PATCH] x86: drop a bogus SHARED_M2P() check from Dom0 building code

2021-09-21 Thread Roger Pau Monné
On Tue, Sep 21, 2021 at 08:10:12AM +0200, Jan Beulich wrote: > On 06.07.2021 09:37, Jan Beulich wrote: > > On 28.06.2021 13:52, Jan Beulich wrote: > >> If anything, a check covering a wider range of invalid M2P entries ought > >> to be used (e.g. VALID_M2P()). But since everything is fully under Xe

Re: Ping²: [PATCH] x86: drop a bogus SHARED_M2P() check from Dom0 building code

2021-09-21 Thread Jan Beulich
On 21.09.2021 09:55, Roger Pau Monné wrote: > On Tue, Sep 21, 2021 at 08:10:12AM +0200, Jan Beulich wrote: >> On 06.07.2021 09:37, Jan Beulich wrote: >>> On 28.06.2021 13:52, Jan Beulich wrote: If anything, a check covering a wider range of invalid M2P entries ought to be used (e.g. VALID

Re: [PATCH] x86/xen: remove unneeded preempt_disable() from xen_irq_enable()

2021-09-21 Thread Juergen Gross
On 21.09.21 09:53, Jan Beulich wrote: On 21.09.2021 09:02, Juergen Gross wrote: --- a/arch/x86/xen/irq.c +++ b/arch/x86/xen/irq.c @@ -57,24 +57,20 @@ asmlinkage __visible void xen_irq_enable(void) { struct vcpu_info *vcpu; - /* -* We may be preempted as soon as vcpu->evtchn

Re: [PATCH] xen-pciback: allow compiling on other archs than x86

2021-09-21 Thread Oleksandr Andrushchenko
On 21.09.21 10:54, Juergen Gross wrote: > On 17.09.21 15:01, Oleksandr Andrushchenko wrote: >> From: Oleksandr Andrushchenko >> >> Xen-pciback driver was designed to be built for x86 only. But it >> can also be used by other architectures, e.g. Arm. >> Re-structure the driver in a way that it can

Ping: [PATCH] common: guest_physmap_add_page()'s return value needs checking

2021-09-21 Thread Jan Beulich
On 01.09.2021 18:06, Jan Beulich wrote: > The function may fail; it is not correct to indicate "success" in this > case up the call stack. Mark the function must-check to prove all > cases have been caught (and no new ones will get introduced). > > Signed-off-by: Jan Beulich > --- > In the grant-

Re: [PATCH] x86/xen: remove unneeded preempt_disable() from xen_irq_enable()

2021-09-21 Thread Jan Beulich
On 21.09.2021 09:58, Juergen Gross wrote: > On 21.09.21 09:53, Jan Beulich wrote: >> On 21.09.2021 09:02, Juergen Gross wrote: >>> --- a/arch/x86/xen/irq.c >>> +++ b/arch/x86/xen/irq.c >>> @@ -57,24 +57,20 @@ asmlinkage __visible void xen_irq_enable(void) >>> { >>> struct vcpu_info *vcpu; >>>

Re: [PATCH] x86/xen: remove unneeded preempt_disable() from xen_irq_enable()

2021-09-21 Thread Juergen Gross
On 21.09.21 10:11, Jan Beulich wrote: On 21.09.2021 09:58, Juergen Gross wrote: On 21.09.21 09:53, Jan Beulich wrote: On 21.09.2021 09:02, Juergen Gross wrote: --- a/arch/x86/xen/irq.c +++ b/arch/x86/xen/irq.c @@ -57,24 +57,20 @@ asmlinkage __visible void xen_irq_enable(void) { stru

Re: [PATCH] x86/xen: remove unneeded preempt_disable() from xen_irq_enable()

2021-09-21 Thread Peter Zijlstra
On Tue, Sep 21, 2021 at 09:02:26AM +0200, Juergen Gross wrote: > Disabling preemption in xen_irq_enable() is not needed. There is no > risk of missing events due to preemption, as preemption can happen > only in case an event is being received, which is just the opposite > of missing an event. > >

Re: [PATCH 1/2] gnttab: remove guest_physmap_remove_page() call from gnttab_map_frame()

2021-09-21 Thread Roger Pau Monné
On Mon, Sep 20, 2021 at 05:27:17PM +0200, Jan Beulich wrote: > On 20.09.2021 12:20, Roger Pau Monné wrote: > > On Mon, Sep 13, 2021 at 08:41:47AM +0200, Jan Beulich wrote: > >> --- a/xen/include/asm-arm/grant_table.h > >> +++ b/xen/include/asm-arm/grant_table.h > >> +if ( gfn_eq(ogfn, INVAL

Re: Dom0less + Argo enablement

2021-09-21 Thread Christopher Clark
On Mon, Sep 13, 2021 at 3:41 PM Stefano Stabellini wrote: > Hi all, > > This email is for anybody interested in using Argo with Dom0less setups > for domain-to-domain communications. > > Argo is a secure VM-to-VM communication mechanism based on hypercalls > [1]. It is a good fit for Dom0less set

Re: [PATCH] common: guest_physmap_add_page()'s return value needs checking

2021-09-21 Thread Roger Pau Monné
On Wed, Sep 01, 2021 at 06:06:37PM +0200, Jan Beulich wrote: > The function may fail; it is not correct to indicate "success" in this > case up the call stack. Mark the function must-check to prove all > cases have been caught (and no new ones will get introduced). > > Signed-off-by: Jan Beulich

Re: [PATCH 2/2] arm/efi: Use dom0less configuration when using EFI boot

2021-09-21 Thread Luca Fancellu
> On 17 Sep 2021, at 23:33, Stefano Stabellini wrote: > > On Fri, 17 Sep 2021, Luca Fancellu wrote: >>> On 16 Sep 2021, at 21:16, Stefano Stabellini wrote: >>> >>> On Thu, 16 Sep 2021, Jan Beulich wrote: On 16.09.2021 17:07, Luca Fancellu wrote: > I explain here my understanding on

Re: [PATCH] x86/xen: remove unneeded preempt_disable() from xen_irq_enable()

2021-09-21 Thread Juergen Gross
On 21.09.21 10:27, Peter Zijlstra wrote: On Tue, Sep 21, 2021 at 09:02:26AM +0200, Juergen Gross wrote: Disabling preemption in xen_irq_enable() is not needed. There is no risk of missing events due to preemption, as preemption can happen only in case an event is being received, which is just th

[qemu-mainline test] 165133: regressions - FAIL

2021-09-21 Thread osstest service owner
flight 165133 qemu-mainline real [real] flight 165138 qemu-mainline real-retest [real] http://logs.test-lab.xenproject.org/osstest/logs/165133/ http://logs.test-lab.xenproject.org/osstest/logs/165138/ Regressions :-( Tests which did not succeed and are blocking, including tests which could not be

Re: [PATCH 1/2] gnttab: remove guest_physmap_remove_page() call from gnttab_map_frame()

2021-09-21 Thread Jan Beulich
On 21.09.2021 10:32, Roger Pau Monné wrote: > On Mon, Sep 20, 2021 at 05:27:17PM +0200, Jan Beulich wrote: >> On 20.09.2021 12:20, Roger Pau Monné wrote: >>> On Mon, Sep 13, 2021 at 08:41:47AM +0200, Jan Beulich wrote: --- a/xen/include/asm-arm/grant_table.h +++ b/xen/include/asm-arm/gran

Re: [PATCH] common: guest_physmap_add_page()'s return value needs checking

2021-09-21 Thread Jan Beulich
On 21.09.2021 11:20, Roger Pau Monné wrote: > On Wed, Sep 01, 2021 at 06:06:37PM +0200, Jan Beulich wrote: >> The function may fail; it is not correct to indicate "success" in this >> case up the call stack. Mark the function must-check to prove all >> cases have been caught (and no new ones will g

Re: [PATCH] common: guest_physmap_add_page()'s return value needs checking

2021-09-21 Thread Roger Pau Monné
On Tue, Sep 21, 2021 at 12:28:12PM +0200, Jan Beulich wrote: > On 21.09.2021 11:20, Roger Pau Monné wrote: > > On Wed, Sep 01, 2021 at 06:06:37PM +0200, Jan Beulich wrote: > >> The function may fail; it is not correct to indicate "success" in this > >> case up the call stack. Mark the function must

Re: [PATCH] common: guest_physmap_add_page()'s return value needs checking

2021-09-21 Thread Ian Jackson
Roger Pau Monné writes ("Re: [PATCH] common: guest_physmap_add_page()'s return value needs checking"): > On Tue, Sep 21, 2021 at 12:28:12PM +0200, Jan Beulich wrote: > > On 21.09.2021 11:20, Roger Pau Monné wrote: > > > On Wed, Sep 01, 2021 at 06:06:37PM +0200, Jan Beulich wrote: > > >> The functi

Re: [PATCH v2 04/12] x86/hvm: Reduce stack usage from HVMTRACE_ND()

2021-09-21 Thread Jan Beulich
On 20.09.2021 19:25, Andrew Cooper wrote: > v2: > * Adjust callers of HVMTRACE_ND() too What does this refer to? The sole difference to v1 that I can spot is ... > * Drop _d[] for the 0 case. ... the one corresponding to this line, i.e. ... > --- a/xen/include/asm-x86/hvm/trace.h > +++ b/xen/

Re: [PATCH v2 09/12] xen/trace: Minor code cleanup

2021-09-21 Thread Jan Beulich
On 20.09.2021 19:25, Andrew Cooper wrote: > * Delete trailing whitespace > * Replace an opencoded DIV_ROUND_UP() > * Drop bogus smp_rmb() - spin_lock_irqsave() has full smp_mb() semantics. > > Signed-off-by: Andrew Cooper Like for v1: Largely Reviewed-by: Jan Beulich One remark: > @@ -717,9

[libvirt test] 165137: regressions - FAIL

2021-09-21 Thread osstest service owner
flight 165137 libvirt real [real] http://logs.test-lab.xenproject.org/osstest/logs/165137/ Regressions :-( Tests which did not succeed and are blocking, including tests which could not be run: build-amd64-libvirt 6 libvirt-buildfail REGR. vs. 151777 build-i386-libvirt

[linux-linus test] 165134: regressions - FAIL

2021-09-21 Thread osstest service owner
flight 165134 linux-linus real [real] http://logs.test-lab.xenproject.org/osstest/logs/165134/ Regressions :-( Tests which did not succeed and are blocking, including tests which could not be run: test-amd64-amd64-xl-pvshim 17 guest-saverestorefail REGR. vs. 152332 test-amd64-amd64-do

Re: [PATCH v2 05/12] x86/hvm: Remove duplicate calls caused by tracing

2021-09-21 Thread Jan Beulich
On 20.09.2021 19:25, Andrew Cooper wrote: > 1) vpic_ack_pending_irq() calls vlapic_accept_pic_intr() twice, once in the >TRACE_2D() instantiation and once "for real". Make the call only once. > > 2) vlapic_accept_pic_intr() similarly calls __vlapic_accept_pic_intr() twice, >although this

Re: [PATCH v1 11/14] xen/arm: Enable the existing x86 virtual PCI support for ARM.

2021-09-21 Thread Rahul Singh
Hi Stefano, > On 16 Sep 2021, at 9:26 pm, Stefano Stabellini wrote: > > On Thu, 16 Sep 2021, Rahul Singh wrote: >> Hi Stefano, >> >>> On 10 Sep 2021, at 1:26 am, Stefano Stabellini >>> wrote: >>> >>> On Thu, 19 Aug 2021, Rahul Singh wrote: The existing VPCI support available for X86 is

[xen-unstable test] 165136: regressions - FAIL

2021-09-21 Thread osstest service owner
flight 165136 xen-unstable real [real] flight 165141 xen-unstable real-retest [real] http://logs.test-lab.xenproject.org/osstest/logs/165136/ http://logs.test-lab.xenproject.org/osstest/logs/165141/ Regressions :-( Tests which did not succeed and are blocking, including tests which could not be r

Re: [PATCH] swiotlb: set IO TLB segment size via cmdline

2021-09-21 Thread Roman Skakun
Hi Robin, >> I use Xen PV display. In my case, PV display backend(Dom0) allocates >> contiguous buffer via DMA-API to >> to implement zero-copy between Dom0 and DomU. >> > Well, something's gone badly wrong there - if you have to shadow the > entire thing in a bounce buffer to import it then it's

Re: [PATCH v2 04/12] x86/hvm: Reduce stack usage from HVMTRACE_ND()

2021-09-21 Thread Andrew Cooper
On 21/09/2021 12:00, Jan Beulich wrote: > On 20.09.2021 19:25, Andrew Cooper wrote: >> v2: >> * Adjust callers of HVMTRACE_ND() too > What does this refer to? The sole difference to v1 that I can spot > is ... Oh - its me who was confused. I thought I had failed to include the changes in vmx.c/s

Re: [PATCH v2 04/12] x86/hvm: Reduce stack usage from HVMTRACE_ND()

2021-09-21 Thread Jan Beulich
On 21.09.2021 17:38, Andrew Cooper wrote: > On 21/09/2021 12:00, Jan Beulich wrote: >> On 20.09.2021 19:25, Andrew Cooper wrote: >>> v2: >>> * Adjust callers of HVMTRACE_ND() too >> What does this refer to? The sole difference to v1 that I can spot >> is ... > > Oh - its me who was confused. > >

[PATCH] x86/build: suppress EFI-related tool chain checks upon local $(MAKE) recursion

2021-09-21 Thread Jan Beulich
The xen-syms and xen.efi linking steps are serialized only when the intermediate note.o file is necessary. Otherwise both may run in parallel. This in turn means that the compiler / linker invocations to create efi/check.o / efi/check.efi may also happen twice in parallel. Obviously it's a bad idea

Re: [PATCH v2 10/12] x86/pv: Move x86/trace.c to x86/pv/trace.c

2021-09-21 Thread Jan Beulich
On 20.09.2021 19:25, Andrew Cooper wrote: > This entire file is pv-only, and not excluded from the build by > CONFIG_TRACEBUFFER. Move it into the pv/ directory, build it conditionally, > and drop unused includes. > > Also move the contents of asm/trace.h to asm/pv/trace.h to avoid the functions

Re: [PATCH v2 11/12] xen/arch: Drop asm-*/trace.h

2021-09-21 Thread Jan Beulich
On 20.09.2021 19:25, Andrew Cooper wrote: > The feature is x86 and pv-dom0 specific, and each architecture's main trace.h > files are empty. Don't force all new architectures to create an empty file. The first half sentence looks to be wrong according to Julien's reply to patch 16. But the change

Re: [PATCH v2 12/12] x86/trace: Clean up trace handling

2021-09-21 Thread Jan Beulich
On 20.09.2021 19:25, Andrew Cooper wrote: > Use more appropriate types. > > Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich with a suggestion: > @@ -48,30 +45,28 @@ void __trace_pv_page_fault(unsigned long addr, unsigned > error_code) > > if ( is_pv_32bit_vcpu(current) ) > {

Re: [PATCH v2 05/13] perf: Force architectures to opt-in to guest callbacks

2021-09-21 Thread Paolo Bonzini
On 28/08/21 21:47, Peter Zijlstra wrote: +config HAVE_GUEST_PERF_EVENTS + bool depends on HAVE_KVM It won't really do anything, since Kconfig does not detects conflicts between select' and 'depends on' clauses. Rather, should the symbol be selected by KVM, instead of ARM64 and

Re: [PATCH V2 3/3] libxl/arm: Add handling of extended regions for DomU

2021-09-21 Thread Oleksandr
Hi Stefano [snip] +static void finalise_ext_region(libxl__gc *gc, struct xc_dom_image *dom) +{ +    void *fdt = dom->devicetree_blob; +    uint32_t regs[(GUEST_ROOT_ADDRESS_CELLS + GUEST_ROOT_SIZE_CELLS) * 2]; +    be32 *cells = ®s[0]; +    uint64_t region_size = 0, region_base, ban

Re: [PATCH v2 01/12] xen/trace: Don't over-read trace objects

2021-09-21 Thread Andrew Cooper
On 21/09/2021 07:53, Jan Beulich wrote: > On 20.09.2021 19:25, Andrew Cooper wrote: >> In the case that 'extra' isn't a multiple of uint32_t, the calculation rounds >> the number of bytes up, causing later logic to read unrelated bytes beyond >> the >> end of the object. >> >> Also, asserting that

Re: [PATCH v2 05/12] x86/hvm: Remove duplicate calls caused by tracing

2021-09-21 Thread Andrew Cooper
On 21/09/2021 13:18, Jan Beulich wrote: > On 20.09.2021 19:25, Andrew Cooper wrote: >> 1) vpic_ack_pending_irq() calls vlapic_accept_pic_intr() twice, once in the >>TRACE_2D() instantiation and once "for real". Make the call only once. >> >> 2) vlapic_accept_pic_intr() similarly calls __vlapic

Re: [PATCH V2 2/3] xen/arm: Add handling of extended regions for Dom0

2021-09-21 Thread Oleksandr
On 21.09.21 02:21, Stefano Stabellini wrote: Hi Stefano On Sun, 19 Sep 2021, Oleksandr wrote: On 18/09/2021 03:37, Stefano Stabellini wrote: On Fri, 17 Sep 2021, Stefano Stabellini wrote: On Fri, 17 Sep 2021, Oleksandr wrote: + +    dt_dprintk("Find unallocated memory for extended regions

Re: [PATCH v2 12/12] x86/trace: Clean up trace handling

2021-09-21 Thread Andrew Cooper
On 21/09/2021 17:08, Jan Beulich wrote: > On 20.09.2021 19:25, Andrew Cooper wrote: >> Use more appropriate types. >> >> Signed-off-by: Andrew Cooper > Reviewed-by: Jan Beulich Thanks. > with a suggestion: > >> @@ -48,30 +45,28 @@ void __trace_pv_page_fault(unsigned long addr, unsigned >> erro

Re: [PATCH V2 2/3] xen/arm: Add handling of extended regions for Dom0

2021-09-21 Thread Oleksandr
On 18.09.21 00:56, Stefano Stabellini wrote: Hi Stefano On Fri, 17 Sep 2021, Oleksandr wrote: + +    dt_dprintk("Find unallocated memory for extended regions\n"); + +    unalloc_mem = rangeset_new(NULL, NULL, 0); +    if ( !unalloc_mem ) +    return -ENOMEM; + +    /* Start with all avai

Re: [PATCH v2.1 RFC 17/12] xen/trace: Drop cycles parameter

2021-09-21 Thread Andrew Cooper
Not a patch, but an RFC idea for one... It occurred to me that the cycles parameter from __trace_var() and friends is pointless, as the cycles bit is encoded in the top bit of the event field anyway, and passed in the adjacent parameter. Dropping the cycles parameter results in +85/-1029 (-944) n

[qemu-mainline test] 165139: regressions - FAIL

2021-09-21 Thread osstest service owner
flight 165139 qemu-mainline real [real] flight 165144 qemu-mainline real-retest [real] http://logs.test-lab.xenproject.org/osstest/logs/165139/ http://logs.test-lab.xenproject.org/osstest/logs/165144/ Regressions :-( Tests which did not succeed and are blocking, including tests which could not be

Re: [PATCH] xen-pciback: allow compiling on other archs than x86

2021-09-21 Thread Stefano Stabellini
On Tue, 21 Sep 2021, Oleksandr Andrushchenko wrote: > On 21.09.21 10:09, Juergen Gross wrote: > > On 21.09.21 09:00, Oleksandr Andrushchenko wrote: > >> > >> On 21.09.21 09:49, Juergen Gross wrote: > >>> On 21.09.21 08:38, Oleksandr Andrushchenko wrote: > > On 21.09.21 09:07, Juergen Gros

Re: [PATCH v2 05/13] perf: Force architectures to opt-in to guest callbacks

2021-09-21 Thread Sean Christopherson
On Tue, Sep 21, 2021, Paolo Bonzini wrote: > On 28/08/21 21:47, Peter Zijlstra wrote: > > > +config HAVE_GUEST_PERF_EVENTS > > > + bool > > depends on HAVE_KVM > > It won't really do anything, since Kconfig does not detects conflicts > between select' and 'depends on' clauses. It does throw a

Re: [PATCH 2/2] arm/efi: Use dom0less configuration when using EFI boot

2021-09-21 Thread Stefano Stabellini
On Tue, 21 Sep 2021, Luca Fancellu wrote: > > On 17 Sep 2021, at 23:33, Stefano Stabellini wrote: > > On Fri, 17 Sep 2021, Luca Fancellu wrote: > >>> On 16 Sep 2021, at 21:16, Stefano Stabellini > >>> wrote: > >>> > >>> On Thu, 16 Sep 2021, Jan Beulich wrote: > On 16.09.2021 17:07, Luca Fa

Re: [PATCH v1 11/14] xen/arm: Enable the existing x86 virtual PCI support for ARM.

2021-09-21 Thread Stefano Stabellini
On Tue, 21 Sep 2021, Rahul Singh wrote: > Hi Stefano, > > > On 16 Sep 2021, at 9:26 pm, Stefano Stabellini > > wrote: > > > > On Thu, 16 Sep 2021, Rahul Singh wrote: > >> Hi Stefano, > >> > >>> On 10 Sep 2021, at 1:26 am, Stefano Stabellini > >>> wrote: > >>> > >>> On Thu, 19 Aug 2021, Rahu

[linux-linus test] 165140: regressions - FAIL

2021-09-21 Thread osstest service owner
flight 165140 linux-linus real [real] http://logs.test-lab.xenproject.org/osstest/logs/165140/ Regressions :-( Tests which did not succeed and are blocking, including tests which could not be run: test-amd64-amd64-xl-pvshim 17 guest-saverestorefail REGR. vs. 152332 test-amd64-amd64-do

Re: [PATCH V2 2/3] xen/arm: Add handling of extended regions for Dom0

2021-09-21 Thread Stefano Stabellini
On Tue, 21 Sep 2021, Oleksandr wrote: > On 21.09.21 02:21, Stefano Stabellini wrote: > > On Sun, 19 Sep 2021, Oleksandr wrote: > > > > On 18/09/2021 03:37, Stefano Stabellini wrote: > > > > > On Fri, 17 Sep 2021, Stefano Stabellini wrote: > > > > > > On Fri, 17 Sep 2021, Oleksandr wrote: > > > > >

Re: [SPECIFICATION RFC v3] The firmware and bootloader log specification

2021-09-21 Thread Julius Werner
> Since it doesn't seem possible to have each boot component using the same log > format, we added a log_format and log_phys_addr fields to give flexibility in > how logs are stored. An example of a different log format that can be used is > the cbmem_console log format used by coreboot: I am not

[xen-unstable-smoke test] 165143: tolerable all pass - PUSHED

2021-09-21 Thread osstest service owner
flight 165143 xen-unstable-smoke real [real] http://logs.test-lab.xenproject.org/osstest/logs/165143/ Failures :-/ but no regressions. Tests which did not succeed, but are not blocking: test-amd64-amd64-libvirt 15 migrate-support-checkfail never pass test-arm64-arm64-xl-xsm 1

Re: [PATCH V10 01/18] perf/core: Use static_call to optimize perf_guest_info_callbacks

2021-09-21 Thread Sean Christopherson
On Wed, Sep 15, 2021, Zhu, Lingshan wrote: > > > On 8/27/2021 3:59 AM, Sean Christopherson wrote: > > TL;DR: Please don't merge this patch, it's broken and is also built on a > > shoddy > > foundation that I would like to fix. > Hi Sean,Peter, Paolo > > I will send out an V11 which drop

Re: [xen-unstable test] 164996: regressions - FAIL

2021-09-21 Thread Stefano Stabellini
On Mon, 20 Sep 2021, Ian Jackson wrote: > Jan Beulich writes ("Re: [xen-unstable test] 164996: regressions - FAIL"): > > As per > > > > Sep 15 14:44:55.502598 [ 1613.322585] Mem-Info: > > Sep 15 14:44:55.502643 [ 1613.324918] active_anon:5639 inactive_anon:15857 > > isolated_anon:0 > > Sep 15 14:

[PATCH v3 01/16] perf: Ensure perf_guest_cbs aren't reloaded between !NULL check and deref

2021-09-21 Thread Sean Christopherson
Protect perf_guest_cbs with READ_ONCE/WRITE_ONCE to ensure it's not reloaded between a !NULL check and a dereference, and wait for all readers via syncrhonize_rcu() to prevent use-after-free, e.g. if the callbacks are being unregistered during module unload. Because the callbacks are global, it's

[PATCH v3 00/16] perf: KVM: Fix, optimize, and clean up callbacks

2021-09-21 Thread Sean Christopherson
Peter, I left the Intel PT mess as-is. Having to pass a NULL pointer from KVM arm64 seemed to be a lesser evil than more exports and multiple registration paths. This is a combination of ~2 series to fix bugs in the perf+KVM callbacks, optimize the callbacks by employing static_call, and do a var

[PATCH v3 02/16] KVM: x86: Register perf callbacks after calling vendor's hardware_setup()

2021-09-21 Thread Sean Christopherson
Wait to register perf callbacks until after doing vendor hardaware setup. VMX's hardware_setup() configures Intel Processor Trace (PT) mode, and a future fix to register the Intel PT guest interrupt hook if and only if Intel PT is exposed to the guest will consume the configured PT mode. Delaying

[PATCH v3 03/16] KVM: x86: Register Processor Trace interrupt hook iff PT enabled in guest

2021-09-21 Thread Sean Christopherson
Override the Processor Trace (PT) interrupt handler for guest mode if and only if PT is configured for host+guest mode, i.e. is being used independently by both host and guest. If PT is configured for system mode, the host fully controls PT and must handle all events. Fixes: 8479e04e7d6b ("KVM: x

[PATCH v3 04/16] perf: Stop pretending that perf can handle multiple guest callbacks

2021-09-21 Thread Sean Christopherson
Drop the 'int' return value from the perf (un)register callbacks helpers and stop pretending perf can support multiple callbacks. The 'int' returns are not future proofing anything as none of the callers take action on an error. It's also not obvious that there will ever be co-tenant hypervisors,

[PATCH v3 05/16] perf: Drop dead and useless guest "support" from arm, csky, nds32 and riscv

2021-09-21 Thread Sean Christopherson
Drop "support" for guest callbacks from architctures that don't implement the guest callbacks. Future patches will convert the callbacks to static_call; rather than churn a bunch of arch code (that was presumably copy+pasted from x86), remove it wholesale as it's useless and at best wasting cycles

[PATCH v3 06/16] perf/core: Rework guest callbacks to prepare for static_call support

2021-09-21 Thread Sean Christopherson
From: Like Xu To prepare for using static_calls to optimize perf's guest callbacks, replace ->is_in_guest and ->is_user_mode with a new multiplexed hook ->state, tweak ->handle_intel_pt_intr to play nice with being called when there is no active guest, and drop "guest" from ->is_in_guest. Return

[PATCH v3 07/16] perf: Add wrappers for invoking guest callbacks

2021-09-21 Thread Sean Christopherson
Add helpers for the guest callbacks to prepare for burying the callbacks behind a Kconfig (it's a lot easier to provide a few stubs than to #ifdef piles of code), and also to prepare for converting the callbacks to static_call(). perf_instruction_pointer() in particular will have subtle semantics

[PATCH v3 09/16] perf/core: Use static_call to optimize perf_guest_info_callbacks

2021-09-21 Thread Sean Christopherson
Use static_call to optimize perf's guest callbacks on arm64 and x86, which are now the only architectures that define the callbacks. Use DEFINE_STATIC_CALL_RET0 as the default/NULL for all guest callbacks, as the callback semantics are that a return value '0' means "not in guest". static_call obv

[PATCH v3 08/16] perf: Force architectures to opt-in to guest callbacks

2021-09-21 Thread Sean Christopherson
Introduce GUEST_PERF_EVENTS and require architectures to select it to allow registering and using guest callbacks in perf. This will hopefully make it more difficult for new architectures to add useless "support" for guest callbacks, e.g. via copy+paste. Stubbing out the helpers has the happy bon

[PATCH v3 10/16] KVM: x86: Drop current_vcpu for kvm_running_vcpu + kvm_arch_vcpu variable

2021-09-21 Thread Sean Christopherson
Use the generic kvm_running_vcpu plus a new 'handling_intr_from_guest' variable in kvm_arch_vcpu instead of the semi-redundant current_vcpu. kvm_before/after_interrupt() must be called while the vCPU is loaded, (which protects against preemption), thus kvm_running_vcpu is guaranteed to be non-NULL

[PATCH v3 13/16] KVM: x86: Move Intel Processor Trace interrupt handler to vmx.c

2021-09-21 Thread Sean Christopherson
Now that all state needed for VMX's PT interrupt handler is exposed to vmx.c (specifically the currently running vCPU), move the handler into vmx.c where it belongs. Signed-off-by: Sean Christopherson --- arch/x86/include/asm/kvm_host.h | 2 +- arch/x86/kvm/vmx/vmx.c | 22 +

[PATCH v3 11/16] KVM: x86: More precisely identify NMI from guest when handling PMI

2021-09-21 Thread Sean Christopherson
Differntiate between IRQ and NMI for KVM's PMC overflow callback, which was originally invoked in response to an NMI that arrived while the guest was running, but was inadvertantly changed to fire on IRQs as well when support for perf without PMU/NMI was added to KVM. In practice, this should be a

[PATCH v3 15/16] KVM: arm64: Drop perf.c and fold its tiny bits of code into arm.c / pmu.c

2021-09-21 Thread Sean Christopherson
Call KVM's (un)register perf callbacks helpers directly from arm.c, and move the PMU bits into pmu.c and rename the related helper accordingly. Signed-off-by: Sean Christopherson --- arch/arm64/include/asm/kvm_host.h | 3 --- arch/arm64/kvm/Makefile | 2 +- arch/arm64/kvm/arm.c

[PATCH v3 12/16] KVM: Move x86's perf guest info callbacks to generic KVM

2021-09-21 Thread Sean Christopherson
Move x86's perf guest callbacks into common KVM, as they are semantically identical to arm64's callbacks (the only other such KVM callbacks). arm64 will convert to the common versions in a future patch. Implement the necessary arm64 arch hooks now to avoid having to provide stubs or a temporary #d

[PATCH v3 16/16] perf: Drop guest callback (un)register stubs

2021-09-21 Thread Sean Christopherson
Drop perf's stubs for (un)registering guest callbacks now that KVM registration of callbacks is hidden behind GUEST_PERF_EVENTS=y. The only other user is x86 XEN_PV, and x86 unconditionally selects PERF_EVENTS. No functional change intended. Signed-off-by: Sean Christopherson --- include/linux

[PATCH v3 14/16] KVM: arm64: Convert to the generic perf callbacks

2021-09-21 Thread Sean Christopherson
Drop arm64's version of the callbacks in favor of the callbacks provided by generic KVM, which are semantically identical. Signed-off-by: Sean Christopherson --- arch/arm64/kvm/perf.c | 34 ++ 1 file changed, 2 insertions(+), 32 deletions(-) diff --git a/arch/arm

[xen-unstable test] 165142: regressions - FAIL

2021-09-21 Thread osstest service owner
flight 165142 xen-unstable real [real] flight 165146 xen-unstable real-retest [real] http://logs.test-lab.xenproject.org/osstest/logs/165142/ http://logs.test-lab.xenproject.org/osstest/logs/165146/ Regressions :-( Tests which did not succeed and are blocking, including tests which could not be r

Re: [SPECIFICATION RFC v3] The firmware and bootloader log specification

2021-09-21 Thread Peter Stuge
Alec Brown wrote: > Below is how the layout of these logs would store their data. > > bf_log_header: >+---+ > u32| version | > u32| size | > u8[64] | producer | > u8[64] | log_format| >

Re: [PATCH v3 02/16] KVM: x86: Register perf callbacks after calling vendor's hardware_setup()

2021-09-21 Thread Paolo Bonzini
On 22/09/21 02:05, Sean Christopherson wrote: Wait to register perf callbacks until after doing vendor hardaware setup. VMX's hardware_setup() configures Intel Processor Trace (PT) mode, and a future fix to register the Intel PT guest interrupt hook if and only if Intel PT is exposed to the guest

Re: [PATCH v3 03/16] KVM: x86: Register Processor Trace interrupt hook iff PT enabled in guest

2021-09-21 Thread Paolo Bonzini
On 22/09/21 02:05, Sean Christopherson wrote: Override the Processor Trace (PT) interrupt handler for guest mode if and only if PT is configured for host+guest mode, i.e. is being used independently by both host and guest. If PT is configured for system mode, the host fully controls PT and must

Re: [PATCH v3 04/16] perf: Stop pretending that perf can handle multiple guest callbacks

2021-09-21 Thread Paolo Bonzini
On 22/09/21 02:05, Sean Christopherson wrote: Drop the 'int' return value from the perf (un)register callbacks helpers and stop pretending perf can support multiple callbacks. The 'int' returns are not future proofing anything as none of the callers take action on an error. It's also not obviou

Re: [PATCH v3 05/16] perf: Drop dead and useless guest "support" from arm, csky, nds32 and riscv

2021-09-21 Thread Paolo Bonzini
On 22/09/21 02:05, Sean Christopherson wrote: Drop "support" for guest callbacks from architctures that don't implement the guest callbacks. Future patches will convert the callbacks to static_call; rather than churn a bunch of arch code (that was presumably copy+pasted from x86), remove it whol

Re: [PATCH v3 06/16] perf/core: Rework guest callbacks to prepare for static_call support

2021-09-21 Thread Paolo Bonzini
On 22/09/21 02:05, Sean Christopherson wrote: To prepare for using static_calls to optimize perf's guest callbacks, replace ->is_in_guest and ->is_user_mode with a new multiplexed hook ->state, tweak ->handle_intel_pt_intr to play nice with being called when there is no active guest, and drop "gu

Re: [PATCH v3 16/16] perf: Drop guest callback (un)register stubs

2021-09-21 Thread Paolo Bonzini
On 22/09/21 02:05, Sean Christopherson wrote: Drop perf's stubs for (un)registering guest callbacks now that KVM registration of callbacks is hidden behind GUEST_PERF_EVENTS=y. The only other user is x86 XEN_PV, and x86 unconditionally selects PERF_EVENTS. No functional change intended. Signed

Re: [PATCH v3 07/16] perf: Add wrappers for invoking guest callbacks

2021-09-21 Thread Paolo Bonzini
On 22/09/21 02:05, Sean Christopherson wrote: Add helpers for the guest callbacks to prepare for burying the callbacks behind a Kconfig (it's a lot easier to provide a few stubs than to #ifdef piles of code), and also to prepare for converting the callbacks to static_call(). perf_instruction_poi

Re: [PATCH v3 08/16] perf: Force architectures to opt-in to guest callbacks

2021-09-21 Thread Paolo Bonzini
On 22/09/21 02:05, Sean Christopherson wrote: Introduce GUEST_PERF_EVENTS and require architectures to select it to allow registering and using guest callbacks in perf. This will hopefully make it more difficult for new architectures to add useless "support" for guest callbacks, e.g. via copy+pa

Re: [PATCH v3 09/16] perf/core: Use static_call to optimize perf_guest_info_callbacks

2021-09-21 Thread Paolo Bonzini
On 22/09/21 02:05, Sean Christopherson wrote: Use static_call to optimize perf's guest callbacks on arm64 and x86, which are now the only architectures that define the callbacks. Use DEFINE_STATIC_CALL_RET0 as the default/NULL for all guest callbacks, as the callback semantics are that a return

Re: [PATCH v3 11/16] KVM: x86: More precisely identify NMI from guest when handling PMI

2021-09-21 Thread Paolo Bonzini
On 22/09/21 02:05, Sean Christopherson wrote: Note, this also doesn't completely prevent false positives if perf somehow ends up calling into KVM, e.g. an NMI can arrive in host after KVM sets its flag. s/calling into KVM/being called from KVM/ ? Not sure about what you meant though. The code

Re: [PATCH v3 10/16] KVM: x86: Drop current_vcpu for kvm_running_vcpu + kvm_arch_vcpu variable

2021-09-21 Thread Paolo Bonzini
On 22/09/21 02:05, Sean Christopherson wrote: Use the generic kvm_running_vcpu plus a new 'handling_intr_from_guest' variable in kvm_arch_vcpu instead of the semi-redundant current_vcpu. kvm_before/after_interrupt() must be called while the vCPU is loaded, (which protects against preemption), thu

  1   2   >