Re: [Xen-devel] [PATCH v9 12/15] microcode: reduce memory allocation and copy when creating a patch
On Fri, Aug 23, 2019 at 10:11:21AM +0200, Roger Pau Monné wrote: >On Mon, Aug 19, 2019 at 09:25:25AM +0800, Chao Gao wrote: >> To create a microcode patch from a vendor-specific update, >> allocate_microcode_patch() copied everything from the update. >> It is not efficient. Essentially, we just need to go through >> ucodes in the blob, find the one with the newest revision and >> install it into the microcode_patch. In the process, buffers >> like mc_amd, equiv_cpu_table (on AMD side), and mc (on Intel >> side) can be reused. microcode_patch now is allocated after >> it is sure that there is a matching ucode. > >Oh, I think this answers my question on a previous patch. > >For future series it would be nice to avoid so many rewrites in the >same series, alloc_microcode_patch is already modified in a previous >patch, just to be removed here. It also makes it harder to follow >what's going on. Got it. This patch is added in this new version. And some trivial patches already got reviewed-by. So I don't merge it with them. >> while ( (error = get_ucode_from_buffer_amd(mc_amd, buf, bufsize, >> &offset)) == 0 ) >> { >> -struct microcode_patch *new_patch = alloc_microcode_patch(mc_amd); >> - >> -if ( IS_ERR(new_patch) ) >> -{ >> -error = PTR_ERR(new_patch); >> -break; >> -} >> - >> /* >> - * If the new patch covers current CPU, compare patches and store >> the >> + * If the new ucode covers current CPU, compare ucodes and store the >> * one with higher revision. >> */ >> -if ( (microcode_fits(new_patch->mc_amd) != MIS_UCODE) && >> - (!patch || (compare_patch(new_patch, patch) == NEW_UCODE)) ) >> +#define REV_ID(mpb) (((struct microcode_header_amd >> *)(mpb))->processor_rev_id) >> +if ( (microcode_fits(mc_amd) != MIS_UCODE) && >> + (!saved || (REV_ID(mc_amd->mpb) > REV_ID(saved))) ) >> +#undef REV_ID >> { >> -struct microcode_patch *tmp = patch; >> - >> -patch = new_patch; >> -new_patch = tmp; >> +xfree(saved); >> +saved = mc_amd->mpb; >> +saved_size = mc_amd->mpb_size; >> } >> - >> -if ( new_patch ) >> -microcode_free_patch(new_patch); >> +else >> +xfree(mc_amd->mpb); It might be better to move 'mc_amd->mpb = NULL' here. >> >> if ( offset >= bufsize ) >> break; >> @@ -593,9 +548,25 @@ static struct microcode_patch >> *cpu_request_microcode(const void *buf, >> *(const uint32_t *)(buf + offset) == UCODE_MAGIC ) >> break; >> } >> -xfree(mc_amd->mpb); >> -xfree(mc_amd->equiv_cpu_table); >> -xfree(mc_amd); >> + >> +if ( saved ) >> +{ >> +mc_amd->mpb = saved; >> +mc_amd->mpb_size = saved_size; >> +patch = xmalloc(struct microcode_patch); >> +if ( patch ) >> +patch->mc_amd = mc_amd; >> +else >> +{ >> +free_patch(mc_amd); >> +error = -ENOMEM; >> +} >> +} >> +else >> +{ >> +mc_amd->mpb = NULL; > >What's the point in setting mpb to NULL if you are just going to free >mc_amd below? To avoid double free here. mc_amd->mpb is always freed or saved. And here we want to free mc_amd itself and mc_amd->equiv_cpu_table. > >Also, I'm not sure I understand why you need to free mc_amd, isn't >this buff memory that should be freed by the caller? But mc_amd is allocated in this function. > >ie: in the Intel counterpart below you don't seem to free the mc >cursor used for the get_next_ucode_from_buffer loop. 'mc' is saved if it is newer than current patch stored in 'saved'. Otherwise 'mc' is freed immediately. So we don't need to free it again after the while loop. Thanks Chao ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [RFC PATCH v2 1/3] x86/mm/tlb: Change __flush_tlb_one_user interface
On 24.08.19 00:52, Nadav Amit wrote: __flush_tlb_one_user() currently flushes a single entry, and flushes it both in the kernel and user page-tables, when PTI is enabled. Change __flush_tlb_one_user() and related interfaces into __flush_tlb_range() that flushes a range and does not flush the user page-table. This refactoring is needed for the next patch, but regardless makes sense and has several advantages. First, only Xen-PV, which does not use PTI, implements the paravirtual interface of flush_tlb_one_user() so nothing is broken by separating the user and kernel page-table flushes, and the interface is more intuitive. Second, INVLPG can flush unrelated mappings, and it is also a serializing instruction. It is better to have a tight loop that flushes the entries. Third, currently __flush_tlb_one_kernel() also flushes the user page-tables, which is not needed. This allows to avoid this redundant flush. Cc: Boris Ostrovsky Cc: Juergen Gross Cc: Stefano Stabellini Cc: xen-devel@lists.xenproject.org Signed-off-by: Nadav Amit --- arch/x86/include/asm/paravirt.h | 5 ++-- arch/x86/include/asm/paravirt_types.h | 3 ++- arch/x86/include/asm/tlbflush.h | 24 + arch/x86/kernel/paravirt.c| 7 ++--- arch/x86/mm/tlb.c | 39 ++- arch/x86/xen/mmu_pv.c | 21 +-- 6 files changed, 62 insertions(+), 37 deletions(-) ... diff --git a/arch/x86/xen/mmu_pv.c b/arch/x86/xen/mmu_pv.c index 48f7c7eb4dbc..ed68657f5e77 100644 --- a/arch/x86/xen/mmu_pv.c +++ b/arch/x86/xen/mmu_pv.c @@ -1325,22 +1325,27 @@ static noinline void xen_flush_tlb(void) preempt_enable(); } -static void xen_flush_tlb_one_user(unsigned long addr) +static void xen_flush_tlb_range(unsigned long start, unsigned long end, + u8 stride_shift) { struct mmuext_op *op; struct multicall_space mcs; - - trace_xen_mmu_flush_tlb_one_user(addr); + unsigned long addr; preempt_disable(); mcs = xen_mc_entry(sizeof(*op)); op = mcs.args; - op->cmd = MMUEXT_INVLPG_LOCAL; - op->arg1.linear_addr = addr & PAGE_MASK; - MULTI_mmuext_op(mcs.mc, op, 1, NULL, DOMID_SELF); - xen_mc_issue(PARAVIRT_LAZY_MMU); + for (addr = start; addr < end; addr += 1ul << stride_shift) { + trace_xen_mmu_flush_tlb_one_user(addr); + + op->cmd = MMUEXT_INVLPG_LOCAL; + op->arg1.linear_addr = addr & PAGE_MASK; + MULTI_mmuext_op(mcs.mc, op, 1, NULL, DOMID_SELF); + + xen_mc_issue(PARAVIRT_LAZY_MMU); + } For this kind of usage (a loop) you should: - replace the call of xen_mc_entry() with xen_mc_batch() - use xen_extend_mmuext_op() for each loop iteration - call xen_mc_issue() after the loop Additionally I'd like you to replace trace_xen_mmu_flush_tlb_one_user() with trace_xen_mmu_flush_tlb_range() taking all three parameters and keep it where it was (out of the loop). The paravirt parts seem to be okay. Juergen ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH v9 15/15] microcode: block #NMI handling when loading an ucode
On Fri, Aug 23, 2019 at 09:46:37AM +0100, Sergey Dyasli wrote: >On 19/08/2019 02:25, Chao Gao wrote: >> register an nmi callback. And this callback does busy-loop on threads >> which are waiting for loading completion. Control threads send NMI to >> slave threads to prevent NMI acceptance during ucode loading. >> >> Signed-off-by: Chao Gao >> --- >> Changes in v9: >> - control threads send NMI to all other threads. Slave threads will >> stay in the NMI handling to prevent NMI acceptance during ucode >> loading. Note that self-nmi is invalid according to SDM. > >To me this looks like a half-measure: why keep only slave threads in >the NMI handler, when master threads can update the microcode from >inside the NMI handler as well? No special reason. Because the issue we want to address is that slave threads might go to handle NMI and access MSRs when master thread is loading ucode. So we only keep slave threads in the NMI handler. > >You mention that self-nmi is invalid, but Xen has self_nmi() which is >used for apply_alternatives() during boot, so can be trusted to work. Sorry, I meant using self shorthand to send self-nmi. I tried to use self shorthand but got APIC error. And I agree that it is better to make slave thread call self_nmi() itself. > >I experimented a bit with the following approach: after loading_state >becomes LOADING_CALLIN, each cpu issues a self_nmi() and rendezvous >via cpu_callin_map into LOADING_ENTER to do a ucode update directly in >the NMI handler. And it seems to work. > >Separate question is about the safety of this approach: can we be sure >that a ucode update would not reset the status of the NMI latch? I.e. >can it cause another NMI to be delivered while Xen already handles one? Ashok, what's your opinion on Sergey's approach and his concern? Thanks Chao ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
[Xen-devel] [qemu-mainline test] 140635: regressions - FAIL
flight 140635 qemu-mainline real [real] http://logs.test-lab.xenproject.org/osstest/logs/140635/ Regressions :-( Tests which did not succeed and are blocking, including tests which could not be run: build-amd64-xsm 6 xen-build fail in 140583 REGR. vs. 140282 test-amd64-amd64-xl-pvshim 20 guest-start/debian.repeat fail in 140583 REGR. vs. 140282 Tests which are failing intermittently (not blocking): test-amd64-amd64-xl-pvshim 17 guest-saverestore.2 fail in 140610 pass in 140635 test-amd64-i386-xl-qemuu-ovmf-amd64 10 debian-hvm-install fail in 140610 pass in 140635 test-amd64-amd64-xl-pvshim 18 guest-localmigrate/x10 fail pass in 140583 test-amd64-amd64-i386-pvgrub 7 xen-boot fail pass in 140610 Tests which did not succeed, but are not blocking: test-amd64-i386-libvirt-xsm 1 build-check(1) blocked in 140583 n/a test-amd64-amd64-xl-qemuu-debianhvm-i386-xsm 1 build-check(1) blocked in 140583 n/a test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm 1 build-check(1) blocked in 140583 n/a test-amd64-i386-xl-xsm1 build-check(1) blocked in 140583 n/a test-amd64-amd64-libvirt-xsm 1 build-check(1) blocked in 140583 n/a test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm 1 build-check(1) blocked in 140583 n/a test-amd64-i386-xl-qemuu-debianhvm-i386-xsm 1 build-check(1) blocked in 140583 n/a test-amd64-amd64-xl-xsm 1 build-check(1) blocked in 140583 n/a test-amd64-amd64-xl-qemuu-win7-amd64 17 guest-stopfail like 140282 test-armhf-armhf-libvirt 14 saverestore-support-checkfail like 140282 test-amd64-i386-xl-qemuu-win7-amd64 17 guest-stop fail like 140282 test-amd64-amd64-xl-qemuu-ws16-amd64 17 guest-stopfail like 140282 test-armhf-armhf-libvirt-raw 13 saverestore-support-checkfail like 140282 test-amd64-i386-xl-pvshim12 guest-start fail never pass test-amd64-i386-libvirt 13 migrate-support-checkfail never pass test-amd64-amd64-libvirt 13 migrate-support-checkfail never pass test-amd64-amd64-libvirt-xsm 13 migrate-support-checkfail never pass test-amd64-i386-libvirt-xsm 13 migrate-support-checkfail never pass test-arm64-arm64-xl-seattle 13 migrate-support-checkfail never pass test-arm64-arm64-xl-seattle 14 saverestore-support-checkfail never pass test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm 11 migrate-support-check fail never pass test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm 11 migrate-support-check fail never pass test-arm64-arm64-xl-xsm 13 migrate-support-checkfail never pass test-arm64-arm64-xl-xsm 14 saverestore-support-checkfail never pass test-arm64-arm64-xl-credit2 13 migrate-support-checkfail never pass test-arm64-arm64-xl-credit2 14 saverestore-support-checkfail never pass test-arm64-arm64-xl 13 migrate-support-checkfail never pass test-arm64-arm64-xl 14 saverestore-support-checkfail never pass test-amd64-amd64-qemuu-nested-amd 17 debian-hvm-install/l1/l2 fail never pass test-arm64-arm64-xl-thunderx 13 migrate-support-checkfail never pass test-arm64-arm64-xl-thunderx 14 saverestore-support-checkfail never pass test-arm64-arm64-libvirt-xsm 13 migrate-support-checkfail never pass test-arm64-arm64-libvirt-xsm 14 saverestore-support-checkfail never pass test-armhf-armhf-xl-arndale 13 migrate-support-checkfail never pass test-armhf-armhf-xl-arndale 14 saverestore-support-checkfail never pass test-amd64-amd64-libvirt-vhd 12 migrate-support-checkfail never pass test-armhf-armhf-xl 13 migrate-support-checkfail never pass test-armhf-armhf-xl 14 saverestore-support-checkfail never pass test-armhf-armhf-xl-rtds 13 migrate-support-checkfail never pass test-armhf-armhf-xl-rtds 14 saverestore-support-checkfail never pass test-armhf-armhf-xl-multivcpu 13 migrate-support-checkfail never pass test-armhf-armhf-xl-multivcpu 14 saverestore-support-checkfail never pass test-armhf-armhf-xl-credit2 13 migrate-support-checkfail never pass test-armhf-armhf-xl-credit2 14 saverestore-support-checkfail never pass test-armhf-armhf-libvirt 13 migrate-support-checkfail never pass test-armhf-armhf-xl-cubietruck 13 migrate-support-checkfail never pass test-armhf-armhf-xl-cubietruck 14 saverestore-support-checkfail never pass test-arm64-arm64-xl-credit1 13 migrate-support-checkfail never pass test-arm64-arm64-xl-credit1 14 saverestore-support-checkfail never pass test-armhf-armhf-xl-credit1 13 migrate-support-checkfail never pass test-armhf-armhf-xl-credit1 14 saverestore-support-checkfail never pass test-armhf-armhf-xl-vhd 12 migrate-support
Re: [Xen-devel] [PATCH v9 12/15] microcode: reduce memory allocation and copy when creating a patch
On Mon, Aug 26, 2019 at 03:03:22PM +0800, Chao Gao wrote: > On Fri, Aug 23, 2019 at 10:11:21AM +0200, Roger Pau Monné wrote: > >On Mon, Aug 19, 2019 at 09:25:25AM +0800, Chao Gao wrote: > >> To create a microcode patch from a vendor-specific update, > >> allocate_microcode_patch() copied everything from the update. > >> It is not efficient. Essentially, we just need to go through > >> ucodes in the blob, find the one with the newest revision and > >> install it into the microcode_patch. In the process, buffers > >> like mc_amd, equiv_cpu_table (on AMD side), and mc (on Intel > >> side) can be reused. microcode_patch now is allocated after > >> it is sure that there is a matching ucode. > > > >Oh, I think this answers my question on a previous patch. > > > >For future series it would be nice to avoid so many rewrites in the > >same series, alloc_microcode_patch is already modified in a previous > >patch, just to be removed here. It also makes it harder to follow > >what's going on. > > Got it. This patch is added in this new version. And some trivial > patches already got reviewed-by. So I don't merge it with them. > > >> while ( (error = get_ucode_from_buffer_amd(mc_amd, buf, bufsize, > >> &offset)) == 0 ) > >> { > >> -struct microcode_patch *new_patch = alloc_microcode_patch(mc_amd); > >> - > >> -if ( IS_ERR(new_patch) ) > >> -{ > >> -error = PTR_ERR(new_patch); > >> -break; > >> -} > >> - > >> /* > >> - * If the new patch covers current CPU, compare patches and store > >> the > >> + * If the new ucode covers current CPU, compare ucodes and store > >> the > >> * one with higher revision. > >> */ > >> -if ( (microcode_fits(new_patch->mc_amd) != MIS_UCODE) && > >> - (!patch || (compare_patch(new_patch, patch) == NEW_UCODE)) ) > >> +#define REV_ID(mpb) (((struct microcode_header_amd > >> *)(mpb))->processor_rev_id) > >> +if ( (microcode_fits(mc_amd) != MIS_UCODE) && > >> + (!saved || (REV_ID(mc_amd->mpb) > REV_ID(saved))) ) > >> +#undef REV_ID > >> { > >> -struct microcode_patch *tmp = patch; > >> - > >> -patch = new_patch; > >> -new_patch = tmp; > >> +xfree(saved); > >> +saved = mc_amd->mpb; > >> +saved_size = mc_amd->mpb_size; > >> } > >> - > >> -if ( new_patch ) > >> -microcode_free_patch(new_patch); > >> +else > >> +xfree(mc_amd->mpb); > > It might be better to move 'mc_amd->mpb = NULL' here. > > >> > >> if ( offset >= bufsize ) > >> break; > >> @@ -593,9 +548,25 @@ static struct microcode_patch > >> *cpu_request_microcode(const void *buf, > >> *(const uint32_t *)(buf + offset) == UCODE_MAGIC ) > >> break; > >> } > >> -xfree(mc_amd->mpb); > >> -xfree(mc_amd->equiv_cpu_table); > >> -xfree(mc_amd); > >> + > >> +if ( saved ) > >> +{ > >> +mc_amd->mpb = saved; > >> +mc_amd->mpb_size = saved_size; > >> +patch = xmalloc(struct microcode_patch); > >> +if ( patch ) > >> +patch->mc_amd = mc_amd; > >> +else > >> +{ > >> +free_patch(mc_amd); > >> +error = -ENOMEM; > >> +} > >> +} > >> +else > >> +{ > >> +mc_amd->mpb = NULL; > > > >What's the point in setting mpb to NULL if you are just going to free > >mc_amd below? > > To avoid double free here. mc_amd->mpb is always freed or saved. > And here we want to free mc_amd itself and mc_amd->equiv_cpu_table. But there's no chance of a double free here, since you are freeing mc_amd in the line below after setting mpb = NULL. I think it would make sense to set mpb = NULL after freeing it inside the loop. With that you can add my: Reviewed-by: Roger Pau Monné > > > >Also, I'm not sure I understand why you need to free mc_amd, isn't > >this buff memory that should be freed by the caller? > > But mc_amd is allocated in this function. > > > > >ie: in the Intel counterpart below you don't seem to free the mc > >cursor used for the get_next_ucode_from_buffer loop. > > 'mc' is saved if it is newer than current patch stored in 'saved'. > Otherwise 'mc' is freed immediately. So we don't need to free it > again after the while loop. Ack, thanks! ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH 0/3] xen/sched: use new idle scheduler for free cpus
On 13.08.19 17:51, Dario Faggioli wrote: On Fri, 2019-08-02 at 15:07 +0200, Juergen Gross wrote: These three patches have been carved out from my core scheduling series as they are sufficiently independent to be applied even without the big series. Without this little series there are messages like the following to be seen on the console when booting with smt=0: (XEN) Adding cpu 1 to runqueue 0 (XEN) CPU 1 still not dead... (XEN) CPU 1 still not dead... (XEN) CPU 1 still not dead... (XEN) CPU 1 still not dead... By assigning cpus to Cpupool-0 only after all cpus are up and by not using the more complicated credit2 scheduler for cpus not in any cpupool this situation can simply no longer happen, as parking the not to be started threads is done before. And this is not the only problem, solved by this series (or an equivalent approach). Right now, CPUs that are not in any pool, still belong to Pool-0's scheduler. This forces us to make, within the scheduler, extra effort to avoid actually running vCPUs on those. In the case of Credit1, this also cause issue to weights (re)distribution, as the number of CPUs available to the scheduler is wrong. So, we absolutely want something like this. This is described in the changelog of commit e7191920261d ("xen: credit2: never consider CPUs outside of our cpupool"). Would it be possible to mention this in one of the changelogs of the series (patch 3 would be the best place, I think). Okay. Juergen ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH 1/3] xen/sched: populate cpupool0 only after all cpus are up
On 13.08.19 18:07, Dario Faggioli wrote: On Fri, 2019-08-02 at 15:07 +0200, Juergen Gross wrote: With core or socket scheduling we need to know the number of siblings per scheduling unit before we can setup the scheduler properly. In order to prepare that do cpupool0 population only after all cpus are up. With that in place there is no need to create cpupool0 earlier, so do that just before assigning the cpus. Initialize free cpus with all online cpus at that time in order to be able to add the cpu notifier late, too. So, now that this series has been made independent, I think that mentions to the core-scheduling one should be dropped. I mean, it is at least possible that this series would go in, while the core-scheduling one never will. And at that point, it would be very hard, for someone doing archaeology, to understand what went on. It seems to me that, this patch, simplifies cpupool initialization (as, e.g., the direct call to the CPU_ONLINE notifier for the BSP was IMO rather convoluted). And that is made possible by moving the initialization itself to a later point, making all the online CPUs look like free CPUs, and using the standard (internal) API directly (i.e., cpupool_assign_cpu_locked()) to add them to Pool-0. So, I'd kill the very first sentence and rearrange the rest to include at least a quick mention to the simplification that we achieve. Fine with me. Juergen ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH 2/3] xen/sched: remove cpu from pool0 before removing it
On 13.08.19 19:11, Dario Faggioli wrote: On Fri, 2019-08-02 at 15:07 +0200, Juergen Gross wrote: Today a cpu which is removed from the system is taken directly from Pool0 to the offline state. This will conflict with the new idle scheduler, so remove it from Pool0 first. Additionally accept removing a free cpu instead of requiring it to be in Pool0. For the resume failed case we need to call the scheduler code for that situation after the cpupool handling, so move the scheduler code into a function and call it from cpupool_cpu_remove_forced() and remove the CPU_RESUME_FAILED case from cpu_schedule_callback(). Note that we are calling now schedule_cpu_switch() in stop_machine context so we need to switch from spinlock_irq to spinlock_irqsave. Signed-off-by: Juergen Gross --- --- a/xen/common/cpupool.c +++ b/xen/common/cpupool.c @@ -282,22 +282,14 @@ static int cpupool_assign_cpu_locked(struct cpupool *c, unsigned int cpu) return 0; } -static long cpupool_unassign_cpu_helper(void *info) +static int cpupool_unassign_cpu_epilogue(struct cpupool *c) in schedule.c, for a similar situation, we have used '_start' and '_finish' as suffixes. What do you think about using those here too? It's certainly a minor thing, I know, but I (personally) like them better (especially than 'epilogue') and I think it gives us some consistency (yes, sure, different files.. but scheduling and cpupools are quite tightly related). Okay, will rename. Juergen ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH v2] print: introduce a format specifier for pci_sbdf_t
On Thu, Aug 22, 2019 at 08:51:32AM +0200, Roger Pau Monne wrote: > The new format specifier is '%pp', and prints a pci_sbdf_t using the > seg:bus:dev.func format. Replace all SBDFs printed using > '%04x:%02x:%02x.%u' to use the new format specifier. > > No functional change intended. > > Signed-off-by: Roger Pau Monné This patch is missing the chunk below, I would appreciate if it can be merged while commiting if the patch gets the relevant Acks/RBs, or else I can resend with the chunk added. Thanks, Roger. ---8<--- diff --git a/xen/drivers/passthrough/amd/iommu_intr.c b/xen/drivers/passthrough/amd/iommu_intr.c index 687a7fa922..1c907cff52 100644 --- a/xen/drivers/passthrough/amd/iommu_intr.c +++ b/xen/drivers/passthrough/amd/iommu_intr.c @@ -898,10 +898,8 @@ static void dump_intremap_table(const struct amd_iommu *iommu, if ( ivrs_mapping ) { -printk(" %04x:%02x:%02x:%u:\n", iommu->seg, - PCI_BUS(ivrs_mapping->dte_requestor_id), - PCI_SLOT(ivrs_mapping->dte_requestor_id), - PCI_FUNC(ivrs_mapping->dte_requestor_id)); +printk(" %pp:\n", + &PCI_SBDF2(iommu->seg, ivrs_mapping->dte_requestor_id)); ivrs_mapping = NULL; } ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH 01/11] xen/arm: use dma-noncoherent.h calls for xen-swiotlb cache maintainance
On Mon, Aug 19, 2019 at 12:45:17PM +0100, Julien Grall wrote: > On 8/16/19 2:00 PM, Christoph Hellwig wrote: >> +static inline void xen_dma_map_page(struct device *hwdev, struct page *page, >> + dma_addr_t dev_addr, unsigned long offset, size_t size, >> + enum dma_data_direction dir, unsigned long attrs) >> +{ >> +unsigned long page_pfn = page_to_xen_pfn(page); >> +unsigned long dev_pfn = XEN_PFN_DOWN(dev_addr); >> +unsigned long compound_pages = >> +(1<> +bool local = (page_pfn <= dev_pfn) && >> +(dev_pfn - page_pfn < compound_pages); >> + > > The Arm version as a comment here. Could we retain it? I've added it in this patch, altough the rewrites later on mean it will go away in favour of a new comment elsewhere anyway. ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
[Xen-devel] [linux-4.19 test] 140638: regressions - FAIL
flight 140638 linux-4.19 real [real] http://logs.test-lab.xenproject.org/osstest/logs/140638/ Regressions :-( Tests which did not succeed and are blocking, including tests which could not be run: test-arm64-arm64-examine11 examine-serial/bootloader fail REGR. vs. 129313 test-amd64-i386-qemut-rhel6hvm-amd 12 guest-start/redhat.repeat fail REGR. vs. 129313 build-armhf-pvops 6 kernel-build fail REGR. vs. 129313 Tests which did not succeed, but are not blocking: test-armhf-armhf-libvirt-raw 1 build-check(1) blocked n/a test-armhf-armhf-xl-rtds 1 build-check(1) blocked n/a test-armhf-armhf-xl-credit1 1 build-check(1) blocked n/a test-armhf-armhf-xl 1 build-check(1) blocked n/a test-armhf-armhf-libvirt 1 build-check(1) blocked n/a test-armhf-armhf-xl-arndale 1 build-check(1) blocked n/a test-armhf-armhf-xl-multivcpu 1 build-check(1) blocked n/a test-armhf-armhf-xl-vhd 1 build-check(1) blocked n/a test-armhf-armhf-examine 1 build-check(1) blocked n/a test-armhf-armhf-xl-cubietruck 1 build-check(1) blocked n/a test-armhf-armhf-xl-credit2 1 build-check(1) blocked n/a test-amd64-i386-xl-qemuu-ovmf-amd64 18 guest-start/debianhvm.repeat fail blocked in 129313 test-amd64-i386-xl-pvshim12 guest-start fail never pass test-amd64-amd64-libvirt-xsm 13 migrate-support-checkfail never pass test-amd64-i386-libvirt-xsm 13 migrate-support-checkfail never pass test-amd64-i386-libvirt 13 migrate-support-checkfail never pass test-amd64-amd64-libvirt 13 migrate-support-checkfail never pass test-arm64-arm64-xl-seattle 13 migrate-support-checkfail never pass test-arm64-arm64-xl-seattle 14 saverestore-support-checkfail never pass test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm 11 migrate-support-check fail never pass test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm 11 migrate-support-check fail never pass test-arm64-arm64-libvirt-xsm 13 migrate-support-checkfail never pass test-arm64-arm64-libvirt-xsm 14 saverestore-support-checkfail never pass test-arm64-arm64-xl-thunderx 13 migrate-support-checkfail never pass test-arm64-arm64-xl-thunderx 14 saverestore-support-checkfail never pass test-arm64-arm64-xl-xsm 13 migrate-support-checkfail never pass test-arm64-arm64-xl-xsm 14 saverestore-support-checkfail never pass test-arm64-arm64-xl-credit1 13 migrate-support-checkfail never pass test-arm64-arm64-xl-credit1 14 saverestore-support-checkfail never pass test-arm64-arm64-xl-credit2 13 migrate-support-checkfail never pass test-arm64-arm64-xl-credit2 14 saverestore-support-checkfail never pass test-amd64-amd64-libvirt-vhd 12 migrate-support-checkfail never pass test-amd64-amd64-qemuu-nested-amd 17 debian-hvm-install/l1/l2 fail never pass test-amd64-amd64-xl-qemuu-win7-amd64 17 guest-stop fail never pass test-amd64-i386-xl-qemuu-win7-amd64 17 guest-stop fail never pass test-amd64-amd64-xl-qemut-win7-amd64 17 guest-stop fail never pass test-arm64-arm64-xl 13 migrate-support-checkfail never pass test-arm64-arm64-xl 14 saverestore-support-checkfail never pass test-amd64-i386-xl-qemut-ws16-amd64 17 guest-stop fail never pass test-amd64-amd64-xl-qemuu-ws16-amd64 17 guest-stop fail never pass test-amd64-i386-xl-qemut-win7-amd64 17 guest-stop fail never pass test-amd64-i386-xl-qemuu-ws16-amd64 17 guest-stop fail never pass test-amd64-amd64-xl-qemut-ws16-amd64 17 guest-stop fail never pass test-amd64-i386-xl-qemut-win10-i386 10 windows-install fail never pass test-amd64-amd64-xl-qemut-win10-i386 10 windows-installfail never pass test-amd64-amd64-xl-qemuu-win10-i386 10 windows-installfail never pass test-amd64-i386-xl-qemuu-win10-i386 10 windows-install fail never pass version targeted for testing: linuxdef4c11b31312777a8db1f1083e0d4bc6c9bbef0 baseline version: linux84df9525b0c27f3ebc2ebb1864fa62a97fdedb7d Last test of basis 129313 2018-11-02 05:39:08 Z 297 days Failing since129412 2018-11-04 14:10:15 Z 294 days 211 attempts Testing same since 140638 2019-08-25 15:58:43 Z0 days1 attempts 2480 people touched revisions under test, not listing them all jobs: build-amd64-xsm pass build-arm64-xsm pass build-i386-xsm pass build-amd64
[Xen-devel] [PATCH 02/11] xen/arm: use dev_is_dma_coherent
Use the dma-noncoherent dev_is_dma_coherent helper instead of the home grown variant. Note that both are always initialized to the same value in arch_setup_dma_ops. Signed-off-by: Christoph Hellwig Reviewed-by: Julien Grall --- arch/arm/include/asm/dma-mapping.h | 6 -- arch/arm/xen/mm.c| 12 ++-- arch/arm64/include/asm/dma-mapping.h | 9 - 3 files changed, 6 insertions(+), 21 deletions(-) diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h index dba9355e2484..bdd80ddbca34 100644 --- a/arch/arm/include/asm/dma-mapping.h +++ b/arch/arm/include/asm/dma-mapping.h @@ -91,12 +91,6 @@ static inline dma_addr_t virt_to_dma(struct device *dev, void *addr) } #endif -/* do not use this function in a driver */ -static inline bool is_device_dma_coherent(struct device *dev) -{ - return dev->archdata.dma_coherent; -} - /** * arm_dma_alloc - allocate consistent memory for DMA * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices diff --git a/arch/arm/xen/mm.c b/arch/arm/xen/mm.c index d33b77e9add3..90574d89d0d4 100644 --- a/arch/arm/xen/mm.c +++ b/arch/arm/xen/mm.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only #include -#include +#include #include #include #include @@ -99,7 +99,7 @@ void __xen_dma_map_page(struct device *hwdev, struct page *page, dma_addr_t dev_addr, unsigned long offset, size_t size, enum dma_data_direction dir, unsigned long attrs) { - if (is_device_dma_coherent(hwdev)) + if (dev_is_dma_coherent(hwdev)) return; if (attrs & DMA_ATTR_SKIP_CPU_SYNC) return; @@ -112,7 +112,7 @@ void __xen_dma_unmap_page(struct device *hwdev, dma_addr_t handle, unsigned long attrs) { - if (is_device_dma_coherent(hwdev)) + if (dev_is_dma_coherent(hwdev)) return; if (attrs & DMA_ATTR_SKIP_CPU_SYNC) return; @@ -123,7 +123,7 @@ void __xen_dma_unmap_page(struct device *hwdev, dma_addr_t handle, void __xen_dma_sync_single_for_cpu(struct device *hwdev, dma_addr_t handle, size_t size, enum dma_data_direction dir) { - if (is_device_dma_coherent(hwdev)) + if (dev_is_dma_coherent(hwdev)) return; __xen_dma_page_dev_to_cpu(hwdev, handle, size, dir); } @@ -131,7 +131,7 @@ void __xen_dma_sync_single_for_cpu(struct device *hwdev, void __xen_dma_sync_single_for_device(struct device *hwdev, dma_addr_t handle, size_t size, enum dma_data_direction dir) { - if (is_device_dma_coherent(hwdev)) + if (dev_is_dma_coherent(hwdev)) return; __xen_dma_page_cpu_to_dev(hwdev, handle, size, dir); } @@ -159,7 +159,7 @@ bool xen_arch_need_swiotlb(struct device *dev, * memory and we are not able to flush the cache. */ return (!hypercall_cflush && (xen_pfn != bfn) && - !is_device_dma_coherent(dev)); + !dev_is_dma_coherent(dev)); } int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order, diff --git a/arch/arm64/include/asm/dma-mapping.h b/arch/arm64/include/asm/dma-mapping.h index bdcb0922a40c..67243255a858 100644 --- a/arch/arm64/include/asm/dma-mapping.h +++ b/arch/arm64/include/asm/dma-mapping.h @@ -18,14 +18,5 @@ static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) return NULL; } -/* - * Do not use this function in a driver, it is only provided for - * arch/arm/mm/xen.c, which is used by arm64 as well. - */ -static inline bool is_device_dma_coherent(struct device *dev) -{ - return dev->dma_coherent; -} - #endif /* __KERNEL__ */ #endif /* __ASM_DMA_MAPPING_H */ -- 2.20.1 ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
[Xen-devel] [PATCH 01/11] xen/arm: use dma-noncoherent.h calls for xen-swiotlb cache maintainance
Reuse the arm64 code that uses the dma-direct/swiotlb helpers for DMA non-coherent devices. Signed-off-by: Christoph Hellwig --- arch/arm/include/asm/device.h | 3 - arch/arm/include/asm/xen/page-coherent.h | 93 -- arch/arm/mm/dma-mapping.c | 8 +- arch/arm64/include/asm/xen/page-coherent.h | 75 - drivers/xen/swiotlb-xen.c | 49 +--- include/xen/arm/page-coherent.h| 80 +++ 6 files changed, 83 insertions(+), 225 deletions(-) diff --git a/arch/arm/include/asm/device.h b/arch/arm/include/asm/device.h index f6955b55c544..c675bc0d5aa8 100644 --- a/arch/arm/include/asm/device.h +++ b/arch/arm/include/asm/device.h @@ -14,9 +14,6 @@ struct dev_archdata { #endif #ifdef CONFIG_ARM_DMA_USE_IOMMU struct dma_iommu_mapping*mapping; -#endif -#ifdef CONFIG_XEN - const struct dma_map_ops *dev_dma_ops; #endif unsigned int dma_coherent:1; unsigned int dma_ops_setup:1; diff --git a/arch/arm/include/asm/xen/page-coherent.h b/arch/arm/include/asm/xen/page-coherent.h index 2c403e7c782d..27e984977402 100644 --- a/arch/arm/include/asm/xen/page-coherent.h +++ b/arch/arm/include/asm/xen/page-coherent.h @@ -1,95 +1,2 @@ /* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_ARM_XEN_PAGE_COHERENT_H -#define _ASM_ARM_XEN_PAGE_COHERENT_H - -#include -#include #include - -static inline const struct dma_map_ops *xen_get_dma_ops(struct device *dev) -{ - if (dev && dev->archdata.dev_dma_ops) - return dev->archdata.dev_dma_ops; - return get_arch_dma_ops(NULL); -} - -static inline void *xen_alloc_coherent_pages(struct device *hwdev, size_t size, - dma_addr_t *dma_handle, gfp_t flags, unsigned long attrs) -{ - return xen_get_dma_ops(hwdev)->alloc(hwdev, size, dma_handle, flags, attrs); -} - -static inline void xen_free_coherent_pages(struct device *hwdev, size_t size, - void *cpu_addr, dma_addr_t dma_handle, unsigned long attrs) -{ - xen_get_dma_ops(hwdev)->free(hwdev, size, cpu_addr, dma_handle, attrs); -} - -static inline void xen_dma_map_page(struct device *hwdev, struct page *page, -dma_addr_t dev_addr, unsigned long offset, size_t size, -enum dma_data_direction dir, unsigned long attrs) -{ - unsigned long page_pfn = page_to_xen_pfn(page); - unsigned long dev_pfn = XEN_PFN_DOWN(dev_addr); - unsigned long compound_pages = - (1unmap_page) - xen_get_dma_ops(hwdev)->unmap_page(hwdev, handle, size, dir, attrs); - } else - __xen_dma_unmap_page(hwdev, handle, size, dir, attrs); -} - -static inline void xen_dma_sync_single_for_cpu(struct device *hwdev, - dma_addr_t handle, size_t size, enum dma_data_direction dir) -{ - unsigned long pfn = PFN_DOWN(handle); - if (pfn_valid(pfn)) { - if (xen_get_dma_ops(hwdev)->sync_single_for_cpu) - xen_get_dma_ops(hwdev)->sync_single_for_cpu(hwdev, handle, size, dir); - } else - __xen_dma_sync_single_for_cpu(hwdev, handle, size, dir); -} - -static inline void xen_dma_sync_single_for_device(struct device *hwdev, - dma_addr_t handle, size_t size, enum dma_data_direction dir) -{ - unsigned long pfn = PFN_DOWN(handle); - if (pfn_valid(pfn)) { - if (xen_get_dma_ops(hwdev)->sync_single_for_device) - xen_get_dma_ops(hwdev)->sync_single_for_device(hwdev, handle, size, dir); - } else - __xen_dma_sync_single_for_device(hwdev, handle, size, dir); -} - -#endif /* _ASM_ARM_XEN_PAGE_COHERENT_H */ diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index d42557ee69c2..738097396445 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -1132,10 +1132,6 @@ static const struct dma_map_ops *arm_get_dma_map_ops(bool coherent) * 32-bit DMA. * Use the generic dma-direct / swiotlb ops code in that case, as that * handles boun
[Xen-devel] swiotlb-xen cleanups v2
Hi Xen maintainers and friends, please take a look at this series that cleans up the parts of swiotlb-xen that deal with non-coherent caches. Changes since v1: - rewrite dma_cache_maint to be much simpler - improve various comments and commit logs - remove page-coherent.h entirely ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
[Xen-devel] [PATCH 04/11] xen/arm: remove xen_dma_ops
arm and arm64 can just use xen_swiotlb_dma_ops directly like x86, no need for a pointer indirection. Signed-off-by: Christoph Hellwig Reviewed-by: Julien Grall --- arch/arm/mm/dma-mapping.c| 3 ++- arch/arm/xen/mm.c| 4 arch/arm64/mm/dma-mapping.c | 3 ++- include/xen/arm/hypervisor.h | 2 -- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index 738097396445..2661cad36359 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -35,6 +35,7 @@ #include #include #include +#include #include "dma.h" #include "mm.h" @@ -2360,7 +2361,7 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, #ifdef CONFIG_XEN if (xen_initial_domain()) - dev->dma_ops = xen_dma_ops; + dev->dma_ops = &xen_swiotlb_dma_ops; #endif dev->archdata.dma_ops_setup = true; } diff --git a/arch/arm/xen/mm.c b/arch/arm/xen/mm.c index 14210ebdea1a..9b3a6c0ca681 100644 --- a/arch/arm/xen/mm.c +++ b/arch/arm/xen/mm.c @@ -163,16 +163,12 @@ void xen_destroy_contiguous_region(phys_addr_t pstart, unsigned int order) } EXPORT_SYMBOL_GPL(xen_destroy_contiguous_region); -const struct dma_map_ops *xen_dma_ops; -EXPORT_SYMBOL(xen_dma_ops); - int __init xen_mm_init(void) { struct gnttab_cache_flush cflush; if (!xen_initial_domain()) return 0; xen_swiotlb_init(1, false); - xen_dma_ops = &xen_swiotlb_dma_ops; cflush.op = 0; cflush.a.dev_bus_addr = 0; diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c index bd2b039f43a6..4b244a037349 100644 --- a/arch/arm64/mm/dma-mapping.c +++ b/arch/arm64/mm/dma-mapping.c @@ -8,6 +8,7 @@ #include #include #include +#include #include @@ -64,6 +65,6 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, #ifdef CONFIG_XEN if (xen_initial_domain()) - dev->dma_ops = xen_dma_ops; + dev->dma_ops = &xen_swiotlb_dma_ops; #endif } diff --git a/include/xen/arm/hypervisor.h b/include/xen/arm/hypervisor.h index 2982571f7cc1..43ef24dd030e 100644 --- a/include/xen/arm/hypervisor.h +++ b/include/xen/arm/hypervisor.h @@ -19,8 +19,6 @@ static inline enum paravirt_lazy_mode paravirt_get_lazy_mode(void) return PARAVIRT_LAZY_NONE; } -extern const struct dma_map_ops *xen_dma_ops; - #ifdef CONFIG_XEN void __init xen_early_init(void); #else -- 2.20.1 ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
[Xen-devel] [PATCH 03/11] xen/arm: simplify dma_cache_maint
Calculate the required operation in the caller, and pass it directly instead of recalculating it for each page, and use simple arithmetics to get from the physical address to Xen page size aligned chunks. Signed-off-by: Christoph Hellwig --- arch/arm/xen/mm.c | 62 +-- 1 file changed, 22 insertions(+), 40 deletions(-) diff --git a/arch/arm/xen/mm.c b/arch/arm/xen/mm.c index 90574d89d0d4..14210ebdea1a 100644 --- a/arch/arm/xen/mm.c +++ b/arch/arm/xen/mm.c @@ -35,64 +35,46 @@ unsigned long xen_get_swiotlb_free_pages(unsigned int order) return __get_free_pages(flags, order); } -enum dma_cache_op { - DMA_UNMAP, - DMA_MAP, -}; static bool hypercall_cflush = false; -/* functions called by SWIOTLB */ - -static void dma_cache_maint(dma_addr_t handle, unsigned long offset, - size_t size, enum dma_data_direction dir, enum dma_cache_op op) +/* buffers in highmem or foreign pages cannot cross page boundaries */ +static void dma_cache_maint(dma_addr_t handle, size_t size, u32 op) { struct gnttab_cache_flush cflush; - unsigned long xen_pfn; - size_t left = size; - xen_pfn = (handle >> XEN_PAGE_SHIFT) + offset / XEN_PAGE_SIZE; - offset %= XEN_PAGE_SIZE; + cflush.a.dev_bus_addr = handle & XEN_PAGE_MASK; + cflush.offset = xen_offset_in_page(handle); + cflush.op = op; do { - size_t len = left; - - /* buffers in highmem or foreign pages cannot cross page -* boundaries */ - if (len + offset > XEN_PAGE_SIZE) - len = XEN_PAGE_SIZE - offset; - - cflush.op = 0; - cflush.a.dev_bus_addr = xen_pfn << XEN_PAGE_SHIFT; - cflush.offset = offset; - cflush.length = len; - - if (op == DMA_UNMAP && dir != DMA_TO_DEVICE) - cflush.op = GNTTAB_CACHE_INVAL; - if (op == DMA_MAP) { - if (dir == DMA_FROM_DEVICE) - cflush.op = GNTTAB_CACHE_INVAL; - else - cflush.op = GNTTAB_CACHE_CLEAN; - } - if (cflush.op) - HYPERVISOR_grant_table_op(GNTTABOP_cache_flush, &cflush, 1); + if (size + cflush.offset > XEN_PAGE_SIZE) + cflush.length = XEN_PAGE_SIZE - cflush.offset; + else + cflush.length = size; + + HYPERVISOR_grant_table_op(GNTTABOP_cache_flush, &cflush, 1); + + handle += cflush.length; + size -= cflush.length; - offset = 0; - xen_pfn++; - left -= len; - } while (left); + cflush.offset = 0; + } while (size); } static void __xen_dma_page_dev_to_cpu(struct device *hwdev, dma_addr_t handle, size_t size, enum dma_data_direction dir) { - dma_cache_maint(handle & PAGE_MASK, handle & ~PAGE_MASK, size, dir, DMA_UNMAP); + if (dir != DMA_TO_DEVICE) + dma_cache_maint(handle, size, GNTTAB_CACHE_INVAL); } static void __xen_dma_page_cpu_to_dev(struct device *hwdev, dma_addr_t handle, size_t size, enum dma_data_direction dir) { - dma_cache_maint(handle & PAGE_MASK, handle & ~PAGE_MASK, size, dir, DMA_MAP); + if (dir == DMA_FROM_DEVICE) + dma_cache_maint(handle, size, GNTTAB_CACHE_INVAL); + else + dma_cache_maint(handle, size, GNTTAB_CACHE_CLEAN); } void __xen_dma_map_page(struct device *hwdev, struct page *page, -- 2.20.1 ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
[Xen-devel] [PATCH 09/11] swiotlb-xen: remove page-coherent.h
The only thing left of page-coherent.h is two functions implemented by the architecture for non-coherent DMA support that are never called for fully coherent architectures. Just move the prototypes for those to swiotlb-xen.h instead. Signed-off-by: Christoph Hellwig --- arch/arm/include/asm/xen/page-coherent.h | 2 -- arch/arm64/include/asm/xen/page-coherent.h | 2 -- arch/x86/include/asm/xen/page-coherent.h | 11 --- drivers/xen/swiotlb-xen.c | 3 --- include/Kbuild | 1 - include/xen/arm/page-coherent.h| 10 -- include/xen/swiotlb-xen.h | 6 ++ 7 files changed, 6 insertions(+), 29 deletions(-) delete mode 100644 arch/arm/include/asm/xen/page-coherent.h delete mode 100644 arch/arm64/include/asm/xen/page-coherent.h delete mode 100644 arch/x86/include/asm/xen/page-coherent.h delete mode 100644 include/xen/arm/page-coherent.h diff --git a/arch/arm/include/asm/xen/page-coherent.h b/arch/arm/include/asm/xen/page-coherent.h deleted file mode 100644 index 27e984977402.. --- a/arch/arm/include/asm/xen/page-coherent.h +++ /dev/null @@ -1,2 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#include diff --git a/arch/arm64/include/asm/xen/page-coherent.h b/arch/arm64/include/asm/xen/page-coherent.h deleted file mode 100644 index 27e984977402.. --- a/arch/arm64/include/asm/xen/page-coherent.h +++ /dev/null @@ -1,2 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#include diff --git a/arch/x86/include/asm/xen/page-coherent.h b/arch/x86/include/asm/xen/page-coherent.h deleted file mode 100644 index c9c8398a31ff.. --- a/arch/x86/include/asm/xen/page-coherent.h +++ /dev/null @@ -1,11 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_X86_XEN_PAGE_COHERENT_H -#define _ASM_X86_XEN_PAGE_COHERENT_H - -static inline void xen_dma_sync_single_for_cpu(struct device *hwdev, - dma_addr_t handle, size_t size, enum dma_data_direction dir) { } - -static inline void xen_dma_sync_single_for_device(struct device *hwdev, - dma_addr_t handle, size_t size, enum dma_data_direction dir) { } - -#endif /* _ASM_X86_XEN_PAGE_COHERENT_H */ diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c index a642e284f1e2..95911ff9c11c 100644 --- a/drivers/xen/swiotlb-xen.c +++ b/drivers/xen/swiotlb-xen.c @@ -35,9 +35,6 @@ #include #include -#include -#include - #include /* * Used to do a quick range check in swiotlb_tbl_unmap_single and diff --git a/include/Kbuild b/include/Kbuild index c38f0d46b267..cce5cf6abf89 100644 --- a/include/Kbuild +++ b/include/Kbuild @@ -1189,7 +1189,6 @@ header-test- += video/vga.h header-test- += video/w100fb.h header-test- += xen/acpi.h header-test- += xen/arm/hypercall.h -header-test- += xen/arm/page-coherent.h header-test- += xen/arm/page.h header-test- += xen/balloon.h header-test- += xen/events.h diff --git a/include/xen/arm/page-coherent.h b/include/xen/arm/page-coherent.h deleted file mode 100644 index 635492d41ebe.. --- a/include/xen/arm/page-coherent.h +++ /dev/null @@ -1,10 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _XEN_ARM_PAGE_COHERENT_H -#define _XEN_ARM_PAGE_COHERENT_H - -void xen_dma_sync_for_cpu(struct device *dev, dma_addr_t handle, - phys_addr_t paddr, size_t size, enum dma_data_direction dir); -void xen_dma_sync_for_device(struct device *dev, dma_addr_t handle, - phys_addr_t paddr, size_t size, enum dma_data_direction dir); - -#endif /* _XEN_ARM_PAGE_COHERENT_H */ diff --git a/include/xen/swiotlb-xen.h b/include/xen/swiotlb-xen.h index 5e4b83f83dbc..a7c642872568 100644 --- a/include/xen/swiotlb-xen.h +++ b/include/xen/swiotlb-xen.h @@ -2,8 +2,14 @@ #ifndef __LINUX_SWIOTLB_XEN_H #define __LINUX_SWIOTLB_XEN_H +#include #include +void xen_dma_sync_for_cpu(struct device *dev, dma_addr_t handle, + phys_addr_t paddr, size_t size, enum dma_data_direction dir); +void xen_dma_sync_for_device(struct device *dev, dma_addr_t handle, + phys_addr_t paddr, size_t size, enum dma_data_direction dir); + extern int xen_swiotlb_init(int verbose, bool early); extern const struct dma_map_ops xen_swiotlb_dma_ops; -- 2.20.1 ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
[Xen-devel] [PATCH 08/11] swiotlb-xen: simplify cache maintainance
Now that we know we always have the dma-noncoherent.h helpers available if we are on an architecture with support for non-coherent devices, we can just call them directly, and remove the calls to the dma-direct routines, including the fact that we call the dma_direct_map_page routines but ignore the value returned from it. Instead we now have Xen wrappers for the arch_sync_dma_for_{device,cpu} helpers that call the special Xen versions of those routines for foreign pages. Note that the new helpers get the physical address passed in addition to the dma address to avoid another translation for the local cache maintainance. The pfn_valid checks remain on the dma address as in the old code, even if that looks a little funny. Signed-off-by: Christoph Hellwig --- arch/arm/xen/mm.c| 64 ++ arch/x86/include/asm/xen/page-coherent.h | 11 drivers/xen/swiotlb-xen.c| 20 +++ include/xen/arm/page-coherent.h | 69 ++-- 4 files changed, 31 insertions(+), 133 deletions(-) diff --git a/arch/arm/xen/mm.c b/arch/arm/xen/mm.c index b7d53415532b..7096652f5a1e 100644 --- a/arch/arm/xen/mm.c +++ b/arch/arm/xen/mm.c @@ -61,63 +61,33 @@ static void dma_cache_maint(dma_addr_t handle, size_t size, u32 op) } while (size); } -static void __xen_dma_page_dev_to_cpu(struct device *hwdev, dma_addr_t handle, - size_t size, enum dma_data_direction dir) +/* + * Dom0 is mapped 1:1, and while the Linux page can span across multiple Xen + * pages, it is not possible for it to contain a mix of local and foreign Xen + * pages. Calling pfn_valid on a foreign mfn will always return false, so if + * pfn_valid returns true the pages is local and we can use the native + * dma-direct functions, otherwise we call the Xen specific version. + */ +void xen_dma_sync_for_cpu(struct device *dev, dma_addr_t handle, + phys_addr_t paddr, size_t size, enum dma_data_direction dir) { - if (dir != DMA_TO_DEVICE) + if (pfn_valid(PFN_DOWN(handle))) + arch_sync_dma_for_cpu(dev, paddr, size, dir); + else if (dir != DMA_TO_DEVICE) dma_cache_maint(handle, size, GNTTAB_CACHE_INVAL); } -static void __xen_dma_page_cpu_to_dev(struct device *hwdev, dma_addr_t handle, - size_t size, enum dma_data_direction dir) +void xen_dma_sync_for_device(struct device *dev, dma_addr_t handle, + phys_addr_t paddr, size_t size, enum dma_data_direction dir) { - if (dir == DMA_FROM_DEVICE) + if (pfn_valid(PFN_DOWN(handle))) + arch_sync_dma_for_device(dev, paddr, size, dir); + else if (dir == DMA_FROM_DEVICE) dma_cache_maint(handle, size, GNTTAB_CACHE_INVAL); else dma_cache_maint(handle, size, GNTTAB_CACHE_CLEAN); } -void __xen_dma_map_page(struct device *hwdev, struct page *page, -dma_addr_t dev_addr, unsigned long offset, size_t size, -enum dma_data_direction dir, unsigned long attrs) -{ - if (dev_is_dma_coherent(hwdev)) - return; - if (attrs & DMA_ATTR_SKIP_CPU_SYNC) - return; - - __xen_dma_page_cpu_to_dev(hwdev, dev_addr, size, dir); -} - -void __xen_dma_unmap_page(struct device *hwdev, dma_addr_t handle, - size_t size, enum dma_data_direction dir, - unsigned long attrs) - -{ - if (dev_is_dma_coherent(hwdev)) - return; - if (attrs & DMA_ATTR_SKIP_CPU_SYNC) - return; - - __xen_dma_page_dev_to_cpu(hwdev, handle, size, dir); -} - -void __xen_dma_sync_single_for_cpu(struct device *hwdev, - dma_addr_t handle, size_t size, enum dma_data_direction dir) -{ - if (dev_is_dma_coherent(hwdev)) - return; - __xen_dma_page_dev_to_cpu(hwdev, handle, size, dir); -} - -void __xen_dma_sync_single_for_device(struct device *hwdev, - dma_addr_t handle, size_t size, enum dma_data_direction dir) -{ - if (dev_is_dma_coherent(hwdev)) - return; - __xen_dma_page_cpu_to_dev(hwdev, handle, size, dir); -} - bool xen_arch_need_swiotlb(struct device *dev, phys_addr_t phys, dma_addr_t dev_addr) diff --git a/arch/x86/include/asm/xen/page-coherent.h b/arch/x86/include/asm/xen/page-coherent.h index 8ee33c5edded..c9c8398a31ff 100644 --- a/arch/x86/include/asm/xen/page-coherent.h +++ b/arch/x86/include/asm/xen/page-coherent.h @@ -2,17 +2,6 @@ #ifndef _ASM_X86_XEN_PAGE_COHERENT_H #define _ASM_X86_XEN_PAGE_COHERENT_H -#include -#include - -static inline void xen_dma_map_page(struct device *hwdev, struct page *page, -dma_addr_t dev_addr, unsigned long offset, size_t size, -enum dma_data_direction dir, unsigned long attrs) { } - -static inline void xen_dma_unmap_page(struct device *hwdev, dma_addr_t handle, - size_t size
[Xen-devel] [PATCH 06/11] swiotlb-xen: always use dma-direct helpers to alloc coherent pages
x86 currently calls alloc_pages, but using dma-direct works as well there, with the added benefit of using the CMA pool if available. The biggest advantage is of course to remove a pointless bit of architecture specific code. Signed-off-by: Christoph Hellwig --- arch/x86/include/asm/xen/page-coherent.h | 16 drivers/xen/swiotlb-xen.c| 7 +++ include/xen/arm/page-coherent.h | 12 3 files changed, 3 insertions(+), 32 deletions(-) diff --git a/arch/x86/include/asm/xen/page-coherent.h b/arch/x86/include/asm/xen/page-coherent.h index 116777e7f387..8ee33c5edded 100644 --- a/arch/x86/include/asm/xen/page-coherent.h +++ b/arch/x86/include/asm/xen/page-coherent.h @@ -5,22 +5,6 @@ #include #include -static inline void *xen_alloc_coherent_pages(struct device *hwdev, size_t size, - dma_addr_t *dma_handle, gfp_t flags, - unsigned long attrs) -{ - void *vstart = (void*)__get_free_pages(flags, get_order(size)); - *dma_handle = virt_to_phys(vstart); - return vstart; -} - -static inline void xen_free_coherent_pages(struct device *hwdev, size_t size, - void *cpu_addr, dma_addr_t dma_handle, - unsigned long attrs) -{ - free_pages((unsigned long) cpu_addr, get_order(size)); -} - static inline void xen_dma_map_page(struct device *hwdev, struct page *page, dma_addr_t dev_addr, unsigned long offset, size_t size, enum dma_data_direction dir, unsigned long attrs) { } diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c index b8808677ae1d..f9dd4cb6e4b3 100644 --- a/drivers/xen/swiotlb-xen.c +++ b/drivers/xen/swiotlb-xen.c @@ -299,8 +299,7 @@ xen_swiotlb_alloc_coherent(struct device *hwdev, size_t size, * address. In fact on ARM virt_to_phys only works for kernel direct * mapped RAM memory. Also see comment below. */ - ret = xen_alloc_coherent_pages(hwdev, size, dma_handle, flags, attrs); - + ret = dma_direct_alloc(hwdev, size, dma_handle, flags, attrs); if (!ret) return ret; @@ -319,7 +318,7 @@ xen_swiotlb_alloc_coherent(struct device *hwdev, size_t size, else { if (xen_create_contiguous_region(phys, order, fls64(dma_mask), dma_handle) != 0) { - xen_free_coherent_pages(hwdev, size, ret, (dma_addr_t)phys, attrs); + dma_direct_free(hwdev, size, ret, (dma_addr_t)phys, attrs); return NULL; } SetPageXenRemapped(virt_to_page(ret)); @@ -351,7 +350,7 @@ xen_swiotlb_free_coherent(struct device *hwdev, size_t size, void *vaddr, TestClearPageXenRemapped(virt_to_page(vaddr))) xen_destroy_contiguous_region(phys, order); - xen_free_coherent_pages(hwdev, size, vaddr, (dma_addr_t)phys, attrs); + dma_direct_free(hwdev, size, vaddr, (dma_addr_t)phys, attrs); } /* diff --git a/include/xen/arm/page-coherent.h b/include/xen/arm/page-coherent.h index a840d6949a87..0e244f4fec1a 100644 --- a/include/xen/arm/page-coherent.h +++ b/include/xen/arm/page-coherent.h @@ -16,18 +16,6 @@ void __xen_dma_sync_single_for_cpu(struct device *hwdev, void __xen_dma_sync_single_for_device(struct device *hwdev, dma_addr_t handle, size_t size, enum dma_data_direction dir); -static inline void *xen_alloc_coherent_pages(struct device *hwdev, size_t size, - dma_addr_t *dma_handle, gfp_t flags, unsigned long attrs) -{ - return dma_direct_alloc(hwdev, size, dma_handle, flags, attrs); -} - -static inline void xen_free_coherent_pages(struct device *hwdev, size_t size, - void *cpu_addr, dma_addr_t dma_handle, unsigned long attrs) -{ - dma_direct_free(hwdev, size, cpu_addr, dma_handle, attrs); -} - static inline void xen_dma_sync_single_for_cpu(struct device *hwdev, dma_addr_t handle, size_t size, enum dma_data_direction dir) { -- 2.20.1 ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
[Xen-devel] [PATCH 11/11] arm64: use asm-generic/dma-mapping.h
Now that the Xen special cases are gone nothing worth mentioning is left in the arm64 file, so switch to use the asm-generic version instead. Signed-off-by: Christoph Hellwig Acked-by: Will Deacon --- arch/arm64/include/asm/Kbuild| 1 + arch/arm64/include/asm/dma-mapping.h | 22 -- arch/arm64/mm/dma-mapping.c | 1 + 3 files changed, 2 insertions(+), 22 deletions(-) delete mode 100644 arch/arm64/include/asm/dma-mapping.h diff --git a/arch/arm64/include/asm/Kbuild b/arch/arm64/include/asm/Kbuild index c52e151afab0..98a5405c8558 100644 --- a/arch/arm64/include/asm/Kbuild +++ b/arch/arm64/include/asm/Kbuild @@ -4,6 +4,7 @@ generic-y += delay.h generic-y += div64.h generic-y += dma.h generic-y += dma-contiguous.h +generic-y += dma-mapping.h generic-y += early_ioremap.h generic-y += emergency-restart.h generic-y += hw_irq.h diff --git a/arch/arm64/include/asm/dma-mapping.h b/arch/arm64/include/asm/dma-mapping.h deleted file mode 100644 index 67243255a858.. --- a/arch/arm64/include/asm/dma-mapping.h +++ /dev/null @@ -1,22 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * Copyright (C) 2012 ARM Ltd. - */ -#ifndef __ASM_DMA_MAPPING_H -#define __ASM_DMA_MAPPING_H - -#ifdef __KERNEL__ - -#include -#include - -#include -#include - -static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) -{ - return NULL; -} - -#endif /* __KERNEL__ */ -#endif /* __ASM_DMA_MAPPING_H */ diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c index 4b244a037349..6578abcfbbc7 100644 --- a/arch/arm64/mm/dma-mapping.c +++ b/arch/arm64/mm/dma-mapping.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include -- 2.20.1 ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
[Xen-devel] [PATCH 07/11] swiotlb-xen: use the same foreign page check everywhere
xen_dma_map_page uses a different and more complicated check for foreign pages than the other three cache maintainance helpers. Switch it to the simpler pfn_valid method a well, and document the scheme with a single improved comment in xen_dma_map_page. Signed-off-by: Christoph Hellwig --- include/xen/arm/page-coherent.h | 31 +-- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/include/xen/arm/page-coherent.h b/include/xen/arm/page-coherent.h index 0e244f4fec1a..07c104dbc21f 100644 --- a/include/xen/arm/page-coherent.h +++ b/include/xen/arm/page-coherent.h @@ -41,23 +41,17 @@ static inline void xen_dma_map_page(struct device *hwdev, struct page *page, dma_addr_t dev_addr, unsigned long offset, size_t size, enum dma_data_direction dir, unsigned long attrs) { - unsigned long page_pfn = page_to_xen_pfn(page); - unsigned long dev_pfn = XEN_PFN_DOWN(dev_addr); - unsigned long compound_pages = - (1
[Xen-devel] [PATCH 05/11] xen: remove the exports for xen_{create, destroy}_contiguous_region
These routines are only used by swiotlb-xen, which cannot be modular. Signed-off-by: Christoph Hellwig --- arch/arm/xen/mm.c | 2 -- arch/x86/xen/mmu_pv.c | 2 -- 2 files changed, 4 deletions(-) diff --git a/arch/arm/xen/mm.c b/arch/arm/xen/mm.c index 9b3a6c0ca681..b7d53415532b 100644 --- a/arch/arm/xen/mm.c +++ b/arch/arm/xen/mm.c @@ -155,13 +155,11 @@ int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order, *dma_handle = pstart; return 0; } -EXPORT_SYMBOL_GPL(xen_create_contiguous_region); void xen_destroy_contiguous_region(phys_addr_t pstart, unsigned int order) { return; } -EXPORT_SYMBOL_GPL(xen_destroy_contiguous_region); int __init xen_mm_init(void) { diff --git a/arch/x86/xen/mmu_pv.c b/arch/x86/xen/mmu_pv.c index 26e8b326966d..c8dbee62ec2a 100644 --- a/arch/x86/xen/mmu_pv.c +++ b/arch/x86/xen/mmu_pv.c @@ -2625,7 +2625,6 @@ int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order, *dma_handle = virt_to_machine(vstart).maddr; return success ? 0 : -ENOMEM; } -EXPORT_SYMBOL_GPL(xen_create_contiguous_region); void xen_destroy_contiguous_region(phys_addr_t pstart, unsigned int order) { @@ -2660,7 +2659,6 @@ void xen_destroy_contiguous_region(phys_addr_t pstart, unsigned int order) spin_unlock_irqrestore(&xen_reservation_lock, flags); } -EXPORT_SYMBOL_GPL(xen_destroy_contiguous_region); static noinline void xen_flush_tlb_all(void) { -- 2.20.1 ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
[Xen-devel] [PATCH 10/11] swiotlb-xen: merge xen_unmap_single into xen_swiotlb_unmap_page
No need for a no-op wrapper. Signed-off-by: Christoph Hellwig --- drivers/xen/swiotlb-xen.c | 15 --- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c index 95911ff9c11c..384304a77020 100644 --- a/drivers/xen/swiotlb-xen.c +++ b/drivers/xen/swiotlb-xen.c @@ -414,9 +414,8 @@ static dma_addr_t xen_swiotlb_map_page(struct device *dev, struct page *page, * After this call, reads by the cpu to the buffer are guaranteed to see * whatever the device wrote there. */ -static void xen_unmap_single(struct device *hwdev, dma_addr_t dev_addr, -size_t size, enum dma_data_direction dir, -unsigned long attrs) +static void xen_swiotlb_unmap_page(struct device *hwdev, dma_addr_t dev_addr, + size_t size, enum dma_data_direction dir, unsigned long attrs) { phys_addr_t paddr = xen_bus_to_phys(dev_addr); @@ -430,13 +429,6 @@ static void xen_unmap_single(struct device *hwdev, dma_addr_t dev_addr, swiotlb_tbl_unmap_single(hwdev, paddr, size, dir, attrs); } -static void xen_swiotlb_unmap_page(struct device *hwdev, dma_addr_t dev_addr, - size_t size, enum dma_data_direction dir, - unsigned long attrs) -{ - xen_unmap_single(hwdev, dev_addr, size, dir, attrs); -} - static void xen_swiotlb_sync_single_for_cpu(struct device *dev, dma_addr_t dma_addr, size_t size, enum dma_data_direction dir) @@ -477,7 +469,8 @@ xen_swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sgl, int nelems, BUG_ON(dir == DMA_NONE); for_each_sg(sgl, sg, nelems, i) - xen_unmap_single(hwdev, sg->dma_address, sg_dma_len(sg), dir, attrs); + xen_swiotlb_unmap_page(hwdev, sg->dma_address, sg_dma_len(sg), + dir, attrs); } -- 2.20.1 ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH 06/14] livepatch: Add support for apply|revert action replacement hooks
> Yes, I could do that. But, I would like to discuss (get guidelines about) the > expected test coverage. > With this sort of changes, there is an unlimited set of test-cases to be > created. So, I would like to focus on a few most important. > I am missing knowledge how these test cases are supposed to be used… hence > the ask. I had in mind two livepatches with a dependency on each other that would utilize different callback mechanism. Say the first one just modifies xen_extra_function to print based on a string variable. Applying it would change extra version to say 'FIRST_LIVEPATCH' or such. The second one has an apply and revert callback that modifies the xen_extra_function to print say 'SECOND_LIVEPATCH' and also 'SECOND_REVERTED' when reverted? So you would have: xen-livepatch apply xen_first xl version |grep extra_version [should have FIRST_LIVEPATCH] xen-livepatch apply xen_second xl version |grep extra_version [should have SECOND_LIVEPATCH] xen-livepatch revert xen_second xl version |grep extra_version [should have SECOND_REVERTED] or such? Just want to make sure that the code that is doing the various combinations of callbacks is behaving correctly. Naturally doing all of them would be rather difficult, so I would rather test the most common use-case. Hope this helps? > > Best Regards, > Pawel Wieczorkiewicz > > > > Amazon Development Center Germany GmbH > Krausenstr. 38 > 10117 Berlin > Geschaeftsfuehrung: Christian Schlaeger, Ralf Herbrich > Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B > Sitz: Berlin > Ust-ID: DE 289 237 879 > > ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
[Xen-devel] [linux-4.14 test] 140642: regressions - FAIL
flight 140642 linux-4.14 real [real] http://logs.test-lab.xenproject.org/osstest/logs/140642/ Regressions :-( Tests which did not succeed and are blocking, including tests which could not be run: test-amd64-i386-xl-qemut-stubdom-debianhvm-amd64-xsm 7 xen-boot fail REGR. vs. 139910 test-amd64-amd64-xl-pvshim 15 guest-saverestorefail REGR. vs. 139910 test-amd64-i386-xl-qemuu-dmrestrict-amd64-dmrestrict 12 guest-start/debianhvm.repeat fail REGR. vs. 139910 test-amd64-amd64-xl-qemuu-ovmf-amd64 18 guest-start/debianhvm.repeat fail REGR. vs. 139910 test-armhf-armhf-libvirt 19 leak-check/check fail REGR. vs. 139910 Tests which did not succeed, but are not blocking: test-amd64-i386-xl-pvshim12 guest-start fail never pass test-amd64-i386-libvirt-xsm 13 migrate-support-checkfail never pass test-amd64-amd64-libvirt 13 migrate-support-checkfail never pass test-amd64-amd64-libvirt-xsm 13 migrate-support-checkfail never pass test-amd64-i386-libvirt 13 migrate-support-checkfail never pass test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm 11 migrate-support-check fail never pass test-arm64-arm64-xl-seattle 13 migrate-support-checkfail never pass test-arm64-arm64-xl-seattle 14 saverestore-support-checkfail never pass test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm 11 migrate-support-check fail never pass test-arm64-arm64-xl 13 migrate-support-checkfail never pass test-arm64-arm64-xl 14 saverestore-support-checkfail never pass test-amd64-amd64-qemuu-nested-amd 17 debian-hvm-install/l1/l2 fail never pass test-arm64-arm64-xl-credit2 13 migrate-support-checkfail never pass test-arm64-arm64-xl-credit2 14 saverestore-support-checkfail never pass test-arm64-arm64-xl-xsm 13 migrate-support-checkfail never pass test-arm64-arm64-xl-xsm 14 saverestore-support-checkfail never pass test-arm64-arm64-xl-credit1 13 migrate-support-checkfail never pass test-arm64-arm64-xl-credit1 14 saverestore-support-checkfail never pass test-arm64-arm64-libvirt-xsm 13 migrate-support-checkfail never pass test-arm64-arm64-libvirt-xsm 14 saverestore-support-checkfail never pass test-arm64-arm64-xl-thunderx 13 migrate-support-checkfail never pass test-arm64-arm64-xl-thunderx 14 saverestore-support-checkfail never pass test-amd64-amd64-libvirt-vhd 12 migrate-support-checkfail never pass test-armhf-armhf-xl-arndale 13 migrate-support-checkfail never pass test-armhf-armhf-xl-arndale 14 saverestore-support-checkfail never pass test-amd64-i386-xl-qemut-win7-amd64 17 guest-stop fail never pass test-amd64-amd64-xl-qemuu-ws16-amd64 17 guest-stop fail never pass test-armhf-armhf-xl-credit2 13 migrate-support-checkfail never pass test-armhf-armhf-xl-credit2 14 saverestore-support-checkfail never pass test-amd64-i386-xl-qemuu-win7-amd64 17 guest-stop fail never pass test-amd64-amd64-xl-qemuu-win7-amd64 17 guest-stop fail never pass test-armhf-armhf-xl-credit1 13 migrate-support-checkfail never pass test-armhf-armhf-xl-credit1 14 saverestore-support-checkfail never pass test-armhf-armhf-xl 13 migrate-support-checkfail never pass test-armhf-armhf-xl 14 saverestore-support-checkfail never pass test-armhf-armhf-xl-multivcpu 13 migrate-support-checkfail never pass test-armhf-armhf-xl-multivcpu 14 saverestore-support-checkfail never pass test-armhf-armhf-xl-rtds 13 migrate-support-checkfail never pass test-armhf-armhf-xl-rtds 14 saverestore-support-checkfail never pass test-armhf-armhf-xl-cubietruck 13 migrate-support-checkfail never pass test-armhf-armhf-xl-cubietruck 14 saverestore-support-checkfail never pass test-armhf-armhf-libvirt 13 migrate-support-checkfail never pass test-armhf-armhf-libvirt 14 saverestore-support-checkfail never pass test-amd64-i386-xl-qemut-ws16-amd64 17 guest-stop fail never pass test-amd64-amd64-xl-qemut-ws16-amd64 17 guest-stop fail never pass test-armhf-armhf-libvirt-raw 12 migrate-support-checkfail never pass test-armhf-armhf-libvirt-raw 13 saverestore-support-checkfail never pass test-amd64-amd64-xl-qemut-win7-amd64 17 guest-stop fail never pass test-armhf-armhf-xl-vhd 12 migrate-support-checkfail never pass test-armhf-armhf-xl-vhd 13 saverestore-support-checkfail never pass test-amd64-i386-xl-qemuu-ws16-amd64 17 guest-stop fail never pass test-amd64-amd64-xl-qemuu-win10-i386 10 windows-installfail never pass test-amd64-amd64-xl-qemut-win10-i386 10 windows-installfail never pass test-amd64-i386-xl-qemuu-win10-
Re: [Xen-devel] [RFC PATCH v2 1/3] x86/mm/tlb: Change __flush_tlb_one_user interface
> On Aug 26, 2019, at 12:51 AM, Juergen Gross wrote: > > On 24.08.19 00:52, Nadav Amit wrote: >> __flush_tlb_one_user() currently flushes a single entry, and flushes it >> both in the kernel and user page-tables, when PTI is enabled. >> Change __flush_tlb_one_user() and related interfaces into >> __flush_tlb_range() that flushes a range and does not flush the user >> page-table. >> This refactoring is needed for the next patch, but regardless makes >> sense and has several advantages. First, only Xen-PV, which does not >> use PTI, implements the paravirtual interface of flush_tlb_one_user() so >> nothing is broken by separating the user and kernel page-table flushes, >> and the interface is more intuitive. >> Second, INVLPG can flush unrelated mappings, and it is also a >> serializing instruction. It is better to have a tight loop that flushes >> the entries. >> Third, currently __flush_tlb_one_kernel() also flushes the user >> page-tables, which is not needed. This allows to avoid this redundant >> flush. >> Cc: Boris Ostrovsky >> Cc: Juergen Gross >> Cc: Stefano Stabellini >> Cc: xen-devel@lists.xenproject.org >> Signed-off-by: Nadav Amit >> --- >> arch/x86/include/asm/paravirt.h | 5 ++-- >> arch/x86/include/asm/paravirt_types.h | 3 ++- >> arch/x86/include/asm/tlbflush.h | 24 + >> arch/x86/kernel/paravirt.c| 7 ++--- >> arch/x86/mm/tlb.c | 39 ++- >> arch/x86/xen/mmu_pv.c | 21 +-- >> 6 files changed, 62 insertions(+), 37 deletions(-) > > ... > >> diff --git a/arch/x86/xen/mmu_pv.c b/arch/x86/xen/mmu_pv.c >> index 48f7c7eb4dbc..ed68657f5e77 100644 >> --- a/arch/x86/xen/mmu_pv.c >> +++ b/arch/x86/xen/mmu_pv.c >> @@ -1325,22 +1325,27 @@ static noinline void xen_flush_tlb(void) >> preempt_enable(); >> } >> -static void xen_flush_tlb_one_user(unsigned long addr) >> +static void xen_flush_tlb_range(unsigned long start, unsigned long end, >> +u8 stride_shift) >> { >> struct mmuext_op *op; >> struct multicall_space mcs; >> - >> -trace_xen_mmu_flush_tlb_one_user(addr); >> +unsigned long addr; >> preempt_disable(); >> mcs = xen_mc_entry(sizeof(*op)); >> op = mcs.args; >> -op->cmd = MMUEXT_INVLPG_LOCAL; >> -op->arg1.linear_addr = addr & PAGE_MASK; >> -MULTI_mmuext_op(mcs.mc, op, 1, NULL, DOMID_SELF); >> - xen_mc_issue(PARAVIRT_LAZY_MMU); >> +for (addr = start; addr < end; addr += 1ul << stride_shift) { >> +trace_xen_mmu_flush_tlb_one_user(addr); >> + >> +op->cmd = MMUEXT_INVLPG_LOCAL; >> +op->arg1.linear_addr = addr & PAGE_MASK; >> +MULTI_mmuext_op(mcs.mc, op, 1, NULL, DOMID_SELF); >> + >> +xen_mc_issue(PARAVIRT_LAZY_MMU); >> +} > > For this kind of usage (a loop) you should: > > - replace the call of xen_mc_entry() with xen_mc_batch() > - use xen_extend_mmuext_op() for each loop iteration > - call xen_mc_issue() after the loop > > Additionally I'd like you to replace trace_xen_mmu_flush_tlb_one_user() > with trace_xen_mmu_flush_tlb_range() taking all three parameters and > keep it where it was (out of the loop). > > The paravirt parts seem to be okay. Thanks for the quick response. I don’t think the preempt_disable/enable() is needed in this case, but I kept them. Does the following match what you had in mind? --- arch/x86/xen/mmu_pv.c | 25 ++--- include/trace/events/xen.h | 18 -- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/arch/x86/xen/mmu_pv.c b/arch/x86/xen/mmu_pv.c index 48f7c7eb4dbc..faa01591df36 100644 --- a/arch/x86/xen/mmu_pv.c +++ b/arch/x86/xen/mmu_pv.c @@ -1325,20 +1325,23 @@ static noinline void xen_flush_tlb(void) preempt_enable(); } -static void xen_flush_tlb_one_user(unsigned long addr) +static void xen_flush_tlb_range(unsigned long start, unsigned long end, + u8 stride_shift) { - struct mmuext_op *op; - struct multicall_space mcs; - - trace_xen_mmu_flush_tlb_one_user(addr); + struct mmuext_op op; + unsigned long addr; preempt_disable(); - mcs = xen_mc_entry(sizeof(*op)); - op = mcs.args; - op->cmd = MMUEXT_INVLPG_LOCAL; - op->arg1.linear_addr = addr & PAGE_MASK; - MULTI_mmuext_op(mcs.mc, op, 1, NULL, DOMID_SELF); + xen_mc_batch(); + op.cmd = MMUEXT_INVLPG_LOCAL; + + trace_xen_mmu_flush_tlb_range(start, end, stride_shift); + + for (addr = start; addr < end; addr += 1ul << stride_shift) { + op.arg1.linear_addr = addr & PAGE_MASK; + xen_extend_mmuext_op(&op); + } xen_mc_issue(PARAVIRT_LAZY_MMU); @@ -2394,7 +2397,7 @@ static const struct pv_mmu_ops xen_mmu_ops __initconst = { .flush_tlb_user = xen_flush_tlb, .flush_tlb_kernel = xen_flush_tlb, - .flush_tl
Re: [Xen-devel] [RFC] Code of Conduct
From: Rich Persaud Date: Friday, 16 August 2019 at 16:49 To: George Dunlap Cc: Lars Kurth , xen-devel , "minios-de...@lists.xenproject.org" , "mirageos-de...@lists.xenproject.org" , "win-pv-de...@lists.xenproject.org" , "committ...@xenproject.org" Subject: Re: [Xen-devel] [RFC] Code of Conduct Snip Hi George, Thanks for the detailed response. Lars noted that the proposed Xen CoC is nearly identical to Contributor Covenant, which has been adopted by many organizations, including teams at Intel and Google. My comment, from https://lists.gt.net/xen/devel/561686#561686 Without getting into the merits of Contributor Covenant, there is value in reusing an "upstream CoC" that has been vetted by many organizations and is being continually tested in the real world. Similar to the "macro supply chain" topic: if Xen Project must make changes to the upstream CoC, these can be done as a logical patch (rather than an orphaned fork) so we can incorporate upstream improvements. The rationale for each diff against the upstream CoC can be in a revision-controlled doc, so that future CoC maintainers understand the reasoning behind each diff, as communities and contributors evolve. Your discussion above clearly covers differences between Contributor Covenant and Xen's CoC, and could be translated to text suitable for commit messages, with one commit per diff from an upstream CoC. Rich This is not really productive. I was looking for concrete feedback, but we ended up with a long discussion with no actionable items that can help resolve the discussion. How about the following: · Make a proposal based on the Contributor Covenant · Try and address some of the key customizations which I have been trying to make (which George outlined nicely) This shouldn’t take much longer than the time you, George and I spent on this email thread already. You can follow the methodology you propose We can then compare the output and decide which one to go for Lars Thank you for the chat at Security Summit. So, I think we concluded that the direction we are going in is roughly correct. In the meantime, I had talked to the LF. There is currently an initiative to provide the following * General advice on how to choose and customize CoCs – almost certainly Contributor Covenant will be on that list * A template and set of best practices on how to implement enforcement + training around it I did raise the issue of a cross-project support network, which has not yet been on the agenda. I will be hooked into this process. My gut feeling is that we are looking at 6-9 months before all of this is resolved. Maybe longer. Ultimately, we have 3 options: 1. We wait for the LF and revisit then 2. We go our own way re customization 3. We draft our own customizations and bring it up in one of the LF meetings discussing this My gut feeling is to go for c) and I am willing to have a try at customizing the Contributor Covenant along the lines of the previous exercise What do people think? Regards Lars ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
[Xen-devel] [linux-linus test] 140648: regressions - FAIL
flight 140648 linux-linus real [real] http://logs.test-lab.xenproject.org/osstest/logs/140648/ Regressions :-( Tests which did not succeed and are blocking, including tests which could not be run: test-amd64-i386-xl-qemut-stubdom-debianhvm-amd64-xsm 7 xen-boot fail REGR. vs. 133580 test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm 7 xen-boot fail REGR. vs. 133580 test-amd64-i386-xl-xsm7 xen-boot fail REGR. vs. 133580 test-amd64-i386-libvirt-xsm 7 xen-boot fail REGR. vs. 133580 build-armhf-pvops 6 kernel-build fail REGR. vs. 133580 build-amd64 6 xen-buildfail REGR. vs. 133580 test-arm64-arm64-libvirt-xsm 16 guest-start/debian.repeat fail REGR. vs. 133580 Tests which did not succeed, but are not blocking: test-amd64-i386-libvirt 1 build-check(1) blocked n/a test-amd64-amd64-xl-multivcpu 1 build-check(1) blocked n/a test-amd64-amd64-xl 1 build-check(1) blocked n/a test-amd64-amd64-xl-qemuu-debianhvm-amd64-shadow 1 build-check(1) blocked n/a test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm 1 build-check(1) blocked n/a test-armhf-armhf-xl-arndale 1 build-check(1) blocked n/a test-amd64-i386-freebsd10-i386 1 build-check(1) blocked n/a test-amd64-amd64-libvirt 1 build-check(1) blocked n/a test-amd64-i386-xl-qemut-ws16-amd64 1 build-check(1) blocked n/a test-amd64-amd64-qemuu-nested-amd 1 build-check(1) blocked n/a test-amd64-i386-xl-pvshim 1 build-check(1) blocked n/a test-armhf-armhf-xl-multivcpu 1 build-check(1) blocked n/a test-amd64-amd64-pair 1 build-check(1) blocked n/a test-amd64-amd64-xl-qemut-debianhvm-amd64 1 build-check(1)blocked n/a test-amd64-i386-examine 1 build-check(1) blocked n/a test-amd64-i386-xl-qemuu-debianhvm-amd64 1 build-check(1) blocked n/a test-amd64-amd64-xl-qemut-ws16-amd64 1 build-check(1) blocked n/a test-amd64-i386-pair 1 build-check(1) blocked n/a test-amd64-amd64-pygrub 1 build-check(1) blocked n/a test-amd64-i386-qemuu-rhel6hvm-intel 1 build-check(1) blocked n/a test-amd64-i386-xl-qemuu-dmrestrict-amd64-dmrestrict 1 build-check(1) blocked n/a test-amd64-i386-xl-qemut-debianhvm-amd64 1 build-check(1) blocked n/a test-amd64-i386-xl-qemuu-win7-amd64 1 build-check(1) blocked n/a test-amd64-amd64-xl-qemut-win7-amd64 1 build-check(1) blocked n/a test-amd64-amd64-qemuu-nested-intel 1 build-check(1) blocked n/a test-amd64-i386-xl-qemuu-debianhvm-amd64-shadow 1 build-check(1) blocked n/a test-amd64-i386-libvirt-pair 1 build-check(1) blocked n/a test-armhf-armhf-xl 1 build-check(1) blocked n/a test-amd64-i386-qemuu-rhel6hvm-amd 1 build-check(1) blocked n/a test-amd64-amd64-libvirt-xsm 1 build-check(1) blocked n/a test-amd64-i386-freebsd10-amd64 1 build-check(1) blocked n/a test-amd64-i386-xl-shadow 1 build-check(1) blocked n/a test-amd64-amd64-xl-pvshim1 build-check(1) blocked n/a test-amd64-amd64-xl-qemuu-debianhvm-amd64 1 build-check(1)blocked n/a test-armhf-armhf-libvirt-raw 1 build-check(1) blocked n/a test-amd64-amd64-xl-rtds 1 build-check(1) blocked n/a test-amd64-amd64-i386-pvgrub 1 build-check(1) blocked n/a test-amd64-amd64-libvirt-vhd 1 build-check(1) blocked n/a test-amd64-i386-xl-qemuu-ws16-amd64 1 build-check(1) blocked n/a test-amd64-amd64-amd64-pvgrub 1 build-check(1) blocked n/a build-amd64-libvirt 1 build-check(1) blocked n/a test-amd64-i386-xl-qemuu-win10-i386 1 build-check(1) blocked n/a test-armhf-armhf-xl-cubietruck 1 build-check(1) blocked n/a test-amd64-i386-xl1 build-check(1) blocked n/a test-amd64-i386-xl-qemut-win10-i386 1 build-check(1) blocked n/a test-amd64-amd64-xl-shadow1 build-check(1) blocked n/a test-armhf-armhf-xl-vhd 1 build-check(1) blocked n/a test-amd64-amd64-xl-qemuu-dmrestrict-amd64-dmrestrict 1 build-check(1) blocked n/a test-amd64-i386-qemut-rhel6hvm-intel 1 build-check(1) blocked n/a test-amd64-amd64-xl-pvhv2-intel 1 build-check(1) blocked n/a test-armhf-armhf-xl-credit2 1 build-check(1) blocked n/a test-amd64-amd64-xl-credit1 1 build-check(1) blocked n/a test-amd64-amd64-examine 1 build-check(1) blocked n/a test-armhf-armhf-xl-credit1 1 build-check(1) blocked
[Xen-devel] [xen-unstable test] 140645: regressions - FAIL
flight 140645 xen-unstable real [real] http://logs.test-lab.xenproject.org/osstest/logs/140645/ Regressions :-( Tests which did not succeed and are blocking, including tests which could not be run: test-amd64-amd64-xl-pvshim 12 guest-start fail REGR. vs. 139876 build-amd64-xsm 6 xen-build fail in 140603 REGR. vs. 139876 build-amd64 6 xen-build fail in 140627 REGR. vs. 139876 Tests which are failing intermittently (not blocking): test-amd64-amd64-xl-qemuu-ovmf-amd64 16 guest-localmigrate/x10 fail in 140603 pass in 140645 test-amd64-i386-xl-qemuu-ovmf-amd64 18 guest-start/debianhvm.repeat fail in 140603 pass in 140645 test-xtf-amd64-amd64-27 xen-boot fail pass in 140603 test-armhf-armhf-libvirt 19 leak-check/check fail pass in 140627 Tests which did not succeed, but are not blocking: test-amd64-i386-xl-qemuu-debianhvm-i386-xsm 1 build-check(1) blocked in 140603 n/a test-amd64-i386-xl-xsm1 build-check(1) blocked in 140603 n/a test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm 1 build-check(1) blocked in 140603 n/a test-amd64-i386-xl-qemut-stubdom-debianhvm-amd64-xsm 1 build-check(1) blocked in 140603 n/a test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm 1 build-check(1) blocked in 140603 n/a test-amd64-amd64-xl-qemut-stubdom-debianhvm-amd64-xsm 1 build-check(1) blocked in 140603 n/a test-amd64-amd64-xl-qemuu-debianhvm-i386-xsm 1 build-check(1) blocked in 140603 n/a test-amd64-i386-libvirt-xsm 1 build-check(1) blocked in 140603 n/a test-amd64-i386-xl-qemut-debianhvm-i386-xsm 1 build-check(1) blocked in 140603 n/a test-amd64-amd64-xl-xsm 1 build-check(1) blocked in 140603 n/a test-amd64-amd64-xl-qemut-debianhvm-i386-xsm 1 build-check(1) blocked in 140603 n/a test-amd64-amd64-libvirt-xsm 1 build-check(1) blocked in 140603 n/a test-amd64-i386-xl-pvshim 1 build-check(1) blocked in 140627 n/a test-amd64-amd64-i386-pvgrub 1 build-check(1) blocked in 140627 n/a test-amd64-i386-migrupgrade 1 build-check(1) blocked in 140627 n/a test-amd64-i386-xl-qemuu-ovmf-amd64 1 build-check(1)blocked in 140627 n/a test-amd64-amd64-xl-qemut-ws16-amd64 1 build-check(1) blocked in 140627 n/a test-amd64-amd64-pair 1 build-check(1) blocked in 140627 n/a test-amd64-i386-libvirt 1 build-check(1) blocked in 140627 n/a test-amd64-amd64-xl-pvhv2-intel 1 build-check(1)blocked in 140627 n/a test-amd64-amd64-livepatch1 build-check(1) blocked in 140627 n/a test-amd64-amd64-xl-credit2 1 build-check(1) blocked in 140627 n/a test-amd64-amd64-xl-rtds 1 build-check(1) blocked in 140627 n/a test-amd64-i386-freebsd10-amd64 1 build-check(1)blocked in 140627 n/a test-amd64-i386-qemuu-rhel6hvm-intel 1 build-check(1) blocked in 140627 n/a test-amd64-i386-examine 1 build-check(1) blocked in 140627 n/a test-amd64-i386-pair 1 build-check(1) blocked in 140627 n/a test-amd64-i386-qemut-rhel6hvm-amd 1 build-check(1) blocked in 140627 n/a test-amd64-amd64-xl-multivcpu 1 build-check(1) blocked in 140627 n/a test-amd64-amd64-xl-qemuu-ovmf-amd64 1 build-check(1) blocked in 140627 n/a test-amd64-i386-qemuu-rhel6hvm-amd 1 build-check(1) blocked in 140627 n/a test-amd64-amd64-qemuu-nested-amd 1 build-check(1) blocked in 140627 n/a test-amd64-i386-xl-raw1 build-check(1) blocked in 140627 n/a test-amd64-i386-xl-qemuu-debianhvm-amd64-shadow 1 build-check(1) blocked in 140627 n/a test-amd64-i386-xl-qemut-win7-amd64 1 build-check(1)blocked in 140627 n/a test-amd64-i386-libvirt-pair 1 build-check(1) blocked in 140627 n/a test-amd64-i386-xl-qemuu-ws16-amd64 1 build-check(1)blocked in 140627 n/a test-amd64-i386-xl-qemut-debianhvm-amd64 1 build-check(1) blocked in 140627 n/a test-amd64-amd64-xl-credit1 1 build-check(1) blocked in 140627 n/a test-amd64-i386-xl1 build-check(1) blocked in 140627 n/a test-amd64-amd64-libvirt-vhd 1 build-check(1) blocked in 140627 n/a test-amd64-amd64-pygrub 1 build-check(1) blocked in 140627 n/a test-xtf-amd64-amd64-31 build-check(1) blocked in 140627 n/a test-amd64-amd64-xl-pvhv2-amd 1 build-check(1) blocked in 140627 n/a test-amd64-amd64-xl-qemut-win10-i386 1 build-check(1) blocked in 140627 n/a test-amd64-amd64-libvirt 1 build-check(1) blocked in 140627 n/a test-amd64-i386-qemut-rhel6hvm-intel 1 build-check(1) blocked in 140627 n/a test-amd64-amd64-qemuu-nested-intel 1 build-check(1)blocked in 140627 n/a test-amd64-amd64-xl-qemuu-debianhvm-amd64-shadow 1 build-check(1) blocked in 140627 n/a test-amd64-amd64-xl-qcow2 1 build-check(1) blocked in 140627 n/a t
Re: [Xen-devel] [PATCH V3 2/2] Xen/PCIback: Implement PCI flr/slot/bus reset with 'reset' SysFS attribute
Hi, On Mon, Oct 08, 2018 at 10:32:45AM -0400, Boris Ostrovsky wrote: > On 10/3/18 11:51 AM, Pasi Kärkkäinen wrote: > > On Wed, Sep 19, 2018 at 11:05:26AM +0200, Roger Pau Monné wrote: > >> On Tue, Sep 18, 2018 at 02:09:53PM -0400, Boris Ostrovsky wrote: > >>> On 9/18/18 5:32 AM, George Dunlap wrote: > > On Sep 18, 2018, at 8:15 AM, Pasi Kärkkäinen wrote: > > > > Hi, > > > > On Mon, Sep 17, 2018 at 02:06:02PM -0400, Boris Ostrovsky wrote: > >> What about the toolstack changes? Have they been accepted? I vaguely > >> recall there was a discussion about those changes but don't remember > >> how > >> it ended. > >> > > I don't think toolstack/libxl patch has been applied yet either. > > > > > > "[PATCH V1 0/1] Xen/Tools: PCI reset using 'reset' SysFS attribute": > > https://lists.xen.org/archives/html/xen-devel/2017-12/msg00664.html > > > > "[PATCH V1 1/1] Xen/libxl: Perform PCI reset using 'reset' SysFS > > attribute": > > https://lists.xen.org/archives/html/xen-devel/2017-12/msg00663.html > >>> > >>> Will this patch work for *BSD? Roger? > >> At least FreeBSD don't support pci-passthrough, so none of this works > >> ATM. There's no sysfs on BSD, so much of what's in libxl_pci.c will > >> have to be moved to libxl_linux.c when BSD support is added. > >> > > Ok. That sounds like it's OK for the initial pci 'reset' implementation in > > xl/libxl to be linux-only.. > > > > Are these two patches still needed? ISTR they were written originally > to deal with guest trying to use device that was previously assigned to > another guest. But pcistub_put_pci_dev() calls > __pci_reset_function_locked() which first tries FLR, and it looks like > it was added relatively recently. > Replying to an old thread.. I only now realized I forgot to reply to this message earlier. afaik these patches are still needed. Håkon (CC'd) wrote to me in private that he gets a (dom0) Linux kernel crash if he doesn't have these patches applied. Here are the links to both the linux kernel and libxl patches: "[Xen-devel] [PATCH V3 0/2] Xen/PCIback: PCI reset using 'reset' SysFS attribute": https://lists.xen.org/archives/html/xen-devel/2017-12/msg00659.html [Note that PATCH V3 1/2 "Drivers/PCI: Export pcie_has_flr() interface" is already applied in upstream linux kernel, so it's not needed anymore] "[Xen-devel] [PATCH V3 2/2] Xen/PCIback: Implement PCI flr/slot/bus reset with 'reset' SysFS attribute": https://lists.xen.org/archives/html/xen-devel/2017-12/msg00661.html "[Xen-devel] [PATCH V1 0/1] Xen/Tools: PCI reset using 'reset' SysFS attribute": https://lists.xen.org/archives/html/xen-devel/2017-12/msg00664.html "[Xen-devel] [PATCH V1 1/1] Xen/libxl: Perform PCI reset using 'reset' SysFS attribute": https://lists.xen.org/archives/html/xen-devel/2017-12/msg00663.html > > -boris Thanks, -- Pasi ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] Reset pass-thru devices in a VM
Hi Chao, On Fri, Aug 09, 2019 at 04:38:33PM +0800, Chao Gao wrote: > Hi everyone, > > I have a device which only supports secondary bus reset. After being > assigned to a VM, it would be placed under host bridge. For devices > under host bridge, secondary bus reset is not applicable. Thus, a VM > has no way to reset this device. > > This device's usage would be limited without PCI reset (for example, its > driver cannot re-initialize the device properly without PCI reset, which > means in VM device won't be usable after unloading the driver), it would > be much better if there is a way available to VMs to reset the device. > > In my mind, a straightfoward solution is to create a virtual bridge > for a VM and place the pass-thru device under a virtual bridge. But it > isn't supported in Xen (KVM/QEMU supports) and enabling it looks need > a lot of efforts. Alternatively, emulating FLR (Function Level Reset) > capability for this device might be a feasible way and only needs > relatively few changes. I am planning to enable an opt-in feature > (like 'permissive') to allow qemu to expose FLR capability to guest for > pass-thru devices as long as this device is resetable on dom0 (i.e. the > device has 'reset' attribute under its sysfs). And when guest initiates > an FLR, qemu just echo 1 to the 'reset' attribute on dom0. > > Do you think emulating FLR capability is doable? > I wonder if these patches from another thread help with your reset issue: https://lists.xen.org/archives/html/xen-devel/2019-08/msg02304.html Thanks, -- Pasi > Thanks > Chao > ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
[Xen-devel] [linux-4.9 test] 140650: regressions - FAIL
flight 140650 linux-4.9 real [real] http://logs.test-lab.xenproject.org/osstest/logs/140650/ Regressions :-( Tests which did not succeed and are blocking, including tests which could not be run: build-amd64-xsm 6 xen-buildfail REGR. vs. 139936 test-amd64-amd64-xl-qemuu-ovmf-amd64 18 guest-start/debianhvm.repeat fail REGR. vs. 139936 Tests which did not succeed, but are not blocking: test-amd64-i386-xl-qemuu-debianhvm-i386-xsm 1 build-check(1) blocked n/a test-amd64-amd64-xl-qemuu-debianhvm-i386-xsm 1 build-check(1) blocked n/a test-amd64-i386-xl-xsm1 build-check(1) blocked n/a test-amd64-amd64-xl-qemut-debianhvm-i386-xsm 1 build-check(1) blocked n/a test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm 1 build-check(1) blocked n/a test-amd64-i386-xl-qemut-debianhvm-i386-xsm 1 build-check(1) blocked n/a test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm 1 build-check(1) blocked n/a test-amd64-amd64-libvirt-xsm 1 build-check(1) blocked n/a test-amd64-amd64-xl-qemut-stubdom-debianhvm-amd64-xsm 1 build-check(1) blocked n/a test-amd64-i386-xl-qemut-stubdom-debianhvm-amd64-xsm 1 build-check(1) blocked n/a test-amd64-amd64-xl-xsm 1 build-check(1) blocked n/a test-amd64-i386-libvirt-xsm 1 build-check(1) blocked n/a test-amd64-amd64-xl-qemut-win7-amd64 17 guest-stopfail like 139936 test-amd64-i386-xl-qemut-win7-amd64 17 guest-stop fail like 139936 test-amd64-amd64-xl-qemuu-win7-amd64 17 guest-stopfail like 139936 test-amd64-i386-xl-qemuu-win7-amd64 17 guest-stop fail like 139936 test-amd64-amd64-xl-qemuu-ws16-amd64 17 guest-stopfail like 139936 test-amd64-i386-xl-qemuu-dmrestrict-amd64-dmrestrict 10 debian-hvm-install fail never pass test-amd64-amd64-xl-qemuu-dmrestrict-amd64-dmrestrict 10 debian-hvm-install fail never pass test-amd64-amd64-xl-pvhv2-intel 12 guest-start fail never pass test-amd64-amd64-xl-pvhv2-amd 12 guest-start fail never pass test-amd64-i386-libvirt 13 migrate-support-checkfail never pass test-arm64-arm64-xl-seattle 13 migrate-support-checkfail never pass test-arm64-arm64-xl-seattle 14 saverestore-support-checkfail never pass test-amd64-amd64-libvirt 13 migrate-support-checkfail never pass test-arm64-arm64-xl-credit2 13 migrate-support-checkfail never pass test-arm64-arm64-xl-credit2 14 saverestore-support-checkfail never pass test-amd64-i386-xl-pvshim12 guest-start fail never pass test-amd64-amd64-libvirt-vhd 12 migrate-support-checkfail never pass test-arm64-arm64-xl-xsm 13 migrate-support-checkfail never pass test-arm64-arm64-xl-xsm 14 saverestore-support-checkfail never pass test-amd64-amd64-qemuu-nested-amd 17 debian-hvm-install/l1/l2 fail never pass test-arm64-arm64-libvirt-xsm 13 migrate-support-checkfail never pass test-arm64-arm64-libvirt-xsm 14 saverestore-support-checkfail never pass test-arm64-arm64-xl 13 migrate-support-checkfail never pass test-arm64-arm64-xl 14 saverestore-support-checkfail never pass test-arm64-arm64-xl-thunderx 13 migrate-support-checkfail never pass test-armhf-armhf-xl-multivcpu 13 migrate-support-checkfail never pass test-arm64-arm64-xl-thunderx 14 saverestore-support-checkfail never pass test-armhf-armhf-xl-multivcpu 14 saverestore-support-checkfail never pass test-arm64-arm64-xl-credit1 13 migrate-support-checkfail never pass test-arm64-arm64-xl-credit1 14 saverestore-support-checkfail never pass test-armhf-armhf-xl-credit1 13 migrate-support-checkfail never pass test-armhf-armhf-xl-credit1 14 saverestore-support-checkfail never pass test-armhf-armhf-xl 13 migrate-support-checkfail never pass test-armhf-armhf-xl 14 saverestore-support-checkfail never pass test-armhf-armhf-xl-arndale 13 migrate-support-checkfail never pass test-armhf-armhf-xl-arndale 14 saverestore-support-checkfail never pass test-armhf-armhf-libvirt-raw 12 migrate-support-checkfail never pass test-armhf-armhf-libvirt-raw 13 saverestore-support-checkfail never pass test-armhf-armhf-xl-rtds 13 migrate-support-checkfail never pass test-armhf-armhf-xl-rtds 14 saverestore-support-checkfail never pass test-armhf-armhf-libvirt 13 migrate-support-checkfail never pass test-armhf-armhf-libvirt 14 saverestore-support-checkfail never pass test-armhf-armhf-xl-credit2 13 migrate-support-checkfail never pass test-armhf-armhf-xl-credit2 14 saverestore-support-checkfail never pass test-amd64-amd64-xl-qemut-ws16-amd64 17 guest-stop fail never pass
[Xen-devel] [linux-4.4 test] 140653: regressions - FAIL
flight 140653 linux-4.4 real [real] http://logs.test-lab.xenproject.org/osstest/logs/140653/ Regressions :-( Tests which did not succeed and are blocking, including tests which could not be run: test-amd64-amd64-xl-pvshim 20 guest-start/debian.repeat fail in 140632 REGR. vs. 139698 Tests which are failing intermittently (not blocking): test-amd64-i386-xl-qemuu-ovmf-amd64 7 xen-boot fail in 140632 pass in 140653 test-armhf-armhf-xl 7 xen-boot fail in 140632 pass in 140653 test-armhf-armhf-libvirt 19 leak-check/check fail in 140632 pass in 140653 test-amd64-amd64-xl-pvshim 16 guest-localmigrate fail pass in 140632 test-amd64-amd64-xl-qemuu-ovmf-amd64 18 guest-start/debianhvm.repeat fail pass in 140632 Tests which did not succeed, but are not blocking: test-amd64-amd64-xl-qemuu-dmrestrict-amd64-dmrestrict 10 debian-hvm-install fail never pass test-amd64-i386-xl-qemuu-dmrestrict-amd64-dmrestrict 10 debian-hvm-install fail never pass test-amd64-i386-xl-pvshim12 guest-start fail never pass test-amd64-amd64-xl-pvhv2-amd 12 guest-start fail never pass test-arm64-arm64-examine 8 reboot fail never pass test-arm64-arm64-xl-seattle 7 xen-boot fail never pass test-arm64-arm64-libvirt-xsm 7 xen-boot fail never pass test-arm64-arm64-xl 7 xen-boot fail never pass test-amd64-amd64-libvirt-xsm 13 migrate-support-checkfail never pass test-amd64-amd64-xl-pvhv2-intel 12 guest-start fail never pass test-amd64-amd64-libvirt 13 migrate-support-checkfail never pass test-amd64-i386-libvirt 13 migrate-support-checkfail never pass test-amd64-i386-libvirt-xsm 13 migrate-support-checkfail never pass test-arm64-arm64-xl-thunderx 7 xen-boot fail never pass test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm 11 migrate-support-check fail never pass test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm 11 migrate-support-check fail never pass test-amd64-amd64-qemuu-nested-amd 17 debian-hvm-install/l1/l2 fail never pass test-armhf-armhf-xl-arndale 13 migrate-support-checkfail never pass test-armhf-armhf-xl-arndale 14 saverestore-support-checkfail never pass test-amd64-amd64-libvirt-vhd 12 migrate-support-checkfail never pass test-amd64-i386-xl-qemuu-win7-amd64 17 guest-stop fail never pass test-amd64-amd64-xl-qemuu-win7-amd64 17 guest-stop fail never pass test-amd64-amd64-xl-qemut-win7-amd64 17 guest-stop fail never pass test-armhf-armhf-xl-multivcpu 13 migrate-support-checkfail never pass test-armhf-armhf-xl-multivcpu 14 saverestore-support-checkfail never pass test-armhf-armhf-xl-credit1 13 migrate-support-checkfail never pass test-armhf-armhf-xl-credit1 14 saverestore-support-checkfail never pass test-armhf-armhf-xl-rtds 13 migrate-support-checkfail never pass test-armhf-armhf-xl-rtds 14 saverestore-support-checkfail never pass test-armhf-armhf-xl-credit2 13 migrate-support-checkfail never pass test-armhf-armhf-xl-credit2 14 saverestore-support-checkfail never pass test-armhf-armhf-libvirt 13 migrate-support-checkfail never pass test-armhf-armhf-libvirt 14 saverestore-support-checkfail never pass test-amd64-i386-xl-qemut-win7-amd64 17 guest-stop fail never pass test-arm64-arm64-xl-credit1 7 xen-boot fail never pass test-arm64-arm64-xl-credit2 7 xen-boot fail never pass test-arm64-arm64-xl-xsm 7 xen-boot fail never pass test-amd64-amd64-xl-qemut-ws16-amd64 17 guest-stop fail never pass test-armhf-armhf-xl-vhd 12 migrate-support-checkfail never pass test-armhf-armhf-xl-vhd 13 saverestore-support-checkfail never pass test-armhf-armhf-libvirt-raw 12 migrate-support-checkfail never pass test-armhf-armhf-libvirt-raw 13 saverestore-support-checkfail never pass test-armhf-armhf-xl 13 migrate-support-checkfail never pass test-armhf-armhf-xl 14 saverestore-support-checkfail never pass test-amd64-amd64-xl-qemuu-ws16-amd64 17 guest-stop fail never pass test-amd64-i386-xl-qemuu-ws16-amd64 17 guest-stop fail never pass test-amd64-i386-xl-qemut-ws16-amd64 17 guest-stop fail never pass test-amd64-amd64-xl-qemut-win10-i386 10 windows-installfail never pass test-amd64-i386-xl-qemut-win10-i386 10 windows-install fail never pass test-amd64-i386-xl-qemuu-win10-i386 10 windows-install fail never pass test-amd64-amd64-xl-qemuu-win10-i386 10 windows-installfail never pass test-armhf-armhf-xl-cubietruck 13 migrate-support-check
[Xen-devel] [freebsd-master test] 140660: all pass - PUSHED
flight 140660 freebsd-master real [real] http://logs.test-lab.xenproject.org/osstest/logs/140660/ Perfect :-) All tests in this flight passed as required version targeted for testing: freebsd 4438d71949e8a59f2ac2349a450f6965fee6c6e4 baseline version: freebsd 1347212622414842dae7ecda75cbfdd1e5c4cfee Last test of basis 140570 2019-08-23 09:19:55 Z3 days Testing same since 140660 2019-08-26 09:20:30 Z0 days1 attempts People who touched revisions under test: 0mp <0...@freebsd.org> asomers delphij dougm emaste eugen ganbold hrs imp jhb jhibbits kevans kib kp lwhsu markj mav mjg np vmaffione jobs: build-amd64-freebsd-againpass build-amd64-freebsd pass build-amd64-xen-freebsd pass sg-report-flight on osstest.test-lab.xenproject.org logs: /home/logs/logs images: /home/logs/images Logs, config files, etc. are available at http://logs.test-lab.xenproject.org/osstest/logs Explanation of these reports, and of osstest in general, is at http://xenbits.xen.org/gitweb/?p=osstest.git;a=blob;f=README.email;hb=master http://xenbits.xen.org/gitweb/?p=osstest.git;a=blob;f=README;hb=master Test harness code can be found at http://xenbits.xen.org/gitweb?p=osstest.git;a=summary Pushing revision : To xenbits.xen.org:/home/xen/git/freebsd.git 13472126224..4438d71949e 4438d71949e8a59f2ac2349a450f6965fee6c6e4 -> tested/master ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] swiotlb-xen cleanups
On Fri, 16 Aug 2019, Christoph Hellwig wrote: > Hi Xen maintainers and friends, > > please take a look at this series that cleans up the parts of swiotlb-xen > that deal with non-coherent caches. Hi Christoph, I just wanted to let you know that your series is on my radar, but I have been swamped the last few days. I hope to get to it by the end of the week. Cheers, Stefano ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
[Xen-devel] [qemu-mainline test] 140657: regressions - FAIL
flight 140657 qemu-mainline real [real] http://logs.test-lab.xenproject.org/osstest/logs/140657/ Regressions :-( Tests which did not succeed and are blocking, including tests which could not be run: build-amd64-xsm 6 xen-build fail in 140583 REGR. vs. 140282 test-amd64-amd64-xl-pvshim 20 guest-start/debian.repeat fail in 140583 REGR. vs. 140282 Tests which are failing intermittently (not blocking): test-amd64-amd64-i386-pvgrub 7 xen-boot fail in 140635 pass in 140657 test-amd64-amd64-xl-pvshim 18 guest-localmigrate/x10 fail pass in 140583 test-amd64-i386-libvirt-pair 11 xen-boot/dst_host fail pass in 140635 Tests which did not succeed, but are not blocking: test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm 1 build-check(1) blocked in 140583 n/a test-amd64-i386-xl-xsm1 build-check(1) blocked in 140583 n/a test-amd64-amd64-xl-xsm 1 build-check(1) blocked in 140583 n/a test-amd64-amd64-libvirt-xsm 1 build-check(1) blocked in 140583 n/a test-amd64-i386-libvirt-xsm 1 build-check(1) blocked in 140583 n/a test-amd64-amd64-xl-qemuu-debianhvm-i386-xsm 1 build-check(1) blocked in 140583 n/a test-amd64-i386-xl-qemuu-debianhvm-i386-xsm 1 build-check(1) blocked in 140583 n/a test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm 1 build-check(1) blocked in 140583 n/a test-amd64-amd64-xl-qemuu-win7-amd64 17 guest-stopfail like 140282 test-armhf-armhf-libvirt 14 saverestore-support-checkfail like 140282 test-amd64-i386-xl-qemuu-win7-amd64 17 guest-stop fail like 140282 test-amd64-amd64-xl-qemuu-ws16-amd64 17 guest-stopfail like 140282 test-armhf-armhf-libvirt-raw 13 saverestore-support-checkfail like 140282 test-amd64-i386-xl-pvshim12 guest-start fail never pass test-amd64-i386-libvirt 13 migrate-support-checkfail never pass test-amd64-amd64-libvirt 13 migrate-support-checkfail never pass test-amd64-amd64-libvirt-xsm 13 migrate-support-checkfail never pass test-amd64-i386-libvirt-xsm 13 migrate-support-checkfail never pass test-arm64-arm64-xl-seattle 13 migrate-support-checkfail never pass test-arm64-arm64-xl-seattle 14 saverestore-support-checkfail never pass test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm 11 migrate-support-check fail never pass test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm 11 migrate-support-check fail never pass test-arm64-arm64-xl-credit1 13 migrate-support-checkfail never pass test-arm64-arm64-xl-credit1 14 saverestore-support-checkfail never pass test-arm64-arm64-xl-xsm 13 migrate-support-checkfail never pass test-arm64-arm64-xl-xsm 14 saverestore-support-checkfail never pass test-arm64-arm64-xl-credit2 13 migrate-support-checkfail never pass test-arm64-arm64-xl-credit2 14 saverestore-support-checkfail never pass test-arm64-arm64-xl 13 migrate-support-checkfail never pass test-arm64-arm64-xl 14 saverestore-support-checkfail never pass test-amd64-amd64-qemuu-nested-amd 17 debian-hvm-install/l1/l2 fail never pass test-arm64-arm64-xl-thunderx 13 migrate-support-checkfail never pass test-arm64-arm64-xl-thunderx 14 saverestore-support-checkfail never pass test-arm64-arm64-libvirt-xsm 13 migrate-support-checkfail never pass test-arm64-arm64-libvirt-xsm 14 saverestore-support-checkfail never pass test-armhf-armhf-xl-arndale 13 migrate-support-checkfail never pass test-armhf-armhf-xl-arndale 14 saverestore-support-checkfail never pass test-amd64-amd64-libvirt-vhd 12 migrate-support-checkfail never pass test-armhf-armhf-xl 13 migrate-support-checkfail never pass test-armhf-armhf-xl 14 saverestore-support-checkfail never pass test-armhf-armhf-xl-rtds 13 migrate-support-checkfail never pass test-armhf-armhf-xl-rtds 14 saverestore-support-checkfail never pass test-armhf-armhf-xl-multivcpu 13 migrate-support-checkfail never pass test-armhf-armhf-xl-multivcpu 14 saverestore-support-checkfail never pass test-armhf-armhf-xl-credit2 13 migrate-support-checkfail never pass test-armhf-armhf-xl-credit2 14 saverestore-support-checkfail never pass test-armhf-armhf-libvirt 13 migrate-support-checkfail never pass test-armhf-armhf-xl-cubietruck 13 migrate-support-checkfail never pass test-armhf-armhf-xl-cubietruck 14 saverestore-support-checkfail never pass test-armhf-armhf-xl-credit1 13 migrate-support-checkfail never pass test-armhf-armhf-xl-credit1 14 saverestore-support-checkfail never pass test-armhf-armhf-xl-vhd 12 migrate-support-checkfail never pass test-armhf-armhf-xl-vhd 13 saverestore-support-check
Re: [Xen-devel] Reset pass-thru devices in a VM
On Tue, Aug 27, 2019 at 12:17:28AM +0300, Pasi Kärkkäinen wrote: >Hi Chao, > >On Fri, Aug 09, 2019 at 04:38:33PM +0800, Chao Gao wrote: >> Hi everyone, >> >> I have a device which only supports secondary bus reset. After being >> assigned to a VM, it would be placed under host bridge. For devices >> under host bridge, secondary bus reset is not applicable. Thus, a VM >> has no way to reset this device. >> >> This device's usage would be limited without PCI reset (for example, its >> driver cannot re-initialize the device properly without PCI reset, which >> means in VM device won't be usable after unloading the driver), it would >> be much better if there is a way available to VMs to reset the device. >> >> In my mind, a straightfoward solution is to create a virtual bridge >> for a VM and place the pass-thru device under a virtual bridge. But it >> isn't supported in Xen (KVM/QEMU supports) and enabling it looks need >> a lot of efforts. Alternatively, emulating FLR (Function Level Reset) >> capability for this device might be a feasible way and only needs >> relatively few changes. I am planning to enable an opt-in feature >> (like 'permissive') to allow qemu to expose FLR capability to guest for >> pass-thru devices as long as this device is resetable on dom0 (i.e. the >> device has 'reset' attribute under its sysfs). And when guest initiates >> an FLR, qemu just echo 1 to the 'reset' attribute on dom0. >> >> Do you think emulating FLR capability is doable? >> > >I wonder if these patches from another thread help with your reset issue: > >https://lists.xen.org/archives/html/xen-devel/2019-08/msg02304.html Thanks for your attention. The link you provides seems about how host resets a device. Emulating FLR capability is to expose FLR capability to guest such that guest can reset assigned devices. Definitely, qemu would intercept guest's initiating an FLR and redirect it into a device reset on host. Thanks Chao ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH v9 15/15] microcode: block #NMI handling when loading an ucode
On Mon, Aug 26, 2019 at 04:07:59PM +0800, Chao Gao wrote: >On Fri, Aug 23, 2019 at 09:46:37AM +0100, Sergey Dyasli wrote: >>On 19/08/2019 02:25, Chao Gao wrote: >>> register an nmi callback. And this callback does busy-loop on threads >>> which are waiting for loading completion. Control threads send NMI to >>> slave threads to prevent NMI acceptance during ucode loading. >>> >>> Signed-off-by: Chao Gao >>> --- >>> Changes in v9: >>> - control threads send NMI to all other threads. Slave threads will >>> stay in the NMI handling to prevent NMI acceptance during ucode >>> loading. Note that self-nmi is invalid according to SDM. >> >>To me this looks like a half-measure: why keep only slave threads in >>the NMI handler, when master threads can update the microcode from >>inside the NMI handler as well? > >No special reason. Because the issue we want to address is that slave >threads might go to handle NMI and access MSRs when master thread is >loading ucode. So we only keep slave threads in the NMI handler. > >> >>You mention that self-nmi is invalid, but Xen has self_nmi() which is >>used for apply_alternatives() during boot, so can be trusted to work. > >Sorry, I meant using self shorthand to send self-nmi. I tried to use >self shorthand but got APIC error. And I agree that it is better to >make slave thread call self_nmi() itself. > >> >>I experimented a bit with the following approach: after loading_state >>becomes LOADING_CALLIN, each cpu issues a self_nmi() and rendezvous >>via cpu_callin_map into LOADING_ENTER to do a ucode update directly in >>the NMI handler. And it seems to work. >> >>Separate question is about the safety of this approach: can we be sure >>that a ucode update would not reset the status of the NMI latch? I.e. >>can it cause another NMI to be delivered while Xen already handles one? > >Ashok, what's your opinion on Sergey's approach and his concern? Hi Sergey, I talked with Ashok. We think your approach is better. I will follow your approach in v10. It would be much helpful if you post your patch so that I can just rebase it onto other patches. Thanks Chao ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [RFC PATCH v2 1/3] x86/mm/tlb: Change __flush_tlb_one_user interface
On 26.08.19 18:38, Nadav Amit wrote: On Aug 26, 2019, at 12:51 AM, Juergen Gross wrote: On 24.08.19 00:52, Nadav Amit wrote: __flush_tlb_one_user() currently flushes a single entry, and flushes it both in the kernel and user page-tables, when PTI is enabled. Change __flush_tlb_one_user() and related interfaces into __flush_tlb_range() that flushes a range and does not flush the user page-table. This refactoring is needed for the next patch, but regardless makes sense and has several advantages. First, only Xen-PV, which does not use PTI, implements the paravirtual interface of flush_tlb_one_user() so nothing is broken by separating the user and kernel page-table flushes, and the interface is more intuitive. Second, INVLPG can flush unrelated mappings, and it is also a serializing instruction. It is better to have a tight loop that flushes the entries. Third, currently __flush_tlb_one_kernel() also flushes the user page-tables, which is not needed. This allows to avoid this redundant flush. Cc: Boris Ostrovsky Cc: Juergen Gross Cc: Stefano Stabellini Cc: xen-devel@lists.xenproject.org Signed-off-by: Nadav Amit --- arch/x86/include/asm/paravirt.h | 5 ++-- arch/x86/include/asm/paravirt_types.h | 3 ++- arch/x86/include/asm/tlbflush.h | 24 + arch/x86/kernel/paravirt.c| 7 ++--- arch/x86/mm/tlb.c | 39 ++- arch/x86/xen/mmu_pv.c | 21 +-- 6 files changed, 62 insertions(+), 37 deletions(-) ... diff --git a/arch/x86/xen/mmu_pv.c b/arch/x86/xen/mmu_pv.c index 48f7c7eb4dbc..ed68657f5e77 100644 --- a/arch/x86/xen/mmu_pv.c +++ b/arch/x86/xen/mmu_pv.c @@ -1325,22 +1325,27 @@ static noinline void xen_flush_tlb(void) preempt_enable(); } -static void xen_flush_tlb_one_user(unsigned long addr) +static void xen_flush_tlb_range(unsigned long start, unsigned long end, + u8 stride_shift) { struct mmuext_op *op; struct multicall_space mcs; - - trace_xen_mmu_flush_tlb_one_user(addr); + unsigned long addr; preempt_disable(); mcs = xen_mc_entry(sizeof(*op)); op = mcs.args; - op->cmd = MMUEXT_INVLPG_LOCAL; - op->arg1.linear_addr = addr & PAGE_MASK; - MULTI_mmuext_op(mcs.mc, op, 1, NULL, DOMID_SELF); - xen_mc_issue(PARAVIRT_LAZY_MMU); + for (addr = start; addr < end; addr += 1ul << stride_shift) { + trace_xen_mmu_flush_tlb_one_user(addr); + + op->cmd = MMUEXT_INVLPG_LOCAL; + op->arg1.linear_addr = addr & PAGE_MASK; + MULTI_mmuext_op(mcs.mc, op, 1, NULL, DOMID_SELF); + + xen_mc_issue(PARAVIRT_LAZY_MMU); + } For this kind of usage (a loop) you should: - replace the call of xen_mc_entry() with xen_mc_batch() - use xen_extend_mmuext_op() for each loop iteration - call xen_mc_issue() after the loop Additionally I'd like you to replace trace_xen_mmu_flush_tlb_one_user() with trace_xen_mmu_flush_tlb_range() taking all three parameters and keep it where it was (out of the loop). The paravirt parts seem to be okay. Thanks for the quick response. I don’t think the preempt_disable/enable() is needed in this case, but I kept them. Does the following match what you had in mind? Yes, it does. BTW, preempt_disable/enable() is needed as xen_mc_batch() ... xen_mc_issue() is using a percpu buffer. Juergen --- arch/x86/xen/mmu_pv.c | 25 ++--- include/trace/events/xen.h | 18 -- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/arch/x86/xen/mmu_pv.c b/arch/x86/xen/mmu_pv.c index 48f7c7eb4dbc..faa01591df36 100644 --- a/arch/x86/xen/mmu_pv.c +++ b/arch/x86/xen/mmu_pv.c @@ -1325,20 +1325,23 @@ static noinline void xen_flush_tlb(void) preempt_enable(); } -static void xen_flush_tlb_one_user(unsigned long addr) +static void xen_flush_tlb_range(unsigned long start, unsigned long end, + u8 stride_shift) { - struct mmuext_op *op; - struct multicall_space mcs; - - trace_xen_mmu_flush_tlb_one_user(addr); + struct mmuext_op op; + unsigned long addr; preempt_disable(); - mcs = xen_mc_entry(sizeof(*op)); - op = mcs.args; - op->cmd = MMUEXT_INVLPG_LOCAL; - op->arg1.linear_addr = addr & PAGE_MASK; - MULTI_mmuext_op(mcs.mc, op, 1, NULL, DOMID_SELF); + xen_mc_batch(); + op.cmd = MMUEXT_INVLPG_LOCAL; + + trace_xen_mmu_flush_tlb_range(start, end, stride_shift); + + for (addr = start; addr < end; addr += 1ul << stride_shift) { + op.arg1.linear_addr = addr & PAGE_MASK; + xen_extend_mmuext_op(&op); + } xen_mc_issue(PARAVIRT_LAZY_MMU); @@ -2394,7 +2397,7 @@ static const struct pv_mmu_ops xen_mmu_ops __initconst = { .flush_tlb_user = xen_flush_tlb, .flush_tlb_kernel = xen_flush_tl
Re: [Xen-devel] Question on xen-netfront code to fix a potential ring buffer corruption
On 18.08.19 10:31, Dongli Zhang wrote: Hi, Would you please help confirm why the condition at line 908 is ">="? In my opinion, we would only hit "skb_shinfo(skb)->nr_frag == MAX_SKB_FRAGS" at line 908. 890 static RING_IDX xennet_fill_frags(struct netfront_queue *queue, 891 struct sk_buff *skb, 892 struct sk_buff_head *list) 893 { 894 RING_IDX cons = queue->rx.rsp_cons; 895 struct sk_buff *nskb; 896 897 while ((nskb = __skb_dequeue(list))) { 898 struct xen_netif_rx_response *rx = 899 RING_GET_RESPONSE(&queue->rx, ++cons); 900 skb_frag_t *nfrag = &skb_shinfo(nskb)->frags[0]; 901 902 if (skb_shinfo(skb)->nr_frags == MAX_SKB_FRAGS) { 903 unsigned int pull_to = NETFRONT_SKB_CB(skb)->pull_to; 904 905 BUG_ON(pull_to < skb_headlen(skb)); 906 __pskb_pull_tail(skb, pull_to - skb_headlen(skb)); 907 } 908 if (unlikely(skb_shinfo(skb)->nr_frags >= MAX_SKB_FRAGS)) { 909 queue->rx.rsp_cons = ++cons; 910 kfree_skb(nskb); 911 return ~0U; 912 } 913 914 skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, 915 skb_frag_page(nfrag), 916 rx->offset, rx->status, PAGE_SIZE); 917 918 skb_shinfo(nskb)->nr_frags = 0; 919 kfree_skb(nskb); 920 } 921 922 return cons; 923 } The reason that I ask about this is because I am considering below patch to avoid a potential xen-netfront ring buffer corruption. diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c index 8d33970..48a2162 100644 --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c @@ -906,7 +906,7 @@ static RING_IDX xennet_fill_frags(struct netfront_queue *queue, __pskb_pull_tail(skb, pull_to - skb_headlen(skb)); } if (unlikely(skb_shinfo(skb)->nr_frags >= MAX_SKB_FRAGS)) { - queue->rx.rsp_cons = ++cons; + queue->rx.rsp_cons = cons + skb_queue_len(list) + 1; kfree_skb(nskb); return ~0U; } If there is skb left in list when we return ~0U, queue->rx.rsp_cons may be set incorrectly. Sa basically you want to consume the responses for all outstanding skbs in the list? While I am trying to make up a case that would hit the corruption, I could not explain why (unlikely(skb_shinfo(skb)->nr_frags >= MAX_SKB_FRAGS)), but not just "==". Perhaps __pskb_pull_tail() may fail although pull_to is less than skb_headlen(skb). I don't think nr_frags can be larger than MAX_SKB_FRAGS. OTOH I don't think it hurts to have a safety net here in order to avoid problems. Originally this was BUG_ON(skb_shinfo(skb)->nr_frags >= MAX_SKB_FRAGS) so that might explain the ">=". Juergen ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] swiotlb-xen cleanups
On Mon, Aug 26, 2019 at 07:00:44PM -0700, Stefano Stabellini wrote: > On Fri, 16 Aug 2019, Christoph Hellwig wrote: > > Hi Xen maintainers and friends, > > > > please take a look at this series that cleans up the parts of swiotlb-xen > > that deal with non-coherent caches. > > Hi Christoph, > > I just wanted to let you know that your series is on my radar, but I > have been swamped the last few days. I hope to get to it by the end of > the week. Thanks, and no rush. Note that I posted a v2 with a few significant changes yesterday. ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH 03/11] xen/arm: simplify dma_cache_maint
And this was still buggy I think, it really needs some real Xen/Arm testing which I can't do. Hopefully better version below: -- From 5ad4b6e291dbb49f65480c9b769414931cbd485a Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Wed, 24 Jul 2019 15:26:08 +0200 Subject: xen/arm: simplify dma_cache_maint Calculate the required operation in the caller, and pass it directly instead of recalculating it for each page, and use simple arithmetics to get from the physical address to Xen page size aligned chunks. Signed-off-by: Christoph Hellwig --- arch/arm/xen/mm.c | 61 --- 1 file changed, 21 insertions(+), 40 deletions(-) diff --git a/arch/arm/xen/mm.c b/arch/arm/xen/mm.c index 90574d89d0d4..2fde161733b0 100644 --- a/arch/arm/xen/mm.c +++ b/arch/arm/xen/mm.c @@ -35,64 +35,45 @@ unsigned long xen_get_swiotlb_free_pages(unsigned int order) return __get_free_pages(flags, order); } -enum dma_cache_op { - DMA_UNMAP, - DMA_MAP, -}; static bool hypercall_cflush = false; -/* functions called by SWIOTLB */ - -static void dma_cache_maint(dma_addr_t handle, unsigned long offset, - size_t size, enum dma_data_direction dir, enum dma_cache_op op) +/* buffers in highmem or foreign pages cannot cross page boundaries */ +static void dma_cache_maint(dma_addr_t handle, size_t size, u32 op) { struct gnttab_cache_flush cflush; - unsigned long xen_pfn; - size_t left = size; - xen_pfn = (handle >> XEN_PAGE_SHIFT) + offset / XEN_PAGE_SIZE; - offset %= XEN_PAGE_SIZE; + cflush.a.dev_bus_addr = handle & XEN_PAGE_MASK; + cflush.offset = xen_offset_in_page(handle); + cflush.op = op; do { - size_t len = left; - - /* buffers in highmem or foreign pages cannot cross page -* boundaries */ - if (len + offset > XEN_PAGE_SIZE) - len = XEN_PAGE_SIZE - offset; - - cflush.op = 0; - cflush.a.dev_bus_addr = xen_pfn << XEN_PAGE_SHIFT; - cflush.offset = offset; - cflush.length = len; - - if (op == DMA_UNMAP && dir != DMA_TO_DEVICE) - cflush.op = GNTTAB_CACHE_INVAL; - if (op == DMA_MAP) { - if (dir == DMA_FROM_DEVICE) - cflush.op = GNTTAB_CACHE_INVAL; - else - cflush.op = GNTTAB_CACHE_CLEAN; - } - if (cflush.op) - HYPERVISOR_grant_table_op(GNTTABOP_cache_flush, &cflush, 1); + if (size + cflush.offset > XEN_PAGE_SIZE) + cflush.length = XEN_PAGE_SIZE - cflush.offset; + else + cflush.length = size; + + HYPERVISOR_grant_table_op(GNTTABOP_cache_flush, &cflush, 1); - offset = 0; - xen_pfn++; - left -= len; - } while (left); + cflush.offset = 0; + cflush.a.dev_bus_addr += cflush.length; + size -= cflush.length; + } while (size); } static void __xen_dma_page_dev_to_cpu(struct device *hwdev, dma_addr_t handle, size_t size, enum dma_data_direction dir) { - dma_cache_maint(handle & PAGE_MASK, handle & ~PAGE_MASK, size, dir, DMA_UNMAP); + if (dir != DMA_TO_DEVICE) + dma_cache_maint(handle, size, GNTTAB_CACHE_INVAL); } static void __xen_dma_page_cpu_to_dev(struct device *hwdev, dma_addr_t handle, size_t size, enum dma_data_direction dir) { - dma_cache_maint(handle & PAGE_MASK, handle & ~PAGE_MASK, size, dir, DMA_MAP); + if (dir == DMA_FROM_DEVICE) + dma_cache_maint(handle, size, GNTTAB_CACHE_INVAL); + else + dma_cache_maint(handle, size, GNTTAB_CACHE_CLEAN); } void __xen_dma_map_page(struct device *hwdev, struct page *page, -- 2.20.1 ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] Question on xen-netfront code to fix a potential ring buffer corruption
Hi Juergen, On 8/27/19 2:13 PM, Juergen Gross wrote: > On 18.08.19 10:31, Dongli Zhang wrote: >> Hi, >> >> Would you please help confirm why the condition at line 908 is ">="? >> >> In my opinion, we would only hit "skb_shinfo(skb)->nr_frag == MAX_SKB_FRAGS" >> at >> line 908. >> >> 890 static RING_IDX xennet_fill_frags(struct netfront_queue *queue, >> 891 struct sk_buff *skb, >> 892 struct sk_buff_head *list) >> 893 { >> 894 RING_IDX cons = queue->rx.rsp_cons; >> 895 struct sk_buff *nskb; >> 896 >> 897 while ((nskb = __skb_dequeue(list))) { >> 898 struct xen_netif_rx_response *rx = >> 899 RING_GET_RESPONSE(&queue->rx, ++cons); >> 900 skb_frag_t *nfrag = &skb_shinfo(nskb)->frags[0]; >> 901 >> 902 if (skb_shinfo(skb)->nr_frags == MAX_SKB_FRAGS) { >> 903 unsigned int pull_to = >> NETFRONT_SKB_CB(skb)->pull_to; >> 904 >> 905 BUG_ON(pull_to < skb_headlen(skb)); >> 906 __pskb_pull_tail(skb, pull_to - >> skb_headlen(skb)); >> 907 } >> 908 if (unlikely(skb_shinfo(skb)->nr_frags >= >> MAX_SKB_FRAGS)) { >> 909 queue->rx.rsp_cons = ++cons; >> 910 kfree_skb(nskb); >> 911 return ~0U; >> 912 } >> 913 >> 914 skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, >> 915 skb_frag_page(nfrag), >> 916 rx->offset, rx->status, PAGE_SIZE); >> 917 >> 918 skb_shinfo(nskb)->nr_frags = 0; >> 919 kfree_skb(nskb); >> 920 } >> 921 >> 922 return cons; >> 923 } >> >> >> The reason that I ask about this is because I am considering below patch to >> avoid a potential xen-netfront ring buffer corruption. >> >> diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c >> index 8d33970..48a2162 100644 >> --- a/drivers/net/xen-netfront.c >> +++ b/drivers/net/xen-netfront.c >> @@ -906,7 +906,7 @@ static RING_IDX xennet_fill_frags(struct netfront_queue >> *queue, >> __pskb_pull_tail(skb, pull_to - skb_headlen(skb)); >> } >> if (unlikely(skb_shinfo(skb)->nr_frags >= MAX_SKB_FRAGS)) { >> - queue->rx.rsp_cons = ++cons; >> + queue->rx.rsp_cons = cons + skb_queue_len(list) + 1; >> kfree_skb(nskb); >> return ~0U; >> } >> >> >> If there is skb left in list when we return ~0U, queue->rx.rsp_cons may be >> set >> incorrectly. > > Sa basically you want to consume the responses for all outstanding skbs > in the list? > I think there would be bug if there is skb left in the list. This is what is implanted in xennet_poll() when there is error of processing extra info like below. As at line 1034, if there is error, all outstanding skb are consumed. 985 static int xennet_poll(struct napi_struct *napi, int budget) ... ... 1028 if (extras[XEN_NETIF_EXTRA_TYPE_GSO - 1].type) { 1029 struct xen_netif_extra_info *gso; 1030 gso = &extras[XEN_NETIF_EXTRA_TYPE_GSO - 1]; 1031 1032 if (unlikely(xennet_set_skb_gso(skb, gso))) { 1033 __skb_queue_head(&tmpq, skb); 1034 queue->rx.rsp_cons += skb_queue_len(&tmpq); 1035 goto err; 1036 } 1037 } The reason we need to consume all outstanding skb is because xennet_get_responses() would reset both queue->rx_skbs[i] and queue->grant_rx_ref[i] to NULL before enqueue all outstanding skb to the list (e.g., &tmpq), by xennet_get_rx_skb() and xennet_get_rx_ref(). If we do not consume all of them, we would hit NULL in queue->rx_skbs[i] in next iteration of while loop in xennet_poll(). That is, if we do not consume all outstanding skb, the queue->rx.rsp_cons may refer to a response whose queue->rx_skbs[i] and queue->grant_rx_ref[i] are already reset to NULL. Dongli Zhang >> >> While I am trying to make up a case that would hit the corruption, I could >> not >> explain why (unlikely(skb_shinfo(skb)->nr_frags >= MAX_SKB_FRAGS)), but not >> just "==". Perhaps __pskb_pull_tail() may fail although pull_to is less than >> skb_headlen(skb). > > I don't think nr_frags can be larger than MAX_SKB_FRAGS. OTOH I don't > think it hurts to have a safety net here in order to avoid problems. > > Originally this was BUG_ON(skb_shinfo(skb)->nr_frags >= MAX_SKB_FRAGS) > so that might explain the ">=". > > > Juergen > > ___ > Xen-devel mailing list > Xen-devel@lists.xenproject.org > https://lists.xenproject.org/mailman/listinf