Re: [Xen-devel] [PATCH v8] This is ABI for the two halves of a Para-virtual sound driver to communicate with each to other.

2016-11-17 Thread Oleksandr Andrushchenko
Thank you all for the review and comments!
I guess only these are not addressed (or still need comments):

> 1. You can only say how many channels a stream has, not what the
> channels correspond to (e.g., "left", "right" for a 2 channel stereo
> stream; or "left-front", "rear-right", etc. for a 6 channel 5.1 surround
> sound stream).

PV driver may be configured to have number of channels which are
not supported by the back's HW. In that case this is up to back how to treat
those. If we introduce some specific ordering or mapping that will only be
a recommendation to the back, which it may follow.
Thus, I would stick to what we have now

> 3. For the PCM formats you need to precisely specify the format or
> reference external specifications that do so.  For example, "mpeg" is a
> bit vague as I'm sure this standard body has produced many different
> audio formats.  The specifications don't need to be freely available,
> just correctly referenced.

I do understand the intent here, but I blieve we cannot make the protocol
being simple and fit all at once. So, I would suggest leaving it as is
at least for now
or removing it.

> 4. 8 bits for stream index, operation and (particularly) pcm format feel
> a little limiting.
8 bits mean you can have 256 streams, operations and formats (which are
indices). I would prefer to stay with 8 bits

> 5. For the read/write operations is the stream buffer considered to be
> circular?  I think it probably should be.
I guess it shouldn't. The reason of having offset is the fact that software on
front side may mmap part of the buffer and tell the driver the offset of
the "dirty" region of the buffer.

Please find updated list of TODOs for the next version:

1. Change frontend-id to frontend_id
2. Have a single sound card configured with bunch of
different devices/streams
3. State that sample rates and formats expressed as decimals w/o any
particular ordering
4. Put description of migration/disconnection state
5. Change __attribute__((packed)) to __packed (scripts/checkpatch.pl)
6. Padding to fit cache line? What is its size (ARM/x86...) - need to discuss
7. Change GPL header to BSD
8. Remove #ifdef __KERNEL
9. Remove "Multiple PV drivers are allowed in the domain at the same time."
10. Support a single card as device/stream configuration allows fine
tuning already
11. Explicitly say which indices in XenStore configuration are contiguous
12. For strings "If not defined then use frontend's default." add more
description:
"This default is depends on concrete PV frontend implementation"
13. Make names of cards/devices optional
14. Remove PCM_FORMAT_SPECIAL
15. Change volume units from dBm to dB

Thank you,
Oleksandr

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [ovmf baseline-only test] 68058: all pass

2016-11-17 Thread Platform Team regression test user
This run is configured for baseline tests only.

flight 68058 ovmf real [real]
http://osstest.xs.citrite.net/~osstest/testlogs/logs/68058/

Perfect :-)
All tests in this flight passed as required
version targeted for testing:
 ovmf 28b3a713b66998a8be3e8558eb85f18699e15b2e
baseline version:
 ovmf 2048ab4b3ec966183eb87d93d9cdab05fe9cc840

Last test of basis68056  2016-11-17 17:17:56 Z0 days
Testing same since68058  2016-11-18 00:51:36 Z0 days1 attempts


People who touched revisions under test:
  Maurice Ma 
  Michael Kinney 

jobs:
 build-amd64-xsm  pass
 build-i386-xsm   pass
 build-amd64  pass
 build-i386   pass
 build-amd64-libvirt  pass
 build-i386-libvirt   pass
 build-amd64-pvopspass
 build-i386-pvops pass
 test-amd64-amd64-xl-qemuu-ovmf-amd64 pass
 test-amd64-i386-xl-qemuu-ovmf-amd64  pass



sg-report-flight on osstest.xs.citrite.net
logs: /home/osstest/logs
images: /home/osstest/images

Logs, config files, etc. are available at
http://osstest.xs.citrite.net/~osstest/testlogs/logs

Test harness code can be found at
http://xenbits.xensource.com/gitweb?p=osstest.git;a=summary


Push not applicable.


commit 28b3a713b66998a8be3e8558eb85f18699e15b2e
Author: Maurice Ma 
Date:   Wed Nov 16 19:01:01 2016 -0800

CorebootPayloadPkg: Allow PciLib instance selection

On old platform without PCIe express support, the PciLib needs to
be mapped to PciLibCf8 instance to make it work.  On new platform
with PCIe express support, the PciLib needs to be mapped to
PciLibPciExpress to allow access to extended PCIe configuration
space. This patch allows to select the PciLib instance between
PciLibCf8 and PciLibPciExpress using the PCIE_BASE macro through
build command line.

Cc: Prince Agyeman 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Maurice Ma 
Reviewed-by: Prince Agyeman 

commit 5ea2bad0d9ab6a2465195badd323313553baa61b
Author: Michael Kinney 
Date:   Wed Nov 9 18:31:38 2016 -0800

MdePkg/BaseMemoryLib: Fix VS2015 build error

https://bugzilla.tianocore.org/show_bug.cgi?id=237

Make the smallest change possible to workaround a VS2015
build error.  The change is to the loop that handles the
case where neither the source nor the destination are
64-bit or 32-bit aligned and the logic falls through to
a loop that performs the copy as bytes.  Only the loop
that copies bytes backwards needs to be updated to avoid
the VS2015 build error.

Cc: Ard Biesheuvel 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney 
Reviewed-by: Liming Gao 

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH] x86/cpuid: Add AVX512_4VNNIW and AVX512_4FMAPS support

2016-11-17 Thread He Chen
Add two new AVX512 subfeatures support for guest.

AVX512_4VNNIW:
Vector instructions for deep learning enhanced word variable precision.

AVX512_4FMAPS:
Vector instructions for deep learning floating-point single precision.

Signed-off-by: Luwei Kang 
Signed-off-by: He Chen 
---
 tools/libxc/xc_cpuid_x86.c  | 8 ++--
 xen/arch/x86/cpu/common.c   | 2 +-
 xen/arch/x86/cpuid.c| 2 +-
 xen/arch/x86/hvm/hvm.c  | 1 +
 xen/arch/x86/traps.c| 5 +++--
 xen/include/asm-x86/cpuid.h | 1 +
 xen/include/public/arch-x86/cpufeatureset.h | 4 
 xen/tools/gen-cpuid.py  | 2 +-
 8 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xc_cpuid_x86.c
index 2ad9aeb..e9e3691 100644
--- a/tools/libxc/xc_cpuid_x86.c
+++ b/tools/libxc/xc_cpuid_x86.c
@@ -547,13 +547,15 @@ static void xc_cpuid_hvm_policy(xc_interface *xch,
 {
 regs[1] = info->featureset[featureword_of(X86_FEATURE_FSGSBASE)];
 regs[2] = 
info->featureset[featureword_of(X86_FEATURE_PREFETCHWT1)];
+regs[3] = 
info->featureset[featureword_of(X86_FEATURE_AVX512_4VNNIW)];
 }
 else
 {
 regs[1] = 0;
 regs[2] = 0;
+regs[3] = 0;
 }
-regs[0] = regs[3] = 0;
+regs[0] = 0;
 break;
 
 case 0x000d:
@@ -638,13 +640,15 @@ static void xc_cpuid_pv_policy(xc_interface *xch,
 {
 regs[1] = info->featureset[featureword_of(X86_FEATURE_FSGSBASE)];
 regs[2] = 
info->featureset[featureword_of(X86_FEATURE_PREFETCHWT1)];
+regs[3] = 
info->featureset[featureword_of(X86_FEATURE_AVX512_4VNNIW)];
 }
 else
 {
 regs[1] = 0;
 regs[2] = 0;
+regs[3] = 0;
 }
-regs[0] = regs[3] = 0;
+regs[0] = 0;
 break;
 
 case 0x000d:
diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index 3475198..873 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -325,7 +325,7 @@ static void generic_identify(struct cpuinfo_x86 *c)
cpuid_count(0x0007, 0, ,

>x86_capability[cpufeat_word(X86_FEATURE_FSGSBASE)],
>x86_capability[cpufeat_word(X86_FEATURE_PKU)],
-   );
+   
>x86_capability[cpufeat_word(X86_FEATURE_AVX512_4VNNIW)]);
 }
 
 /*
diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index 63b2db9..3e85a63 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -78,7 +78,7 @@ static void __init calculate_raw_featureset(void)
 cpuid_count(0x7, 0, ,
 _featureset[FEATURESET_7b0],
 _featureset[FEATURESET_7c0],
-);
+_featureset[FEATURESET_7d0]);
 if ( max >= 0xd )
 cpuid_count(0xd, 1,
 _featureset[FEATURESET_Da1],
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 704fd64..752e5fb 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -3503,6 +3503,7 @@ void hvm_cpuid(unsigned int input, unsigned int *eax, 
unsigned int *ebx,
  special_features[FEATURESET_7b0]);
 
 *ecx &= hvm_featureset[FEATURESET_7c0];
+*edx &= hvm_featureset[FEATURESET_7d0];
 
 /* Don't expose HAP-only features to non-hap guests. */
 if ( !hap_enabled(d) )
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 14abb62..2469e49 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1128,6 +1128,7 @@ void pv_cpuid(struct cpu_user_regs *regs)
   special_features[FEATURESET_7b0]);
 
 c &= pv_featureset[FEATURESET_7c0];
+d &= pv_featureset[FEATURESET_7d0];
 
 if ( !is_pvh_domain(currd) )
 {
@@ -1142,8 +1143,8 @@ void pv_cpuid(struct cpu_user_regs *regs)
 }
 }
 else
-b = c = 0;
-a = d = 0;
+b = c = d = 0;
+a = 0;
 break;
 
 case XSTATE_CPUID:
diff --git a/xen/include/asm-x86/cpuid.h b/xen/include/asm-x86/cpuid.h
index 2372474..ec8bbb5 100644
--- a/xen/include/asm-x86/cpuid.h
+++ b/xen/include/asm-x86/cpuid.h
@@ -17,6 +17,7 @@
 #define FEATURESET_7c06 /* 0x0007:0.ecx*/
 #define FEATURESET_e7d7 /* 0x8007.edx  */
 #define FEATURESET_e8b8 /* 0x8008.ebx  */
+#define FEATURESET_7d09 /* 0x0007:0.edx*/
 
 #ifndef __ASSEMBLY__
 #include 
diff --git a/xen/include/public/arch-x86/cpufeatureset.h 
b/xen/include/public/arch-x86/cpufeatureset.h
index 9320c9e..565ccd5 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ 

Re: [Xen-devel] [PATCH v8 2/7] VMX: Properly handle pi when all the assigned devices are removed

2016-11-17 Thread Wu, Feng


> -Original Message-
> From: Tian, Kevin
> Sent: Friday, November 18, 2016 12:59 PM
> To: Wu, Feng ; xen-devel@lists.xen.org
> Cc: jbeul...@suse.com; andrew.coop...@citrix.com;
> george.dun...@eu.citrix.com; dario.faggi...@citrix.com
> Subject: RE: [PATCH v8 2/7] VMX: Properly handle pi when all the assigned
> devices are removed
> 
> > From: Wu, Feng
> > Sent: Friday, November 18, 2016 12:27 PM
> > > > diff --git a/xen/drivers/passthrough/pci.c 
> > > > b/xen/drivers/passthrough/pci.c
> > > > index 8bce213..e71732f 100644
> > > > --- a/xen/drivers/passthrough/pci.c
> > > > +++ b/xen/drivers/passthrough/pci.c
> > > > @@ -1602,6 +1602,13 @@ int iommu_do_pci_domctl(
> > > >  break;
> > > >
> > > >  case XEN_DOMCTL_assign_device:
> > > > +/* no domain_pause() */
> > > > +if ( d == current->domain )
> > > > +{
> > > > +ret = -EINVAL;
> > > > +break;
> > > > +}
> > > > +
> > >
> > > don't understand why adding above check, and why "no domain_pause"
> > > matters in this change.
> >
> > In fact, this change is according Jan's following comments on v6:
> >
> > " There's one additional caveat here which no-one of us so far thought
> > of: Currently there's nothing preventing the domctl-s under which
> > this sits from being issued by the control domain for itself. Various
> > other domctl-s, however, guard against this case when intending
> > to pause the target domain. The same needs to be done for the
> > ones leading here."
> >
> > We need to prevent the domain from pausing itself.
> >
> 
> XEN_DOMCTL_assign_device doesn't imply a domain_pause operation,
> at least not obvious in this level. If we don't have PI enabled underneath,
> is above guard still necessary? If the answer is yes, the comment should
> be elaborated for easy understanding... :-)

I think the domain_pause() is introduced in PI related logic. So maybe I
need Jan's comments about whether we need to add this check unconditionally
here. Anyway, the comments need to be more detailed.

Thanks,
Feng

> 
> Thanks
> Kevin

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [ovmf test] 102371: all pass - PUSHED

2016-11-17 Thread osstest service owner
flight 102371 ovmf real [real]
http://logs.test-lab.xenproject.org/osstest/logs/102371/

Perfect :-)
All tests in this flight passed as required
version targeted for testing:
 ovmf ec16deeac90e4b8014394be58a229f6aa8c493af
baseline version:
 ovmf 4e7872d2f71f511df155a9048f06761afce751da

Last test of basis   102367  2016-11-17 23:13:51 Z0 days
Testing same since   102371  2016-11-18 01:59:22 Z0 days1 attempts


People who touched revisions under test:
  Giri P Mudusuru 
  Hao Wu 
  Jeff Fan 
  Michael Kinney 

jobs:
 build-amd64-xsm  pass
 build-i386-xsm   pass
 build-amd64  pass
 build-i386   pass
 build-amd64-libvirt  pass
 build-i386-libvirt   pass
 build-amd64-pvopspass
 build-i386-pvops pass
 test-amd64-amd64-xl-qemuu-ovmf-amd64 pass
 test-amd64-i386-xl-qemuu-ovmf-amd64  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 :

+ branch=ovmf
+ revision=ec16deeac90e4b8014394be58a229f6aa8c493af
+ . ./cri-lock-repos
++ . ./cri-common
+++ . ./cri-getconfig
+++ umask 002
+++ getrepos
 getconfig Repos
 perl -e '
use Osstest;
readglobalconfig();
print $c{"Repos"} or die $!;
'
+++ local repos=/home/osstest/repos
+++ '[' -z /home/osstest/repos ']'
+++ '[' '!' -d /home/osstest/repos ']'
+++ echo /home/osstest/repos
++ repos=/home/osstest/repos
++ repos_lock=/home/osstest/repos/lock
++ '[' x '!=' x/home/osstest/repos/lock ']'
++ OSSTEST_REPOS_LOCK_LOCKED=/home/osstest/repos/lock
++ exec with-lock-ex -w /home/osstest/repos/lock ./ap-push ovmf 
ec16deeac90e4b8014394be58a229f6aa8c493af
+ branch=ovmf
+ revision=ec16deeac90e4b8014394be58a229f6aa8c493af
+ . ./cri-lock-repos
++ . ./cri-common
+++ . ./cri-getconfig
+++ umask 002
+++ getrepos
 getconfig Repos
 perl -e '
use Osstest;
readglobalconfig();
print $c{"Repos"} or die $!;
'
+++ local repos=/home/osstest/repos
+++ '[' -z /home/osstest/repos ']'
+++ '[' '!' -d /home/osstest/repos ']'
+++ echo /home/osstest/repos
++ repos=/home/osstest/repos
++ repos_lock=/home/osstest/repos/lock
++ '[' x/home/osstest/repos/lock '!=' x/home/osstest/repos/lock ']'
+ . ./cri-common
++ . ./cri-getconfig
++ umask 002
+ select_xenbranch
+ case "$branch" in
+ tree=ovmf
+ xenbranch=xen-unstable
+ '[' xovmf = xlinux ']'
+ linuxbranch=
+ '[' x = x ']'
+ qemuubranch=qemu-upstream-unstable
+ select_prevxenbranch
++ ./cri-getprevxenbranch xen-unstable
+ prevxenbranch=xen-4.7-testing
+ '[' xec16deeac90e4b8014394be58a229f6aa8c493af = x ']'
+ : tested/2.6.39.x
+ . ./ap-common
++ : osst...@xenbits.xen.org
+++ getconfig OsstestUpstream
+++ perl -e '
use Osstest;
readglobalconfig();
print $c{"OsstestUpstream"} or die $!;
'
++ :
++ : git://xenbits.xen.org/xen.git
++ : osst...@xenbits.xen.org:/home/xen/git/xen.git
++ : git://xenbits.xen.org/qemu-xen-traditional.git
++ : git://git.kernel.org
++ : git://git.kernel.org/pub/scm/linux/kernel/git
++ : git
++ : git://xenbits.xen.org/xtf.git
++ : osst...@xenbits.xen.org:/home/xen/git/xtf.git
++ : git://xenbits.xen.org/xtf.git
++ : git://xenbits.xen.org/libvirt.git
++ : osst...@xenbits.xen.org:/home/xen/git/libvirt.git
++ : git://xenbits.xen.org/libvirt.git
++ : git://xenbits.xen.org/osstest/rumprun.git
++ : git
++ : git://xenbits.xen.org/osstest/rumprun.git
++ : osst...@xenbits.xen.org:/home/xen/git/osstest/rumprun.git
++ : git://git.seabios.org/seabios.git
++ : osst...@xenbits.xen.org:/home/xen/git/osstest/seabios.git
++ : git://xenbits.xen.org/osstest/seabios.git
++ : https://github.com/tianocore/edk2.git
++ : osst...@xenbits.xen.org:/home/xen/git/osstest/ovmf.git
++ : git://xenbits.xen.org/osstest/ovmf.git
++ : git://xenbits.xen.org/osstest/linux-firmware.git
++ : 

Re: [Xen-devel] [PATCH v8 2/7] VMX: Properly handle pi when all the assigned devices are removed

2016-11-17 Thread Tian, Kevin
> From: Wu, Feng
> Sent: Friday, November 18, 2016 12:27 PM
> > > diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
> > > index 8bce213..e71732f 100644
> > > --- a/xen/drivers/passthrough/pci.c
> > > +++ b/xen/drivers/passthrough/pci.c
> > > @@ -1602,6 +1602,13 @@ int iommu_do_pci_domctl(
> > >  break;
> > >
> > >  case XEN_DOMCTL_assign_device:
> > > +/* no domain_pause() */
> > > +if ( d == current->domain )
> > > +{
> > > +ret = -EINVAL;
> > > +break;
> > > +}
> > > +
> >
> > don't understand why adding above check, and why "no domain_pause"
> > matters in this change.
> 
> In fact, this change is according Jan's following comments on v6:
> 
> " There's one additional caveat here which no-one of us so far thought
> of: Currently there's nothing preventing the domctl-s under which
> this sits from being issued by the control domain for itself. Various
> other domctl-s, however, guard against this case when intending
> to pause the target domain. The same needs to be done for the
> ones leading here."
> 
> We need to prevent the domain from pausing itself.
> 

XEN_DOMCTL_assign_device doesn't imply a domain_pause operation,
at least not obvious in this level. If we don't have PI enabled underneath,
is above guard still necessary? If the answer is yes, the comment should
be elaborated for easy understanding... :-)

Thanks
Kevin

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH v8 7/7] VMX: Fixup PI descriptor when cpu is offline

2016-11-17 Thread Tian, Kevin
> From: Wu, Feng
> Sent: Friday, November 18, 2016 9:57 AM
> 
> When cpu is offline, we need to move all the vcpus in its blocking
> list to another online cpu, this patch handles it.
> 
> Signed-off-by: Feng Wu 
> Reviewed-by: Jan Beulich 

Acked-by: Kevin Tian 

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH v8 6/7] VT-d: Some cleanups

2016-11-17 Thread Tian, Kevin
> From: Wu, Feng
> Sent: Friday, November 18, 2016 9:57 AM
> 
> Use type-safe structure assignment instead of memcpy()
> Use sizeof(*iremap_entry).
> 
> Signed-off-by: Feng Wu 
> Reviewed-by: Konrad Rzeszutek Wilk 

Acked-by: Kevin Tian 

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH v8 5/7] VT-d: No need to set irq affinity for posted format IRTE

2016-11-17 Thread Tian, Kevin
> From: Wu, Feng
> Sent: Friday, November 18, 2016 9:59 AM
> 
> We don't set the affinity for posted format IRTE, since the
> destination of these interrupts is vCPU and the vCPU affinity
> is set during vCPU scheduling.
> 
> Signed-off-by: Feng Wu 
> ---
> v8:
> - Changes based on [6/7]

[5/7]?

> 
> v7:
> - Compare all the field in IRTE to justify whether we can suppress the update
> 
> v6:
> - Make pi_can_suppress_irte_update() a check-only function
> - Introduce another function pi_get_new_irte() to update the 'new_ire' if 
> needed
> 
> v5:
> - Only suppress affinity related IRTE updates for PI
> 
> v4:
> - Keep the construction of new_ire and only modify the hardware
> IRTE when it is not in posted mode.
> 
>  xen/drivers/passthrough/vtd/intremap.c | 87
> --
>  1 file changed, 52 insertions(+), 35 deletions(-)
> 
> diff --git a/xen/drivers/passthrough/vtd/intremap.c
> b/xen/drivers/passthrough/vtd/intremap.c
> index fd2a49a..0cb8c37 100644
> --- a/xen/drivers/passthrough/vtd/intremap.c
> +++ b/xen/drivers/passthrough/vtd/intremap.c
> @@ -600,27 +600,41 @@ static int msi_msg_to_remap_entry(
> 
>  if ( !pi_desc )
>  {
> -/* Set interrupt remapping table entry */
> -new_ire.remap.fpd = 0;
> -new_ire.remap.dm = (msg->address_lo >> MSI_ADDR_DESTMODE_SHIFT) &
> 0x1;
> -new_ire.remap.tm = (msg->data >> MSI_DATA_TRIGGER_SHIFT) & 0x1;
> -new_ire.remap.dlm = (msg->data >> MSI_DATA_DELIVERY_MODE_SHIFT) &
> 0x1;
> -/* Hardware require RH = 1 for LPR delivery mode */
> -new_ire.remap.rh = (new_ire.remap.dlm == dest_LowestPrio);
> -new_ire.remap.avail = 0;
> -new_ire.remap.res_1 = 0;
> -new_ire.remap.vector = (msg->data >> MSI_DATA_VECTOR_SHIFT) &
> -MSI_DATA_VECTOR_MASK;
> -new_ire.remap.res_2 = 0;
> -if ( x2apic_enabled )
> -new_ire.remap.dst = msg->dest32;
> -else
> -new_ire.remap.dst = ((msg->address_lo >> MSI_ADDR_DEST_ID_SHIFT)
> - & 0xff) << 8;
> +/*
> + * We are here because we are trying to update the IRTE to remapped 
> mode,
> + * we only need to update the remapped specific fields for the 
> following
> + * two cases:

you said "we only need to update the remapped specific fields", while later...

> + * 1. When we create a new IRTE. A new IRTE is created when we 
> create a
> + *new irq, so a new IRTE is always initialized with remapped 
> format.
> + * 2. When the old IRTE is present and in remapped mode. Since if 
> the old
> + *IRTE is in posted mode, we cannot update it to remapped mode 
> and
> + *this is what we need to suppress. So we don't update the 
> remapped
> + *specific fields here, we only update the commom field.

you said "we don't update remapped specific fields"...

It's also unclear to me why we cannot change irte from posted mode back to
remapped mode. Is it defined as a VT-d arch limitation? What about the other
direction from remapped mode to posted mode?

> + */
> +if ( !iremap_entry->remap.p || !iremap_entry->remap.im )
> +{
> +/* Set interrupt remapping table entry */
> +new_ire.remap.fpd = 0;
> +new_ire.remap.dm = (msg->address_lo >> MSI_ADDR_DESTMODE_SHIFT)
> & 0x1;
> +new_ire.remap.tm = (msg->data >> MSI_DATA_TRIGGER_SHIFT) & 0x1;
> +new_ire.remap.dlm = (msg->data >> MSI_DATA_DELIVERY_MODE_SHIFT)
> & 0x1;
> +/* Hardware require RH = 1 for LPR delivery mode */
> +new_ire.remap.rh = (new_ire.remap.dlm == dest_LowestPrio);
> +new_ire.remap.avail = 0;
> +new_ire.remap.res_1 = 0;
> +new_ire.remap.vector = (msg->data >> MSI_DATA_VECTOR_SHIFT) &
> +MSI_DATA_VECTOR_MASK;
> +new_ire.remap.res_2 = 0;
> +if ( x2apic_enabled )
> +new_ire.remap.dst = msg->dest32;
> +else
> +new_ire.remap.dst = ((msg->address_lo >>
> MSI_ADDR_DEST_ID_SHIFT)
> + & 0xff) << 8;
> 
> -new_ire.remap.res_3 = 0;
> -new_ire.remap.res_4 = 0;
> -new_ire.remap.p = 1;/* finally, set present bit */
> +new_ire.remap.res_3 = 0;
> +new_ire.remap.res_4 = 0;
> +new_ire.remap.p = 1;/* finally, set present bit */
> +}

what about old_ire is in posted mode? If it cannot happen from posted
to remap as you explained earlier, then should be an ASSERT here.
Otherwise you just leave a condition unhandled...

>  }
>  else
>  {
> @@ -657,25 +671,28 @@ static int msi_msg_to_remap_entry(
>  remap_rte->address_hi = 0;
>  remap_rte->data = index - i;
> 
> -if ( !pi_desc )
> -memcpy(iremap_entry, _ire, 

Re: [Xen-devel] [PATCH v8 4/7] VT-d: Use one function to update both remapped and posted IRTE

2016-11-17 Thread Tian, Kevin
> From: Wu, Feng
> Sent: Friday, November 18, 2016 9:57 AM
> 
> Use one function to update both remapped IRTE and posted IRET.
> 
> Signed-off-by: Feng Wu 
> ---
> v8:
> - Newly added
> 
>  xen/drivers/passthrough/vtd/intremap.c | 162 
> ++---
>  1 file changed, 66 insertions(+), 96 deletions(-)
> 
> diff --git a/xen/drivers/passthrough/vtd/intremap.c
> b/xen/drivers/passthrough/vtd/intremap.c
> index bfd468b..fd2a49a 100644
> --- a/xen/drivers/passthrough/vtd/intremap.c
> +++ b/xen/drivers/passthrough/vtd/intremap.c
> @@ -420,7 +420,7 @@ void io_apic_write_remap_rte(
>  __ioapic_write_entry(apic, ioapic_pin, 1, old_rte);
>  }
> 
> -static void set_msi_source_id(struct pci_dev *pdev, struct iremap_entry *ire)
> +static void set_msi_source_id(const struct pci_dev *pdev, struct 
> iremap_entry *ire)
>  {
>  u16 seg;
>  u8 bus, devfn, secbus;
> @@ -548,11 +548,12 @@ static int remap_entry_to_msi_msg(
>  }
> 
>  static int msi_msg_to_remap_entry(
> -struct iommu *iommu, struct pci_dev *pdev,
> -struct msi_desc *msi_desc, struct msi_msg *msg)
> +struct iommu *iommu, const struct pci_dev *pdev,
> +struct msi_desc *msi_desc, struct msi_msg *msg,
> +const struct pi_desc *pi_desc, const uint8_t gvec)
>  {
>  struct iremap_entry *iremap_entry = NULL, *iremap_entries;
> -struct iremap_entry new_ire;
> +struct iremap_entry new_ire, old_ire;

old_ire is used only in later 'else' branch. move definition there.

>  struct msi_msg_remap_entry *remap_rte;
>  unsigned int index, i, nr = 1;
>  unsigned long flags;
> @@ -597,31 +598,50 @@ static int msi_msg_to_remap_entry(
> 
>  memcpy(_ire, iremap_entry, sizeof(struct iremap_entry));
> 
> -/* Set interrupt remapping table entry */
> -new_ire.remap.fpd = 0;
> -new_ire.remap.dm = (msg->address_lo >> MSI_ADDR_DESTMODE_SHIFT) & 0x1;
> -new_ire.remap.tm = (msg->data >> MSI_DATA_TRIGGER_SHIFT) & 0x1;
> -new_ire.remap.dlm = (msg->data >> MSI_DATA_DELIVERY_MODE_SHIFT) & 0x1;
> -/* Hardware require RH = 1 for LPR delivery mode */
> -new_ire.remap.rh = (new_ire.remap.dlm == dest_LowestPrio);
> -new_ire.remap.avail = 0;
> -new_ire.remap.res_1 = 0;
> -new_ire.remap.vector = (msg->data >> MSI_DATA_VECTOR_SHIFT) &
> -MSI_DATA_VECTOR_MASK;
> -new_ire.remap.res_2 = 0;
> -if ( x2apic_enabled )
> -new_ire.remap.dst = msg->dest32;
> +if ( !pi_desc )
> +{
> +/* Set interrupt remapping table entry */
> +new_ire.remap.fpd = 0;
> +new_ire.remap.dm = (msg->address_lo >> MSI_ADDR_DESTMODE_SHIFT) &
> 0x1;
> +new_ire.remap.tm = (msg->data >> MSI_DATA_TRIGGER_SHIFT) & 0x1;
> +new_ire.remap.dlm = (msg->data >> MSI_DATA_DELIVERY_MODE_SHIFT) &
> 0x1;
> +/* Hardware require RH = 1 for LPR delivery mode */
> +new_ire.remap.rh = (new_ire.remap.dlm == dest_LowestPrio);
> +new_ire.remap.avail = 0;
> +new_ire.remap.res_1 = 0;
> +new_ire.remap.vector = (msg->data >> MSI_DATA_VECTOR_SHIFT) &
> +MSI_DATA_VECTOR_MASK;
> +new_ire.remap.res_2 = 0;
> +if ( x2apic_enabled )
> +new_ire.remap.dst = msg->dest32;
> +else
> +new_ire.remap.dst = ((msg->address_lo >> MSI_ADDR_DEST_ID_SHIFT)
> + & 0xff) << 8;
> +
> +new_ire.remap.res_3 = 0;
> +new_ire.remap.res_4 = 0;
> +new_ire.remap.p = 1;/* finally, set present bit */
> +}
>  else
> -new_ire.remap.dst = ((msg->address_lo >> MSI_ADDR_DEST_ID_SHIFT)
> - & 0xff) << 8;
> +{
> +new_ire.post.fpd = 0;
> +new_ire.post.res_1 = 0;
> +new_ire.post.res_2 = 0;
> +new_ire.post.urg = 0;
> +new_ire.post.im = 1;
> +new_ire.post.vector = gvec;
> +new_ire.post.res_3 = 0;
> +new_ire.post.res_4 = 0;
> +new_ire.post.res_5 = 0;
> +new_ire.post.pda_l = virt_to_maddr(pi_desc) >> (32 - PDA_LOW_BIT);
> +new_ire.post.pda_h = virt_to_maddr(pi_desc) >> 32;
> +new_ire.post.p = 1;/* finally, set present bit */
> +}

It's a little confusing here:

- you first copy current remapping entry to new_ire and then do some 
initialization.
Is it necessary? If there are some fields we'd like to inherit, better to 
describe them
in comment so others can have a clear understanding of what exactly fields must
be updated here;

- in original code of setup_posted_irte, you actually do conditional assignment 
based on format of old_ire. Above you changed to non-conditional assignment,
not relying on old_ire. Is it desired? 

> 
>  if ( pdev )
>  set_msi_source_id(pdev, _ire);
>  else
>  set_hpet_source_id(msi_desc->hpet_id, _ire);
> -new_ire.remap.res_3 = 0;
> -new_ire.remap.res_4 = 0;
> -new_ire.remap.p = 1;/* 

Re: [Xen-devel] [PATCH v8 3/7] VMX: Make sure PI is in proper state before install the hooks

2016-11-17 Thread Wu, Feng


> -Original Message-
> From: Tian, Kevin
> Sent: Friday, November 18, 2016 12:11 PM
> To: Wu, Feng ; xen-devel@lists.xen.org
> Cc: jbeul...@suse.com; andrew.coop...@citrix.com;
> george.dun...@eu.citrix.com; dario.faggi...@citrix.com
> Subject: RE: [PATCH v8 3/7] VMX: Make sure PI is in proper state before 
> install
> the hooks
> 
> > From: Wu, Feng
> > Sent: Friday, November 18, 2016 9:57 AM
> >
> > We may hit the last ASSERT() in vmx_vcpu_block in the current code,
> > since vmx_vcpu_block() may get called before vmx_pi_switch_to()
> > has been installed or executed. Here We use cmpxchg to update
> > the NDST field, this can make sure we only update the NDST when
> > vmx_pi_switch_to() has not been called. So the NDST is in a
> > proper state in vmx_vcpu_block().
> >
> > Suggested-by: Jan Beulich 
> > Signed-off-by: Feng Wu 
> > Reviewed-by: Jan Beulich 
> 
> Acked-by: Kevin Tian 

Thanks for the Ack!

Thanks,
Feng

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH v8 2/7] VMX: Properly handle pi when all the assigned devices are removed

2016-11-17 Thread Wu, Feng


> -Original Message-
> From: Tian, Kevin
> Sent: Friday, November 18, 2016 11:19 AM
> To: Wu, Feng ; xen-devel@lists.xen.org
> Cc: jbeul...@suse.com; andrew.coop...@citrix.com;
> george.dun...@eu.citrix.com; dario.faggi...@citrix.com
> Subject: RE: [PATCH v8 2/7] VMX: Properly handle pi when all the assigned
> devices are removed
> 
> > From: Wu, Feng
> > Sent: Friday, November 18, 2016 9:57 AM
> >
> > This patch handles some corner cases when the last assigned device
> > is removed from the domain. In this case we should carefully handle
> > pi descriptor and the per-cpu blocking list, to make sure:
> > - all the PI descriptor are in the right state when next time a
> > devices is assigned to the domain again.
> > - No remaining vcpus of the domain in the per-cpu blocking list.
> >
> > Here we call vmx_pi_unblock_vcpu() to remove the vCPU from the blocking list
> > if it is on the list. However, this could happen when vmx_vcpu_block() is
> > being called, hence we might incorrectly add the vCPU to the blocking list
> > while the last devcie is detached from the domain. Consider that the 
> > situation
> > can only occur when detaching the last device from the domain and it is not
> > a frequent operation, so we use domain_pause before that, which is
> considered
> > as an clean and maintainable solution for the situation.
> >
> > Signed-off-by: Feng Wu 
> > Reviewed-by: Jan Beulich 
> > ---
> > v7:
> > - Prevent the domain from pausing itself.
> >
> > v6:
> > - Comments changes
> > - Rename vmx_pi_list_remove() to vmx_pi_unblock_vcpu()
> >
> > v5:
> > - Remove a no-op wrapper
> >
> > v4:
> > - Rename some functions:
> > vmx_pi_remove_vcpu_from_blocking_list() -> vmx_pi_list_remove()
> > vmx_pi_blocking_cleanup() -> vmx_pi_list_cleanup()
> > - Remove the check in vmx_pi_list_cleanup()
> > - Comments adjustment
> >
> >  xen/arch/x86/hvm/vmx/vmx.c| 28 
> >  xen/drivers/passthrough/pci.c | 14 ++
> >  2 files changed, 38 insertions(+), 4 deletions(-)
> >
> > diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
> > index f3911f2..a8dcabe 100644
> > --- a/xen/arch/x86/hvm/vmx/vmx.c
> > +++ b/xen/arch/x86/hvm/vmx/vmx.c
> > @@ -158,14 +158,12 @@ static void vmx_pi_switch_to(struct vcpu *v)
> >  pi_clear_sn(pi_desc);
> >  }
> >
> > -static void vmx_pi_do_resume(struct vcpu *v)
> > +static void vmx_pi_unblock_vcpu(struct vcpu *v)
> >  {
> >  unsigned long flags;
> >  spinlock_t *pi_blocking_list_lock;
> >  struct pi_desc *pi_desc = >arch.hvm_vmx.pi_desc;
> >
> > -ASSERT(!test_bit(_VPF_blocked, >pause_flags));
> > -
> >  /*
> >   * Set 'NV' field back to posted_intr_vector, so the
> >   * Posted-Interrupts can be delivered to the vCPU when
> > @@ -173,12 +171,12 @@ static void vmx_pi_do_resume(struct vcpu *v)
> >   */
> >  write_atomic(_desc->nv, posted_intr_vector);
> >
> > -/* The vCPU is not on any blocking list. */
> >  pi_blocking_list_lock = v->arch.hvm_vmx.pi_blocking.lock;
> >
> >  /* Prevent the compiler from eliminating the local variable.*/
> >  smp_rmb();
> >
> > +/* The vCPU is not on any blocking list. */
> >  if ( pi_blocking_list_lock == NULL )
> >  return;
> >
> > @@ -198,6 +196,13 @@ static void vmx_pi_do_resume(struct vcpu *v)
> >  spin_unlock_irqrestore(pi_blocking_list_lock, flags);
> >  }
> >
> > +static void vmx_pi_do_resume(struct vcpu *v)
> > +{
> > +ASSERT(!test_bit(_VPF_blocked, >pause_flags));
> > +
> > +vmx_pi_unblock_vcpu(v);
> > +}
> > +
> >  /* This function is called when pcidevs_lock is held */
> >  void vmx_pi_hooks_assign(struct domain *d)
> >  {
> > @@ -215,11 +220,21 @@ void vmx_pi_hooks_assign(struct domain *d)
> >  /* This function is called when pcidevs_lock is held */
> >  void vmx_pi_hooks_deassign(struct domain *d)
> >  {
> > +struct vcpu *v;
> > +
> >  if ( !iommu_intpost || !has_hvm_container_domain(d) )
> >  return;
> >
> >  ASSERT(d->arch.hvm_domain.vmx.vcpu_block);
> >
> > +/*
> > + * Pausing the domain can make sure the vCPU is not
> 
> "the vCPUs are"
> 
> > + * running and hence not calling the hooks simultaneously
> > + * when deassigning the PI hooks and removing the vCPU
> > + * from the blocking list.
> > + */
> > +domain_pause(d);
> > +
> >  d->arch.hvm_domain.vmx.vcpu_block = NULL;
> >  d->arch.hvm_domain.vmx.pi_switch_from = NULL;
> >  d->arch.hvm_domain.vmx.pi_do_resume = NULL;
> > @@ -230,6 +245,11 @@ void vmx_pi_hooks_deassign(struct domain *d)
> >   * assigned and "from" hook is NULL. However, it is not straightforward
> >   * to find a clear solution, so just leave it here.
> >   */
> > +
> > +for_each_vcpu ( d, v )
> > +vmx_pi_unblock_vcpu(v);
> > +
> > +domain_unpause(d);
> >  }
> >
> >  static int vmx_domain_initialise(struct domain *d)
> > diff 

Re: [Xen-devel] [PATCH v8 1/7] VMX: Permanently assign PI hook vmx_pi_switch_to()

2016-11-17 Thread Wu, Feng


> -Original Message-
> From: Tian, Kevin
> Sent: Friday, November 18, 2016 11:14 AM
> To: Wu, Feng ; xen-devel@lists.xen.org
> Cc: jbeul...@suse.com; andrew.coop...@citrix.com;
> george.dun...@eu.citrix.com; dario.faggi...@citrix.com
> Subject: RE: [PATCH v8 1/7] VMX: Permanently assign PI hook
> vmx_pi_switch_to()
> 
> > From: Wu, Feng
> > Sent: Friday, November 18, 2016 9:57 AM
> >
> > PI hook vmx_pi_switch_to() is needed even when any previously
> 
> even when -> even after
> 
> > assigned device is detached from the domain. Since 'SN' bit is
> > also used to control the CPU side PI and we change the state of
> > SN bit in these two functions, then evaluate this bit in
> 
> which two functions?

vmx_pi_switch_to() and vmx_pi_switch_from(), I will explicitly
describe it in the next version.

Thanks,
Feng

> 
> > vmx_deliver_posted_intr() when trying to deliver the interrupt
> > in posted way via software. The problem is if we deassign the
> > hooks while the vCPU is runnable in the runqueue with 'SN' set,
> > all the furture notificaton event will be suppressed. This patch
> > makes the hook permanently assigned.
> >
> > Signed-off-by: Feng Wu 
> > Reviewed-by: Konrad Rzeszutek Wilk 
> > ---
> > v8:
> > - Comments changes
> >
> > v7:
> > - comments changes.
> >
> > v6:
> > - Adjust the comments and wording.
> >
> > v5:
> > - Zap "pi_switch_from" hook
> >
> > v4:
> > - Don't zap vmx_pi_switch_from() and vmx_pi_switch_to() when
> > any previously assigned device is detached from the domain.
> > - Comments changes.
> >
> >  xen/arch/x86/hvm/vmx/vmx.c | 8 +++-
> >  1 file changed, 7 insertions(+), 1 deletion(-)
> >
> > diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
> > index 3d330b6..f3911f2 100644
> > --- a/xen/arch/x86/hvm/vmx/vmx.c
> > +++ b/xen/arch/x86/hvm/vmx/vmx.c
> > @@ -222,8 +222,14 @@ void vmx_pi_hooks_deassign(struct domain *d)
> >
> >  d->arch.hvm_domain.vmx.vcpu_block = NULL;
> >  d->arch.hvm_domain.vmx.pi_switch_from = NULL;
> > -d->arch.hvm_domain.vmx.pi_switch_to = NULL;
> >  d->arch.hvm_domain.vmx.pi_do_resume = NULL;
> > +
> > +/*
> > + * In fact, we could set 'd->arch.hvm_domain.vmx.pi_switch_to' to NULL
> > + * in vmx_pi_switch_to() if no new device is in the process of getting
> > + * assigned and "from" hook is NULL. However, it is not straightforward
> > + * to find a clear solution, so just leave it here.
> > + */
> 
> better to move this comment ahead of earlier zaps? Also seems the
> comment is different from what commit msg says. Please make
> them correlated.

Sure.

Thanks,
Feng

> 
> >  }
> >
> >  static int vmx_domain_initialise(struct domain *d)
> > --
> > 2.1.0


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH v8 0/7] VMX: Properly handle pi descriptor and per-cpu blocking list

2016-11-17 Thread Wu, Feng


> -Original Message-
> From: Tian, Kevin
> Sent: Friday, November 18, 2016 11:03 AM
> To: Wu, Feng ; xen-devel@lists.xen.org
> Cc: jbeul...@suse.com; andrew.coop...@citrix.com;
> george.dun...@eu.citrix.com; dario.faggi...@citrix.com
> Subject: RE: [PATCH v8 0/7] VMX: Properly handle pi descriptor and per-cpu
> blocking list
> 
> > From: Wu, Feng
> > Sent: Friday, November 18, 2016 9:57 AM
> >
> > The current VT-d PI related code may operate incorrectly in the
> > following scenarios:
> > 1. When the last assigned device is dettached from the domain, all
> > the PI related hooks are removed then, however, the vCPU can be
> > blocked, switched to another pCPU, etc, all without the aware of
> > PI. After the next time we attach another device to the domain,
> > which makes the PI realted hooks avaliable again, the status
> > of the pi descriptor is not true. Beside that, the blocking vcpu
> > may still remain in the per-cpu blocking in this case. Patch [1/7]
> > and [2/7] handle this.
> >
> > 2. [4/7] unify the code path of PI mode update and remapped mode update
> >
> > 2. When IRTE is in posted mode, we don't need to set the irq
> > affinity for it, since the destination of these interrupts is
> > vCPU and the vCPU affinity is set during vCPU scheduling. Patch
> > [5/7] handles this.
> >
> > 4. [6/7] is a cleanup patch
> >
> > 5. When a pCPU is unplugged, and there might be vCPUs on its
> > list. Since the pCPU is offline, those vCPUs might not be woken
> > up again. [7/7] addresses it.
> >
> >
> 
> just for completeness you didn't introduce 3/7 here.

Okay, maybe I need add it.

Thanks,
Feng

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH v8 3/7] VMX: Make sure PI is in proper state before install the hooks

2016-11-17 Thread Tian, Kevin
> From: Wu, Feng
> Sent: Friday, November 18, 2016 9:57 AM
> 
> We may hit the last ASSERT() in vmx_vcpu_block in the current code,
> since vmx_vcpu_block() may get called before vmx_pi_switch_to()
> has been installed or executed. Here We use cmpxchg to update
> the NDST field, this can make sure we only update the NDST when
> vmx_pi_switch_to() has not been called. So the NDST is in a
> proper state in vmx_vcpu_block().
> 
> Suggested-by: Jan Beulich 
> Signed-off-by: Feng Wu 
> Reviewed-by: Jan Beulich 

Acked-by: Kevin Tian 

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [xen-unstable baseline-only test] 68055: regressions - trouble: blocked/broken/fail/pass

2016-11-17 Thread Platform Team regression test user
This run is configured for baseline tests only.

flight 68055 xen-unstable real [real]
http://osstest.xs.citrite.net/~osstest/testlogs/logs/68055/

Regressions :-(

Tests which did not succeed and are blocking,
including tests which could not be run:
 test-xtf-amd64-amd64-13 host-install(3) broken REGR. vs. 68050
 test-armhf-armhf-xl-credit2  15 guest-start/debian.repeat fail REGR. vs. 68050
 test-amd64-i386-xl-qemuu-debianhvm-amd64 14 guest-saverestore.2 fail REGR. vs. 
68050
 test-armhf-armhf-xl-multivcpu 15 guest-start/debian.repeat fail REGR. vs. 68050

Regressions which are regarded as allowable (not blocking):
 test-amd64-amd64-xl-rtds  6 xen-boot  fail REGR. vs. 68050
 test-amd64-amd64-amd64-pvgrub 10 guest-start  fail  like 68050
 test-xtf-amd64-amd64-5   10 xtf-fep  fail   like 68050
 test-amd64-i386-xl-qemuu-winxpsp3-vcpus1  9 windows-installfail like 68050
 test-xtf-amd64-amd64-4   10 xtf-fep  fail   like 68050
 test-xtf-amd64-amd64-2   10 xtf-fep  fail   like 68050
 test-amd64-i386-xl-qemut-winxpsp3-vcpus1  9 windows-installfail like 68050
 test-xtf-amd64-amd64-3   10 xtf-fep  fail   like 68050
 test-amd64-i386-xl-qemuu-win7-amd64 16 guest-stop  fail like 68050
 test-amd64-amd64-qemuu-nested-intel 16 debian-hvm-install/l1/l2 fail like 68050

Tests which did not succeed, but are not blocking:
 test-amd64-amd64-rumprun-amd64  1 build-check(1)   blocked  n/a
 test-amd64-i386-rumprun-i386  1 build-check(1)   blocked  n/a
 build-amd64-rumprun   6 xen-buildfail   never pass
 build-i386-rumprun6 xen-buildfail   never pass
 test-armhf-armhf-xl  12 migrate-support-checkfail   never pass
 test-armhf-armhf-xl  13 saverestore-support-checkfail   never pass
 test-armhf-armhf-libvirt-xsm 12 migrate-support-checkfail   never pass
 test-armhf-armhf-libvirt-xsm 14 guest-saverestorefail   never pass
 test-armhf-armhf-xl-credit2  12 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-credit2  13 saverestore-support-checkfail   never pass
 test-armhf-armhf-libvirt-qcow2 11 migrate-support-checkfail never pass
 test-armhf-armhf-libvirt-qcow2 13 guest-saverestorefail never pass
 test-amd64-i386-libvirt-xsm  12 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-vhd  11 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-vhd  12 saverestore-support-checkfail   never pass
 test-armhf-armhf-libvirt-raw 11 migrate-support-checkfail   never pass
 test-armhf-armhf-libvirt-raw 13 guest-saverestorefail   never pass
 test-amd64-amd64-libvirt-vhd 11 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-rtds 12 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-rtds 13 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl-xsm  12 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-xsm  13 saverestore-support-checkfail   never pass
 test-amd64-amd64-xl-pvh-amd  11 guest-start  fail   never pass
 test-armhf-armhf-xl-midway   12 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-midway   13 saverestore-support-checkfail   never pass
 test-amd64-i386-xl-qemut-win7-amd64 16 guest-stop  fail never pass
 test-amd64-amd64-libvirt-xsm 12 migrate-support-checkfail   never pass
 test-amd64-amd64-xl-qemuu-win7-amd64 16 guest-stop fail never pass
 test-amd64-amd64-xl-pvh-intel 11 guest-start  fail  never pass
 test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm 10 migrate-support-check 
fail never pass
 test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm 10 migrate-support-check 
fail never pass
 test-amd64-amd64-xl-qemut-win7-amd64 16 guest-stop fail never pass
 test-amd64-amd64-libvirt 12 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-multivcpu 12 migrate-support-checkfail  never pass
 test-armhf-armhf-xl-multivcpu 13 saverestore-support-checkfail  never pass
 test-amd64-amd64-qemuu-nested-amd 16 debian-hvm-install/l1/l2  fail never pass
 test-armhf-armhf-libvirt 12 migrate-support-checkfail   never pass
 test-armhf-armhf-libvirt 14 guest-saverestorefail   never pass
 test-amd64-i386-libvirt  12 migrate-support-checkfail   never pass

version targeted for testing:
 xen  160e12899212f6f666fe38781fc5911fe9f8ad35
baseline version:
 xen  632ff7847a398a9d0de988633cfe180e5116ec32

Last test of basis68050  2016-11-16 12:48:06 Z1 days
Testing same since68055  2016-11-17 17:16:59 Z0 days1 attempts


Re: [Xen-devel] [PATCH v8 2/7] VMX: Properly handle pi when all the assigned devices are removed

2016-11-17 Thread Tian, Kevin
> From: Wu, Feng
> Sent: Friday, November 18, 2016 9:57 AM
> 
> This patch handles some corner cases when the last assigned device
> is removed from the domain. In this case we should carefully handle
> pi descriptor and the per-cpu blocking list, to make sure:
> - all the PI descriptor are in the right state when next time a
> devices is assigned to the domain again.
> - No remaining vcpus of the domain in the per-cpu blocking list.
> 
> Here we call vmx_pi_unblock_vcpu() to remove the vCPU from the blocking list
> if it is on the list. However, this could happen when vmx_vcpu_block() is
> being called, hence we might incorrectly add the vCPU to the blocking list
> while the last devcie is detached from the domain. Consider that the situation
> can only occur when detaching the last device from the domain and it is not
> a frequent operation, so we use domain_pause before that, which is considered
> as an clean and maintainable solution for the situation.
> 
> Signed-off-by: Feng Wu 
> Reviewed-by: Jan Beulich 
> ---
> v7:
> - Prevent the domain from pausing itself.
> 
> v6:
> - Comments changes
> - Rename vmx_pi_list_remove() to vmx_pi_unblock_vcpu()
> 
> v5:
> - Remove a no-op wrapper
> 
> v4:
> - Rename some functions:
>   vmx_pi_remove_vcpu_from_blocking_list() -> vmx_pi_list_remove()
>   vmx_pi_blocking_cleanup() -> vmx_pi_list_cleanup()
> - Remove the check in vmx_pi_list_cleanup()
> - Comments adjustment
> 
>  xen/arch/x86/hvm/vmx/vmx.c| 28 
>  xen/drivers/passthrough/pci.c | 14 ++
>  2 files changed, 38 insertions(+), 4 deletions(-)
> 
> diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
> index f3911f2..a8dcabe 100644
> --- a/xen/arch/x86/hvm/vmx/vmx.c
> +++ b/xen/arch/x86/hvm/vmx/vmx.c
> @@ -158,14 +158,12 @@ static void vmx_pi_switch_to(struct vcpu *v)
>  pi_clear_sn(pi_desc);
>  }
> 
> -static void vmx_pi_do_resume(struct vcpu *v)
> +static void vmx_pi_unblock_vcpu(struct vcpu *v)
>  {
>  unsigned long flags;
>  spinlock_t *pi_blocking_list_lock;
>  struct pi_desc *pi_desc = >arch.hvm_vmx.pi_desc;
> 
> -ASSERT(!test_bit(_VPF_blocked, >pause_flags));
> -
>  /*
>   * Set 'NV' field back to posted_intr_vector, so the
>   * Posted-Interrupts can be delivered to the vCPU when
> @@ -173,12 +171,12 @@ static void vmx_pi_do_resume(struct vcpu *v)
>   */
>  write_atomic(_desc->nv, posted_intr_vector);
> 
> -/* The vCPU is not on any blocking list. */
>  pi_blocking_list_lock = v->arch.hvm_vmx.pi_blocking.lock;
> 
>  /* Prevent the compiler from eliminating the local variable.*/
>  smp_rmb();
> 
> +/* The vCPU is not on any blocking list. */
>  if ( pi_blocking_list_lock == NULL )
>  return;
> 
> @@ -198,6 +196,13 @@ static void vmx_pi_do_resume(struct vcpu *v)
>  spin_unlock_irqrestore(pi_blocking_list_lock, flags);
>  }
> 
> +static void vmx_pi_do_resume(struct vcpu *v)
> +{
> +ASSERT(!test_bit(_VPF_blocked, >pause_flags));
> +
> +vmx_pi_unblock_vcpu(v);
> +}
> +
>  /* This function is called when pcidevs_lock is held */
>  void vmx_pi_hooks_assign(struct domain *d)
>  {
> @@ -215,11 +220,21 @@ void vmx_pi_hooks_assign(struct domain *d)
>  /* This function is called when pcidevs_lock is held */
>  void vmx_pi_hooks_deassign(struct domain *d)
>  {
> +struct vcpu *v;
> +
>  if ( !iommu_intpost || !has_hvm_container_domain(d) )
>  return;
> 
>  ASSERT(d->arch.hvm_domain.vmx.vcpu_block);
> 
> +/*
> + * Pausing the domain can make sure the vCPU is not

"the vCPUs are"

> + * running and hence not calling the hooks simultaneously
> + * when deassigning the PI hooks and removing the vCPU
> + * from the blocking list.
> + */
> +domain_pause(d);
> +
>  d->arch.hvm_domain.vmx.vcpu_block = NULL;
>  d->arch.hvm_domain.vmx.pi_switch_from = NULL;
>  d->arch.hvm_domain.vmx.pi_do_resume = NULL;
> @@ -230,6 +245,11 @@ void vmx_pi_hooks_deassign(struct domain *d)
>   * assigned and "from" hook is NULL. However, it is not straightforward
>   * to find a clear solution, so just leave it here.
>   */
> +
> +for_each_vcpu ( d, v )
> +vmx_pi_unblock_vcpu(v);
> +
> +domain_unpause(d);
>  }
> 
>  static int vmx_domain_initialise(struct domain *d)
> diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
> index 8bce213..e71732f 100644
> --- a/xen/drivers/passthrough/pci.c
> +++ b/xen/drivers/passthrough/pci.c
> @@ -1602,6 +1602,13 @@ int iommu_do_pci_domctl(
>  break;
> 
>  case XEN_DOMCTL_assign_device:
> +/* no domain_pause() */
> +if ( d == current->domain )
> +{
> +ret = -EINVAL;
> +break;
> +}
> +

don't understand why adding above check, and why "no domain_pause"
matters in this change.

>  ret = -ENODEV;
>  if ( domctl->u.assign_device.dev != 

Re: [Xen-devel] [PATCH v8 1/7] VMX: Permanently assign PI hook vmx_pi_switch_to()

2016-11-17 Thread Tian, Kevin
> From: Wu, Feng
> Sent: Friday, November 18, 2016 9:57 AM
> 
> PI hook vmx_pi_switch_to() is needed even when any previously

even when -> even after

> assigned device is detached from the domain. Since 'SN' bit is
> also used to control the CPU side PI and we change the state of
> SN bit in these two functions, then evaluate this bit in

which two functions?

> vmx_deliver_posted_intr() when trying to deliver the interrupt
> in posted way via software. The problem is if we deassign the
> hooks while the vCPU is runnable in the runqueue with 'SN' set,
> all the furture notificaton event will be suppressed. This patch
> makes the hook permanently assigned.
> 
> Signed-off-by: Feng Wu 
> Reviewed-by: Konrad Rzeszutek Wilk 
> ---
> v8:
> - Comments changes
> 
> v7:
> - comments changes.
> 
> v6:
> - Adjust the comments and wording.
> 
> v5:
> - Zap "pi_switch_from" hook
> 
> v4:
> - Don't zap vmx_pi_switch_from() and vmx_pi_switch_to() when
> any previously assigned device is detached from the domain.
> - Comments changes.
> 
>  xen/arch/x86/hvm/vmx/vmx.c | 8 +++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
> index 3d330b6..f3911f2 100644
> --- a/xen/arch/x86/hvm/vmx/vmx.c
> +++ b/xen/arch/x86/hvm/vmx/vmx.c
> @@ -222,8 +222,14 @@ void vmx_pi_hooks_deassign(struct domain *d)
> 
>  d->arch.hvm_domain.vmx.vcpu_block = NULL;
>  d->arch.hvm_domain.vmx.pi_switch_from = NULL;
> -d->arch.hvm_domain.vmx.pi_switch_to = NULL;
>  d->arch.hvm_domain.vmx.pi_do_resume = NULL;
> +
> +/*
> + * In fact, we could set 'd->arch.hvm_domain.vmx.pi_switch_to' to NULL
> + * in vmx_pi_switch_to() if no new device is in the process of getting
> + * assigned and "from" hook is NULL. However, it is not straightforward
> + * to find a clear solution, so just leave it here.
> + */

better to move this comment ahead of earlier zaps? Also seems the
comment is different from what commit msg says. Please make
them correlated.

>  }
> 
>  static int vmx_domain_initialise(struct domain *d)
> --
> 2.1.0


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH v8 0/7] VMX: Properly handle pi descriptor and per-cpu blocking list

2016-11-17 Thread Tian, Kevin
> From: Wu, Feng
> Sent: Friday, November 18, 2016 9:57 AM
> 
> The current VT-d PI related code may operate incorrectly in the
> following scenarios:
> 1. When the last assigned device is dettached from the domain, all
> the PI related hooks are removed then, however, the vCPU can be
> blocked, switched to another pCPU, etc, all without the aware of
> PI. After the next time we attach another device to the domain,
> which makes the PI realted hooks avaliable again, the status
> of the pi descriptor is not true. Beside that, the blocking vcpu
> may still remain in the per-cpu blocking in this case. Patch [1/7]
> and [2/7] handle this.
> 
> 2. [4/7] unify the code path of PI mode update and remapped mode update
> 
> 2. When IRTE is in posted mode, we don't need to set the irq
> affinity for it, since the destination of these interrupts is
> vCPU and the vCPU affinity is set during vCPU scheduling. Patch
> [5/7] handles this.
> 
> 4. [6/7] is a cleanup patch
> 
> 5. When a pCPU is unplugged, and there might be vCPUs on its
> list. Since the pCPU is offline, those vCPUs might not be woken
> up again. [7/7] addresses it.
> 
> 

just for completeness you didn't introduce 3/7 here.

> Feng Wu (7):
>   VMX: Permanently assign PI hook vmx_pi_switch_to()
>   VMX: Properly handle pi when all the assigned devices are removed
>   VMX: Make sure PI is in proper state before install the hooks
>   VT-d: Use one function to update both remapped and posted IRTE
>   VT-d: No need to set irq affinity for posted format IRTE
>   VT-d: Some cleanups
>   VMX: Fixup PI descriptor when cpu is offline
> 
>  xen/arch/x86/hvm/vmx/vmcs.c|  14 +--
>  xen/arch/x86/hvm/vmx/vmx.c | 133 ++-
>  xen/drivers/passthrough/pci.c  |  14 +++
>  xen/drivers/passthrough/vtd/intremap.c | 193
> +++--
>  xen/include/asm-x86/hvm/vmx/vmx.h  |   3 +
>  5 files changed, 240 insertions(+), 117 deletions(-)
> 
> --
> 2.1.0


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH v8 5/7] VT-d: No need to set irq affinity for posted format IRTE

2016-11-17 Thread Feng Wu
We don't set the affinity for posted format IRTE, since the
destination of these interrupts is vCPU and the vCPU affinity
is set during vCPU scheduling.

Signed-off-by: Feng Wu 
---
v8:
- Changes based on [6/7]

v7:
- Compare all the field in IRTE to justify whether we can suppress the update

v6:
- Make pi_can_suppress_irte_update() a check-only function
- Introduce another function pi_get_new_irte() to update the 'new_ire' if needed

v5:
- Only suppress affinity related IRTE updates for PI

v4:
- Keep the construction of new_ire and only modify the hardware
IRTE when it is not in posted mode.

 xen/drivers/passthrough/vtd/intremap.c | 87 --
 1 file changed, 52 insertions(+), 35 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/intremap.c 
b/xen/drivers/passthrough/vtd/intremap.c
index fd2a49a..0cb8c37 100644
--- a/xen/drivers/passthrough/vtd/intremap.c
+++ b/xen/drivers/passthrough/vtd/intremap.c
@@ -600,27 +600,41 @@ static int msi_msg_to_remap_entry(
 
 if ( !pi_desc )
 {
-/* Set interrupt remapping table entry */
-new_ire.remap.fpd = 0;
-new_ire.remap.dm = (msg->address_lo >> MSI_ADDR_DESTMODE_SHIFT) & 0x1;
-new_ire.remap.tm = (msg->data >> MSI_DATA_TRIGGER_SHIFT) & 0x1;
-new_ire.remap.dlm = (msg->data >> MSI_DATA_DELIVERY_MODE_SHIFT) & 0x1;
-/* Hardware require RH = 1 for LPR delivery mode */
-new_ire.remap.rh = (new_ire.remap.dlm == dest_LowestPrio);
-new_ire.remap.avail = 0;
-new_ire.remap.res_1 = 0;
-new_ire.remap.vector = (msg->data >> MSI_DATA_VECTOR_SHIFT) &
-MSI_DATA_VECTOR_MASK;
-new_ire.remap.res_2 = 0;
-if ( x2apic_enabled )
-new_ire.remap.dst = msg->dest32;
-else
-new_ire.remap.dst = ((msg->address_lo >> MSI_ADDR_DEST_ID_SHIFT)
- & 0xff) << 8;
+/*
+ * We are here because we are trying to update the IRTE to remapped 
mode,
+ * we only need to update the remapped specific fields for the 
following
+ * two cases:
+ * 1. When we create a new IRTE. A new IRTE is created when we create a
+ *new irq, so a new IRTE is always initialized with remapped 
format.
+ * 2. When the old IRTE is present and in remapped mode. Since if the 
old
+ *IRTE is in posted mode, we cannot update it to remapped mode and
+ *this is what we need to suppress. So we don't update the remapped
+ *specific fields here, we only update the commom field.
+ */
+if ( !iremap_entry->remap.p || !iremap_entry->remap.im )
+{
+/* Set interrupt remapping table entry */
+new_ire.remap.fpd = 0;
+new_ire.remap.dm = (msg->address_lo >> MSI_ADDR_DESTMODE_SHIFT) & 
0x1;
+new_ire.remap.tm = (msg->data >> MSI_DATA_TRIGGER_SHIFT) & 0x1;
+new_ire.remap.dlm = (msg->data >> MSI_DATA_DELIVERY_MODE_SHIFT) & 
0x1;
+/* Hardware require RH = 1 for LPR delivery mode */
+new_ire.remap.rh = (new_ire.remap.dlm == dest_LowestPrio);
+new_ire.remap.avail = 0;
+new_ire.remap.res_1 = 0;
+new_ire.remap.vector = (msg->data >> MSI_DATA_VECTOR_SHIFT) &
+MSI_DATA_VECTOR_MASK;
+new_ire.remap.res_2 = 0;
+if ( x2apic_enabled )
+new_ire.remap.dst = msg->dest32;
+else
+new_ire.remap.dst = ((msg->address_lo >> 
MSI_ADDR_DEST_ID_SHIFT)
+ & 0xff) << 8;
 
-new_ire.remap.res_3 = 0;
-new_ire.remap.res_4 = 0;
-new_ire.remap.p = 1;/* finally, set present bit */
+new_ire.remap.res_3 = 0;
+new_ire.remap.res_4 = 0;
+new_ire.remap.p = 1;/* finally, set present bit */
+}
 }
 else
 {
@@ -657,25 +671,28 @@ static int msi_msg_to_remap_entry(
 remap_rte->address_hi = 0;
 remap_rte->data = index - i;
 
-if ( !pi_desc )
-memcpy(iremap_entry, _ire, sizeof(struct iremap_entry));
-else
+if ( iremap_entry->val != new_ire.val )
 {
-__uint128_t ret;
+if ( !pi_desc )
+memcpy(iremap_entry, _ire, sizeof(struct iremap_entry));
+else
+{
+__uint128_t ret;
 
-old_ire = *iremap_entry;
-ret = cmpxchg16b(iremap_entry, _ire, _ire);
+old_ire = *iremap_entry;
+ret = cmpxchg16b(iremap_entry, _ire, _ire);
 
-/*
- * In the above, we use cmpxchg16 to atomically update the 128-bit 
IRTE,
- * and the hardware cannot update the IRTE behind us, so the return 
value
- * of cmpxchg16 should be the same as old_ire. This ASSERT validate it.
- */
-ASSERT(ret == old_ire.val);
-}
+/*
+ * In the above, we use 

[Xen-devel] [PATCH v8 3/7] VMX: Make sure PI is in proper state before install the hooks

2016-11-17 Thread Feng Wu
We may hit the last ASSERT() in vmx_vcpu_block in the current code,
since vmx_vcpu_block() may get called before vmx_pi_switch_to()
has been installed or executed. Here We use cmpxchg to update
the NDST field, this can make sure we only update the NDST when
vmx_pi_switch_to() has not been called. So the NDST is in a
proper state in vmx_vcpu_block().

Suggested-by: Jan Beulich 
Signed-off-by: Feng Wu 
Reviewed-by: Jan Beulich 
---
v6:
- Comments changes
- Define macro 'APIC_INVALID_DEST' for '0x'

v5:
- Use 0x as the invalid value for NDST field.

v4:
- This patch is previously called "Pause/Unpause the domain before/after 
assigning PI hooks"
- Remove the pause/unpause method
- Use cmpxchg to update NDST

 xen/arch/x86/hvm/vmx/vmcs.c   | 13 +
 xen/arch/x86/hvm/vmx/vmx.c| 27 ++-
 xen/include/asm-x86/hvm/vmx/vmx.h |  2 ++
 3 files changed, 33 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index 1bd875a..e8e3616 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -956,16 +956,13 @@ void virtual_vmcs_vmwrite(const struct vcpu *v, u32 
vmcs_encoding, u64 val)
  */
 static void pi_desc_init(struct vcpu *v)
 {
-uint32_t dest;
-
 v->arch.hvm_vmx.pi_desc.nv = posted_intr_vector;
 
-dest = cpu_physical_id(v->processor);
-
-if ( x2apic_enabled )
-v->arch.hvm_vmx.pi_desc.ndst = dest;
-else
-v->arch.hvm_vmx.pi_desc.ndst = MASK_INSR(dest, PI_xAPIC_NDST_MASK);
+/*
+ * Mark NDST as invalid, then we can use this invalid value as a
+ * marker to whether update NDST or not in vmx_pi_hooks_assign().
+ */
+v->arch.hvm_vmx.pi_desc.ndst = APIC_INVALID_DEST;
 }
 
 static int construct_vmcs(struct vcpu *v)
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index a8dcabe..a1f7903 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -206,14 +206,39 @@ static void vmx_pi_do_resume(struct vcpu *v)
 /* This function is called when pcidevs_lock is held */
 void vmx_pi_hooks_assign(struct domain *d)
 {
+struct vcpu *v;
+
 if ( !iommu_intpost || !has_hvm_container_domain(d) )
 return;
 
 ASSERT(!d->arch.hvm_domain.vmx.vcpu_block);
 
-d->arch.hvm_domain.vmx.vcpu_block = vmx_vcpu_block;
+/*
+ * We carefully handle the timing here:
+ * - Install the context switch first
+ * - Then set the NDST field
+ * - Install the block and resume hooks in the end
+ *
+ * This can make sure the PI (especially the NDST feild) is
+ * in proper state when we call vmx_vcpu_block().
+ */
 d->arch.hvm_domain.vmx.pi_switch_from = vmx_pi_switch_from;
 d->arch.hvm_domain.vmx.pi_switch_to = vmx_pi_switch_to;
+
+for_each_vcpu ( d, v )
+{
+unsigned int dest = cpu_physical_id(v->processor);
+struct pi_desc *pi_desc = >arch.hvm_vmx.pi_desc;
+
+/*
+ * We don't need to update NDST if vmx_pi_switch_to()
+ * has already got called.
+ */
+(void)cmpxchg(_desc->ndst, APIC_INVALID_DEST,
+x2apic_enabled ? dest : MASK_INSR(dest, PI_xAPIC_NDST_MASK));
+}
+
+d->arch.hvm_domain.vmx.vcpu_block = vmx_vcpu_block;
 d->arch.hvm_domain.vmx.pi_do_resume = vmx_pi_do_resume;
 }
 
diff --git a/xen/include/asm-x86/hvm/vmx/vmx.h 
b/xen/include/asm-x86/hvm/vmx/vmx.h
index 4cdd9b1..2f0435c 100644
--- a/xen/include/asm-x86/hvm/vmx/vmx.h
+++ b/xen/include/asm-x86/hvm/vmx/vmx.h
@@ -573,6 +573,8 @@ void vmx_pi_per_cpu_init(unsigned int cpu);
 void vmx_pi_hooks_assign(struct domain *d);
 void vmx_pi_hooks_deassign(struct domain *d);
 
+#define APIC_INVALID_DEST   0x
+
 /* EPT violation qualifications definitions */
 #define _EPT_READ_VIOLATION 0
 #define EPT_READ_VIOLATION  (1UL<<_EPT_READ_VIOLATION)
-- 
2.1.0


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH v8 2/7] VMX: Properly handle pi when all the assigned devices are removed

2016-11-17 Thread Feng Wu
This patch handles some corner cases when the last assigned device
is removed from the domain. In this case we should carefully handle
pi descriptor and the per-cpu blocking list, to make sure:
- all the PI descriptor are in the right state when next time a
devices is assigned to the domain again.
- No remaining vcpus of the domain in the per-cpu blocking list.

Here we call vmx_pi_unblock_vcpu() to remove the vCPU from the blocking list
if it is on the list. However, this could happen when vmx_vcpu_block() is
being called, hence we might incorrectly add the vCPU to the blocking list
while the last devcie is detached from the domain. Consider that the situation
can only occur when detaching the last device from the domain and it is not
a frequent operation, so we use domain_pause before that, which is considered
as an clean and maintainable solution for the situation.

Signed-off-by: Feng Wu 
Reviewed-by: Jan Beulich 
---
v7:
- Prevent the domain from pausing itself.

v6:
- Comments changes
- Rename vmx_pi_list_remove() to vmx_pi_unblock_vcpu()

v5:
- Remove a no-op wrapper

v4:
- Rename some functions:
vmx_pi_remove_vcpu_from_blocking_list() -> vmx_pi_list_remove()
vmx_pi_blocking_cleanup() -> vmx_pi_list_cleanup()
- Remove the check in vmx_pi_list_cleanup()
- Comments adjustment

 xen/arch/x86/hvm/vmx/vmx.c| 28 
 xen/drivers/passthrough/pci.c | 14 ++
 2 files changed, 38 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index f3911f2..a8dcabe 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -158,14 +158,12 @@ static void vmx_pi_switch_to(struct vcpu *v)
 pi_clear_sn(pi_desc);
 }
 
-static void vmx_pi_do_resume(struct vcpu *v)
+static void vmx_pi_unblock_vcpu(struct vcpu *v)
 {
 unsigned long flags;
 spinlock_t *pi_blocking_list_lock;
 struct pi_desc *pi_desc = >arch.hvm_vmx.pi_desc;
 
-ASSERT(!test_bit(_VPF_blocked, >pause_flags));
-
 /*
  * Set 'NV' field back to posted_intr_vector, so the
  * Posted-Interrupts can be delivered to the vCPU when
@@ -173,12 +171,12 @@ static void vmx_pi_do_resume(struct vcpu *v)
  */
 write_atomic(_desc->nv, posted_intr_vector);
 
-/* The vCPU is not on any blocking list. */
 pi_blocking_list_lock = v->arch.hvm_vmx.pi_blocking.lock;
 
 /* Prevent the compiler from eliminating the local variable.*/
 smp_rmb();
 
+/* The vCPU is not on any blocking list. */
 if ( pi_blocking_list_lock == NULL )
 return;
 
@@ -198,6 +196,13 @@ static void vmx_pi_do_resume(struct vcpu *v)
 spin_unlock_irqrestore(pi_blocking_list_lock, flags);
 }
 
+static void vmx_pi_do_resume(struct vcpu *v)
+{
+ASSERT(!test_bit(_VPF_blocked, >pause_flags));
+
+vmx_pi_unblock_vcpu(v);
+}
+
 /* This function is called when pcidevs_lock is held */
 void vmx_pi_hooks_assign(struct domain *d)
 {
@@ -215,11 +220,21 @@ void vmx_pi_hooks_assign(struct domain *d)
 /* This function is called when pcidevs_lock is held */
 void vmx_pi_hooks_deassign(struct domain *d)
 {
+struct vcpu *v;
+
 if ( !iommu_intpost || !has_hvm_container_domain(d) )
 return;
 
 ASSERT(d->arch.hvm_domain.vmx.vcpu_block);
 
+/*
+ * Pausing the domain can make sure the vCPU is not
+ * running and hence not calling the hooks simultaneously
+ * when deassigning the PI hooks and removing the vCPU
+ * from the blocking list.
+ */
+domain_pause(d);
+
 d->arch.hvm_domain.vmx.vcpu_block = NULL;
 d->arch.hvm_domain.vmx.pi_switch_from = NULL;
 d->arch.hvm_domain.vmx.pi_do_resume = NULL;
@@ -230,6 +245,11 @@ void vmx_pi_hooks_deassign(struct domain *d)
  * assigned and "from" hook is NULL. However, it is not straightforward
  * to find a clear solution, so just leave it here.
  */
+
+for_each_vcpu ( d, v )
+vmx_pi_unblock_vcpu(v);
+
+domain_unpause(d);
 }
 
 static int vmx_domain_initialise(struct domain *d)
diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index 8bce213..e71732f 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -1602,6 +1602,13 @@ int iommu_do_pci_domctl(
 break;
 
 case XEN_DOMCTL_assign_device:
+/* no domain_pause() */
+if ( d == current->domain )
+{
+ret = -EINVAL;
+break;
+}
+
 ret = -ENODEV;
 if ( domctl->u.assign_device.dev != XEN_DOMCTL_DEV_PCI )
 break;
@@ -1642,6 +1649,13 @@ int iommu_do_pci_domctl(
 break;
 
 case XEN_DOMCTL_deassign_device:
+/* no domain_pause() */
+if ( d == current->domain )
+{
+ret = -EINVAL;
+break;
+}
+
 ret = -ENODEV;
 if ( domctl->u.assign_device.dev != XEN_DOMCTL_DEV_PCI )
 break;
-- 
2.1.0



[Xen-devel] [PATCH v8 1/7] VMX: Permanently assign PI hook vmx_pi_switch_to()

2016-11-17 Thread Feng Wu
PI hook vmx_pi_switch_to() is needed even when any previously
assigned device is detached from the domain. Since 'SN' bit is
also used to control the CPU side PI and we change the state of
SN bit in these two functions, then evaluate this bit in
vmx_deliver_posted_intr() when trying to deliver the interrupt
in posted way via software. The problem is if we deassign the
hooks while the vCPU is runnable in the runqueue with 'SN' set,
all the furture notificaton event will be suppressed. This patch
makes the hook permanently assigned.

Signed-off-by: Feng Wu 
Reviewed-by: Konrad Rzeszutek Wilk 
---
v8:
- Comments changes

v7:
- comments changes.

v6:
- Adjust the comments and wording.

v5:
- Zap "pi_switch_from" hook

v4:
- Don't zap vmx_pi_switch_from() and vmx_pi_switch_to() when
any previously assigned device is detached from the domain.
- Comments changes.

 xen/arch/x86/hvm/vmx/vmx.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 3d330b6..f3911f2 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -222,8 +222,14 @@ void vmx_pi_hooks_deassign(struct domain *d)
 
 d->arch.hvm_domain.vmx.vcpu_block = NULL;
 d->arch.hvm_domain.vmx.pi_switch_from = NULL;
-d->arch.hvm_domain.vmx.pi_switch_to = NULL;
 d->arch.hvm_domain.vmx.pi_do_resume = NULL;
+
+/*
+ * In fact, we could set 'd->arch.hvm_domain.vmx.pi_switch_to' to NULL
+ * in vmx_pi_switch_to() if no new device is in the process of getting
+ * assigned and "from" hook is NULL. However, it is not straightforward
+ * to find a clear solution, so just leave it here.
+ */
 }
 
 static int vmx_domain_initialise(struct domain *d)
-- 
2.1.0


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH v8 7/7] VMX: Fixup PI descriptor when cpu is offline

2016-11-17 Thread Feng Wu
When cpu is offline, we need to move all the vcpus in its blocking
list to another online cpu, this patch handles it.

Signed-off-by: Feng Wu 
Reviewed-by: Jan Beulich 
---
v7:
- Pass unsigned int to vmx_pi_desc_fixup()

v6:
- Carefully suppress 'SN' to avoid missing notification event
during moving the vcpu to the new list

v5:
- Add some comments to explain why it doesn't cause deadlock
for the ABBA deadlock scenario.

v4:
- Remove the pointless check since we are in machine stop
context and no other cpus go down in parallel.

 xen/arch/x86/hvm/vmx/vmcs.c   |  1 +
 xen/arch/x86/hvm/vmx/vmx.c| 70 +++
 xen/include/asm-x86/hvm/vmx/vmx.h |  1 +
 3 files changed, 72 insertions(+)

diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index e8e3616..1846e25 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -578,6 +578,7 @@ void vmx_cpu_dead(unsigned int cpu)
 vmx_free_vmcs(per_cpu(vmxon_region, cpu));
 per_cpu(vmxon_region, cpu) = 0;
 nvmx_cpu_dead(cpu);
+vmx_pi_desc_fixup(cpu);
 }
 
 int vmx_cpu_up(void)
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index a1f7903..614d538 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -203,6 +203,76 @@ static void vmx_pi_do_resume(struct vcpu *v)
 vmx_pi_unblock_vcpu(v);
 }
 
+void vmx_pi_desc_fixup(unsigned int cpu)
+{
+unsigned int new_cpu, dest;
+unsigned long flags;
+struct arch_vmx_struct *vmx, *tmp;
+spinlock_t *new_lock, *old_lock = _cpu(vmx_pi_blocking, cpu).lock;
+struct list_head *blocked_vcpus = _cpu(vmx_pi_blocking, cpu).list;
+
+if ( !iommu_intpost )
+return;
+
+/*
+ * We are in the context of CPU_DEAD or CPU_UP_CANCELED notification,
+ * and it is impossible for a second CPU go down in parallel. So we
+ * can safely acquire the old cpu's lock and then acquire the new_cpu's
+ * lock after that.
+ */
+spin_lock_irqsave(old_lock, flags);
+
+list_for_each_entry_safe(vmx, tmp, blocked_vcpus, pi_blocking.list)
+{
+/*
+ * Suppress notification or we may miss an interrupt when the
+ * target cpu is dying.
+ */
+pi_set_sn(>pi_desc);
+
+/*
+ * Check whether a notification is pending before doing the
+ * movement, if that is the case we need to wake up it directly
+ * other than moving it to the new cpu's list.
+ */
+if ( pi_test_on(>pi_desc) )
+{
+list_del(>pi_blocking.list);
+vmx->pi_blocking.lock = NULL;
+vcpu_unblock(container_of(vmx, struct vcpu, arch.hvm_vmx));
+}
+else
+{
+/*
+ * We need to find an online cpu as the NDST of the PI descriptor, 
it
+ * doesn't matter whether it is within the cpupool of the domain or
+ * not. As long as it is online, the vCPU will be woken up once the
+ * notification event arrives.
+ */
+new_cpu = cpumask_any(_online_map);
+new_lock = _cpu(vmx_pi_blocking, new_cpu).lock;
+
+spin_lock(new_lock);
+
+ASSERT(vmx->pi_blocking.lock == old_lock);
+
+dest = cpu_physical_id(new_cpu);
+write_atomic(>pi_desc.ndst,
+ x2apic_enabled ? dest : MASK_INSR(dest, 
PI_xAPIC_NDST_MASK));
+
+list_move(>pi_blocking.list,
+  _cpu(vmx_pi_blocking, new_cpu).list);
+vmx->pi_blocking.lock = new_lock;
+
+spin_unlock(new_lock);
+}
+
+pi_clear_sn(>pi_desc);
+}
+
+spin_unlock_irqrestore(old_lock, flags);
+}
+
 /* This function is called when pcidevs_lock is held */
 void vmx_pi_hooks_assign(struct domain *d)
 {
diff --git a/xen/include/asm-x86/hvm/vmx/vmx.h 
b/xen/include/asm-x86/hvm/vmx/vmx.h
index 2f0435c..5c8fe5d 100644
--- a/xen/include/asm-x86/hvm/vmx/vmx.h
+++ b/xen/include/asm-x86/hvm/vmx/vmx.h
@@ -569,6 +569,7 @@ void free_p2m_hap_data(struct p2m_domain *p2m);
 void p2m_init_hap_data(struct p2m_domain *p2m);
 
 void vmx_pi_per_cpu_init(unsigned int cpu);
+void vmx_pi_desc_fixup(unsigned int cpu);
 
 void vmx_pi_hooks_assign(struct domain *d);
 void vmx_pi_hooks_deassign(struct domain *d);
-- 
2.1.0


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH v8 0/7] VMX: Properly handle pi descriptor and per-cpu blocking list

2016-11-17 Thread Feng Wu
The current VT-d PI related code may operate incorrectly in the
following scenarios:
1. When the last assigned device is dettached from the domain, all
the PI related hooks are removed then, however, the vCPU can be
blocked, switched to another pCPU, etc, all without the aware of
PI. After the next time we attach another device to the domain,
which makes the PI realted hooks avaliable again, the status
of the pi descriptor is not true. Beside that, the blocking vcpu
may still remain in the per-cpu blocking in this case. Patch [1/7]
and [2/7] handle this.

2. [4/7] unify the code path of PI mode update and remapped mode update

2. When IRTE is in posted mode, we don't need to set the irq
affinity for it, since the destination of these interrupts is
vCPU and the vCPU affinity is set during vCPU scheduling. Patch
[5/7] handles this.

4. [6/7] is a cleanup patch

5. When a pCPU is unplugged, and there might be vCPUs on its
list. Since the pCPU is offline, those vCPUs might not be woken
up again. [7/7] addresses it.


Feng Wu (7):
  VMX: Permanently assign PI hook vmx_pi_switch_to()
  VMX: Properly handle pi when all the assigned devices are removed
  VMX: Make sure PI is in proper state before install the hooks
  VT-d: Use one function to update both remapped and posted IRTE
  VT-d: No need to set irq affinity for posted format IRTE
  VT-d: Some cleanups
  VMX: Fixup PI descriptor when cpu is offline

 xen/arch/x86/hvm/vmx/vmcs.c|  14 +--
 xen/arch/x86/hvm/vmx/vmx.c | 133 ++-
 xen/drivers/passthrough/pci.c  |  14 +++
 xen/drivers/passthrough/vtd/intremap.c | 193 +++--
 xen/include/asm-x86/hvm/vmx/vmx.h  |   3 +
 5 files changed, 240 insertions(+), 117 deletions(-)

-- 
2.1.0


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH v8 4/7] VT-d: Use one function to update both remapped and posted IRTE

2016-11-17 Thread Feng Wu
Use one function to update both remapped IRTE and posted IRET.

Signed-off-by: Feng Wu 
---
v8:
- Newly added

 xen/drivers/passthrough/vtd/intremap.c | 162 ++---
 1 file changed, 66 insertions(+), 96 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/intremap.c 
b/xen/drivers/passthrough/vtd/intremap.c
index bfd468b..fd2a49a 100644
--- a/xen/drivers/passthrough/vtd/intremap.c
+++ b/xen/drivers/passthrough/vtd/intremap.c
@@ -420,7 +420,7 @@ void io_apic_write_remap_rte(
 __ioapic_write_entry(apic, ioapic_pin, 1, old_rte);
 }
 
-static void set_msi_source_id(struct pci_dev *pdev, struct iremap_entry *ire)
+static void set_msi_source_id(const struct pci_dev *pdev, struct iremap_entry 
*ire)
 {
 u16 seg;
 u8 bus, devfn, secbus;
@@ -548,11 +548,12 @@ static int remap_entry_to_msi_msg(
 }
 
 static int msi_msg_to_remap_entry(
-struct iommu *iommu, struct pci_dev *pdev,
-struct msi_desc *msi_desc, struct msi_msg *msg)
+struct iommu *iommu, const struct pci_dev *pdev,
+struct msi_desc *msi_desc, struct msi_msg *msg,
+const struct pi_desc *pi_desc, const uint8_t gvec)
 {
 struct iremap_entry *iremap_entry = NULL, *iremap_entries;
-struct iremap_entry new_ire;
+struct iremap_entry new_ire, old_ire;
 struct msi_msg_remap_entry *remap_rte;
 unsigned int index, i, nr = 1;
 unsigned long flags;
@@ -597,31 +598,50 @@ static int msi_msg_to_remap_entry(
 
 memcpy(_ire, iremap_entry, sizeof(struct iremap_entry));
 
-/* Set interrupt remapping table entry */
-new_ire.remap.fpd = 0;
-new_ire.remap.dm = (msg->address_lo >> MSI_ADDR_DESTMODE_SHIFT) & 0x1;
-new_ire.remap.tm = (msg->data >> MSI_DATA_TRIGGER_SHIFT) & 0x1;
-new_ire.remap.dlm = (msg->data >> MSI_DATA_DELIVERY_MODE_SHIFT) & 0x1;
-/* Hardware require RH = 1 for LPR delivery mode */
-new_ire.remap.rh = (new_ire.remap.dlm == dest_LowestPrio);
-new_ire.remap.avail = 0;
-new_ire.remap.res_1 = 0;
-new_ire.remap.vector = (msg->data >> MSI_DATA_VECTOR_SHIFT) &
-MSI_DATA_VECTOR_MASK;
-new_ire.remap.res_2 = 0;
-if ( x2apic_enabled )
-new_ire.remap.dst = msg->dest32;
+if ( !pi_desc )
+{
+/* Set interrupt remapping table entry */
+new_ire.remap.fpd = 0;
+new_ire.remap.dm = (msg->address_lo >> MSI_ADDR_DESTMODE_SHIFT) & 0x1;
+new_ire.remap.tm = (msg->data >> MSI_DATA_TRIGGER_SHIFT) & 0x1;
+new_ire.remap.dlm = (msg->data >> MSI_DATA_DELIVERY_MODE_SHIFT) & 0x1;
+/* Hardware require RH = 1 for LPR delivery mode */
+new_ire.remap.rh = (new_ire.remap.dlm == dest_LowestPrio);
+new_ire.remap.avail = 0;
+new_ire.remap.res_1 = 0;
+new_ire.remap.vector = (msg->data >> MSI_DATA_VECTOR_SHIFT) &
+MSI_DATA_VECTOR_MASK;
+new_ire.remap.res_2 = 0;
+if ( x2apic_enabled )
+new_ire.remap.dst = msg->dest32;
+else
+new_ire.remap.dst = ((msg->address_lo >> MSI_ADDR_DEST_ID_SHIFT)
+ & 0xff) << 8;
+
+new_ire.remap.res_3 = 0;
+new_ire.remap.res_4 = 0;
+new_ire.remap.p = 1;/* finally, set present bit */
+}
 else
-new_ire.remap.dst = ((msg->address_lo >> MSI_ADDR_DEST_ID_SHIFT)
- & 0xff) << 8;
+{
+new_ire.post.fpd = 0;
+new_ire.post.res_1 = 0;
+new_ire.post.res_2 = 0;
+new_ire.post.urg = 0;
+new_ire.post.im = 1;
+new_ire.post.vector = gvec;
+new_ire.post.res_3 = 0;
+new_ire.post.res_4 = 0;
+new_ire.post.res_5 = 0;
+new_ire.post.pda_l = virt_to_maddr(pi_desc) >> (32 - PDA_LOW_BIT);
+new_ire.post.pda_h = virt_to_maddr(pi_desc) >> 32;
+new_ire.post.p = 1;/* finally, set present bit */
+}
 
 if ( pdev )
 set_msi_source_id(pdev, _ire);
 else
 set_hpet_source_id(msi_desc->hpet_id, _ire);
-new_ire.remap.res_3 = 0;
-new_ire.remap.res_4 = 0;
-new_ire.remap.p = 1;/* finally, set present bit */
 
 /* now construct new MSI/MSI-X rte entry */
 remap_rte = (struct msi_msg_remap_entry *)msg;
@@ -637,7 +657,23 @@ static int msi_msg_to_remap_entry(
 remap_rte->address_hi = 0;
 remap_rte->data = index - i;
 
-memcpy(iremap_entry, _ire, sizeof(struct iremap_entry));
+if ( !pi_desc )
+memcpy(iremap_entry, _ire, sizeof(struct iremap_entry));
+else
+{
+__uint128_t ret;
+
+old_ire = *iremap_entry;
+ret = cmpxchg16b(iremap_entry, _ire, _ire);
+
+/*
+ * In the above, we use cmpxchg16 to atomically update the 128-bit 
IRTE,
+ * and the hardware cannot update the IRTE behind us, so the return 
value
+ * of cmpxchg16 should be the same as old_ire. This ASSERT validate it.
+ */
+ASSERT(ret == old_ire.val);
+}
+
  

[Xen-devel] [PATCH v8 6/7] VT-d: Some cleanups

2016-11-17 Thread Feng Wu
Use type-safe structure assignment instead of memcpy()
Use sizeof(*iremap_entry).

Signed-off-by: Feng Wu 
Reviewed-by: Konrad Rzeszutek Wilk 
---
v7:
- Remove a useless cleanup

v6:
- More descripion about the patch

 xen/drivers/passthrough/vtd/intremap.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/intremap.c 
b/xen/drivers/passthrough/vtd/intremap.c
index 0cb8c37..8664194 100644
--- a/xen/drivers/passthrough/vtd/intremap.c
+++ b/xen/drivers/passthrough/vtd/intremap.c
@@ -183,8 +183,8 @@ static void free_remap_entry(struct iommu *iommu, int index)
 GET_IREMAP_ENTRY(ir_ctrl->iremap_maddr, index,
  iremap_entries, iremap_entry);
 
-memset(iremap_entry, 0, sizeof(struct iremap_entry));
-iommu_flush_cache_entry(iremap_entry, sizeof(struct iremap_entry));
+memset(iremap_entry, 0, sizeof(*iremap_entry));
+iommu_flush_cache_entry(iremap_entry, sizeof(*iremap_entry));
 iommu_flush_iec_index(iommu, 0, index);
 
 unmap_vtd_domain_page(iremap_entries);
@@ -310,7 +310,7 @@ static int ioapic_rte_to_remap_entry(struct iommu *iommu,
 GET_IREMAP_ENTRY(ir_ctrl->iremap_maddr, index,
  iremap_entries, iremap_entry);
 
-memcpy(_ire, iremap_entry, sizeof(struct iremap_entry));
+new_ire = *iremap_entry;
 
 if ( rte_upper )
 {
@@ -353,8 +353,8 @@ static int ioapic_rte_to_remap_entry(struct iommu *iommu,
 remap_rte->format = 1;/* indicate remap format */
 }
 
-memcpy(iremap_entry, _ire, sizeof(struct iremap_entry));
-iommu_flush_cache_entry(iremap_entry, sizeof(struct iremap_entry));
+*iremap_entry = new_ire;
+iommu_flush_cache_entry(iremap_entry, sizeof(*iremap_entry));
 iommu_flush_iec_index(iommu, 0, index);
 
 unmap_vtd_domain_page(iremap_entries);
@@ -674,7 +674,7 @@ static int msi_msg_to_remap_entry(
 if ( iremap_entry->val != new_ire.val )
 {
 if ( !pi_desc )
-memcpy(iremap_entry, _ire, sizeof(struct iremap_entry));
+*iremap_entry = new_ire;
 else
 {
 __uint128_t ret;
@@ -690,7 +690,7 @@ static int msi_msg_to_remap_entry(
 ASSERT(ret == old_ire.val);
 }
 
-iommu_flush_cache_entry(iremap_entry, sizeof(struct iremap_entry));
+iommu_flush_cache_entry(iremap_entry, sizeof(*iremap_entry));
 iommu_flush_iec_index(iommu, 0, index);
 }
 
-- 
2.1.0


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH v8 5/7] VT-d: No need to set irq affinity for posted format IRTE

2016-11-17 Thread Feng Wu
We don't set the affinity for posted format IRTE, since the
destination of these interrupts is vCPU and the vCPU affinity
is set during vCPU scheduling.

Signed-off-by: Feng Wu 
---
v8:
- Changes based on [6/7]

v7:
- Compare all the field in IRTE to justify whether we can suppress the update

v6:
- Make pi_can_suppress_irte_update() a check-only function
- Introduce another function pi_get_new_irte() to update the 'new_ire' if needed

v5:
- Only suppress affinity related IRTE updates for PI

v4:
- Keep the construction of new_ire and only modify the hardware
IRTE when it is not in posted mode.

 xen/drivers/passthrough/vtd/intremap.c | 87 --
 1 file changed, 52 insertions(+), 35 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/intremap.c 
b/xen/drivers/passthrough/vtd/intremap.c
index fd2a49a..0cb8c37 100644
--- a/xen/drivers/passthrough/vtd/intremap.c
+++ b/xen/drivers/passthrough/vtd/intremap.c
@@ -600,27 +600,41 @@ static int msi_msg_to_remap_entry(
 
 if ( !pi_desc )
 {
-/* Set interrupt remapping table entry */
-new_ire.remap.fpd = 0;
-new_ire.remap.dm = (msg->address_lo >> MSI_ADDR_DESTMODE_SHIFT) & 0x1;
-new_ire.remap.tm = (msg->data >> MSI_DATA_TRIGGER_SHIFT) & 0x1;
-new_ire.remap.dlm = (msg->data >> MSI_DATA_DELIVERY_MODE_SHIFT) & 0x1;
-/* Hardware require RH = 1 for LPR delivery mode */
-new_ire.remap.rh = (new_ire.remap.dlm == dest_LowestPrio);
-new_ire.remap.avail = 0;
-new_ire.remap.res_1 = 0;
-new_ire.remap.vector = (msg->data >> MSI_DATA_VECTOR_SHIFT) &
-MSI_DATA_VECTOR_MASK;
-new_ire.remap.res_2 = 0;
-if ( x2apic_enabled )
-new_ire.remap.dst = msg->dest32;
-else
-new_ire.remap.dst = ((msg->address_lo >> MSI_ADDR_DEST_ID_SHIFT)
- & 0xff) << 8;
+/*
+ * We are here because we are trying to update the IRTE to remapped 
mode,
+ * we only need to update the remapped specific fields for the 
following
+ * two cases:
+ * 1. When we create a new IRTE. A new IRTE is created when we create a
+ *new irq, so a new IRTE is always initialized with remapped 
format.
+ * 2. When the old IRTE is present and in remapped mode. Since if the 
old
+ *IRTE is in posted mode, we cannot update it to remapped mode and
+ *this is what we need to suppress. So we don't update the remapped
+ *specific fields here, we only update the commom field.
+ */
+if ( !iremap_entry->remap.p || !iremap_entry->remap.im )
+{
+/* Set interrupt remapping table entry */
+new_ire.remap.fpd = 0;
+new_ire.remap.dm = (msg->address_lo >> MSI_ADDR_DESTMODE_SHIFT) & 
0x1;
+new_ire.remap.tm = (msg->data >> MSI_DATA_TRIGGER_SHIFT) & 0x1;
+new_ire.remap.dlm = (msg->data >> MSI_DATA_DELIVERY_MODE_SHIFT) & 
0x1;
+/* Hardware require RH = 1 for LPR delivery mode */
+new_ire.remap.rh = (new_ire.remap.dlm == dest_LowestPrio);
+new_ire.remap.avail = 0;
+new_ire.remap.res_1 = 0;
+new_ire.remap.vector = (msg->data >> MSI_DATA_VECTOR_SHIFT) &
+MSI_DATA_VECTOR_MASK;
+new_ire.remap.res_2 = 0;
+if ( x2apic_enabled )
+new_ire.remap.dst = msg->dest32;
+else
+new_ire.remap.dst = ((msg->address_lo >> 
MSI_ADDR_DEST_ID_SHIFT)
+ & 0xff) << 8;
 
-new_ire.remap.res_3 = 0;
-new_ire.remap.res_4 = 0;
-new_ire.remap.p = 1;/* finally, set present bit */
+new_ire.remap.res_3 = 0;
+new_ire.remap.res_4 = 0;
+new_ire.remap.p = 1;/* finally, set present bit */
+}
 }
 else
 {
@@ -657,25 +671,28 @@ static int msi_msg_to_remap_entry(
 remap_rte->address_hi = 0;
 remap_rte->data = index - i;
 
-if ( !pi_desc )
-memcpy(iremap_entry, _ire, sizeof(struct iremap_entry));
-else
+if ( iremap_entry->val != new_ire.val )
 {
-__uint128_t ret;
+if ( !pi_desc )
+memcpy(iremap_entry, _ire, sizeof(struct iremap_entry));
+else
+{
+__uint128_t ret;
 
-old_ire = *iremap_entry;
-ret = cmpxchg16b(iremap_entry, _ire, _ire);
+old_ire = *iremap_entry;
+ret = cmpxchg16b(iremap_entry, _ire, _ire);
 
-/*
- * In the above, we use cmpxchg16 to atomically update the 128-bit 
IRTE,
- * and the hardware cannot update the IRTE behind us, so the return 
value
- * of cmpxchg16 should be the same as old_ire. This ASSERT validate it.
- */
-ASSERT(ret == old_ire.val);
-}
+/*
+ * In the above, we use 

[Xen-devel] [qemu-mainline test] 102365: regressions - FAIL

2016-11-17 Thread osstest service owner
flight 102365 qemu-mainline real [real]
http://logs.test-lab.xenproject.org/osstest/logs/102365/

Regressions :-(

Tests which did not succeed and are blocking,
including tests which could not be run:
 test-amd64-amd64-libvirt-vhd  9 debian-di-installfail REGR. vs. 101909
 test-amd64-amd64-xl-qcow2 9 debian-di-installfail REGR. vs. 101909
 test-amd64-amd64-libvirt 11 guest-start  fail REGR. vs. 101909
 test-amd64-amd64-libvirt-xsm 11 guest-start  fail REGR. vs. 101909
 test-armhf-armhf-xl-vhd   9 debian-di-installfail REGR. vs. 101909
 test-amd64-i386-libvirt-pair 20 guest-start/debian   fail REGR. vs. 101909
 test-armhf-armhf-libvirt-raw  9 debian-di-installfail REGR. vs. 101909
 test-amd64-i386-libvirt  11 guest-start  fail REGR. vs. 101909
 test-amd64-i386-libvirt-xsm  11 guest-start  fail REGR. vs. 101909
 test-armhf-armhf-libvirt-qcow2  9 debian-di-install  fail REGR. vs. 101909
 test-amd64-amd64-libvirt-pair 20 guest-start/debian  fail REGR. vs. 101909
 test-armhf-armhf-libvirt-xsm 11 guest-start  fail REGR. vs. 101909
 test-armhf-armhf-libvirt 11 guest-start  fail REGR. vs. 101909

Regressions which are regarded as allowable (not blocking):
 test-amd64-i386-xl-qemuu-win7-amd64 16 guest-stop fail like 101909
 test-amd64-amd64-xl-qemuu-win7-amd64 16 guest-stopfail like 101909
 test-armhf-armhf-xl-rtds 15 guest-start/debian.repeatfail  like 101909
 test-amd64-amd64-xl-rtds  9 debian-install   fail  like 101909

Tests which did not succeed, but are not blocking:
 test-amd64-amd64-xl-pvh-amd  11 guest-start  fail   never pass
 test-amd64-amd64-xl-pvh-intel 11 guest-start  fail  never pass
 test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm 10 migrate-support-check 
fail never pass
 test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm 10 migrate-support-check 
fail never pass
 test-armhf-armhf-xl-multivcpu 12 migrate-support-checkfail  never pass
 test-armhf-armhf-xl-multivcpu 13 saverestore-support-checkfail  never pass
 test-armhf-armhf-xl  12 migrate-support-checkfail   never pass
 test-armhf-armhf-xl  13 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl-cubietruck 12 migrate-support-checkfail never pass
 test-armhf-armhf-xl-cubietruck 13 saverestore-support-checkfail never pass
 test-armhf-armhf-xl-credit2  12 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-credit2  13 saverestore-support-checkfail   never pass
 test-amd64-amd64-qemuu-nested-amd 16 debian-hvm-install/l1/l2  fail never pass
 test-armhf-armhf-xl-arndale  12 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-arndale  13 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl-xsm  12 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-xsm  13 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl-rtds 12 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-rtds 13 saverestore-support-checkfail   never pass

version targeted for testing:
 qemuub0bcc86d2a87456f5a276f941dc775b265b309cf
baseline version:
 qemuu199a5bde46b0eab898ab1ec591f423000302569f

Last test of basis   101909  2016-11-03 23:21:40 Z   14 days
Failing since101943  2016-11-04 22:40:48 Z   13 days   27 attempts
Testing same since   102290  2016-11-16 07:12:21 Z1 days5 attempts


People who touched revisions under test:
  Alberto Garcia 
  Ankit Kumar 
  ann.zhuangyany...@huawei.com
  Ashijeet Acharya 
  Balbir singh 
  Bharata B Rao 
  Brian Candler 
  Christian Borntraeger 
  Cornelia Huck 
  Cédric Le Goater 
  Daniel Oram 
  Daniel P. Berrange 
  David Gibson 
  Doug Evans 
  Eduardo Habkost 
  Eric Blake 
  Fam Zheng 
  Gautham R. Shenoy 
  Gerd Hoffmann 
  Gonglei 
  Greg Kurz 
  Halil Pasic 
  Jason Wang 
  Jeff Cody 
  John Snow 
  Jose Ricardo Ziviani 
  Juan Quintela 
  Julian Brown 
  Kevin Wolf 
  Ladi Prosek 
  Li Qiang 
  Marc-André Lureau 
  Marcel Apfelbaum 
  Marcin Krzeminski 

[Xen-devel] [ovmf test] 102367: all pass - PUSHED

2016-11-17 Thread osstest service owner
flight 102367 ovmf real [real]
http://logs.test-lab.xenproject.org/osstest/logs/102367/

Perfect :-)
All tests in this flight passed as required
version targeted for testing:
 ovmf 4e7872d2f71f511df155a9048f06761afce751da
baseline version:
 ovmf 28b3a713b66998a8be3e8558eb85f18699e15b2e

Last test of basis   102363  2016-11-17 20:14:20 Z0 days
Testing same since   102367  2016-11-17 23:13:51 Z0 days1 attempts


People who touched revisions under test:
  Maurice Ma 

jobs:
 build-amd64-xsm  pass
 build-i386-xsm   pass
 build-amd64  pass
 build-i386   pass
 build-amd64-libvirt  pass
 build-i386-libvirt   pass
 build-amd64-pvopspass
 build-i386-pvops pass
 test-amd64-amd64-xl-qemuu-ovmf-amd64 pass
 test-amd64-i386-xl-qemuu-ovmf-amd64  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 :

+ branch=ovmf
+ revision=4e7872d2f71f511df155a9048f06761afce751da
+ . ./cri-lock-repos
++ . ./cri-common
+++ . ./cri-getconfig
+++ umask 002
+++ getrepos
 getconfig Repos
 perl -e '
use Osstest;
readglobalconfig();
print $c{"Repos"} or die $!;
'
+++ local repos=/home/osstest/repos
+++ '[' -z /home/osstest/repos ']'
+++ '[' '!' -d /home/osstest/repos ']'
+++ echo /home/osstest/repos
++ repos=/home/osstest/repos
++ repos_lock=/home/osstest/repos/lock
++ '[' x '!=' x/home/osstest/repos/lock ']'
++ OSSTEST_REPOS_LOCK_LOCKED=/home/osstest/repos/lock
++ exec with-lock-ex -w /home/osstest/repos/lock ./ap-push ovmf 
4e7872d2f71f511df155a9048f06761afce751da
+ branch=ovmf
+ revision=4e7872d2f71f511df155a9048f06761afce751da
+ . ./cri-lock-repos
++ . ./cri-common
+++ . ./cri-getconfig
+++ umask 002
+++ getrepos
 getconfig Repos
 perl -e '
use Osstest;
readglobalconfig();
print $c{"Repos"} or die $!;
'
+++ local repos=/home/osstest/repos
+++ '[' -z /home/osstest/repos ']'
+++ '[' '!' -d /home/osstest/repos ']'
+++ echo /home/osstest/repos
++ repos=/home/osstest/repos
++ repos_lock=/home/osstest/repos/lock
++ '[' x/home/osstest/repos/lock '!=' x/home/osstest/repos/lock ']'
+ . ./cri-common
++ . ./cri-getconfig
++ umask 002
+ select_xenbranch
+ case "$branch" in
+ tree=ovmf
+ xenbranch=xen-unstable
+ '[' xovmf = xlinux ']'
+ linuxbranch=
+ '[' x = x ']'
+ qemuubranch=qemu-upstream-unstable
+ select_prevxenbranch
++ ./cri-getprevxenbranch xen-unstable
+ prevxenbranch=xen-4.7-testing
+ '[' x4e7872d2f71f511df155a9048f06761afce751da = x ']'
+ : tested/2.6.39.x
+ . ./ap-common
++ : osst...@xenbits.xen.org
+++ getconfig OsstestUpstream
+++ perl -e '
use Osstest;
readglobalconfig();
print $c{"OsstestUpstream"} or die $!;
'
++ :
++ : git://xenbits.xen.org/xen.git
++ : osst...@xenbits.xen.org:/home/xen/git/xen.git
++ : git://xenbits.xen.org/qemu-xen-traditional.git
++ : git://git.kernel.org
++ : git://git.kernel.org/pub/scm/linux/kernel/git
++ : git
++ : git://xenbits.xen.org/xtf.git
++ : osst...@xenbits.xen.org:/home/xen/git/xtf.git
++ : git://xenbits.xen.org/xtf.git
++ : git://xenbits.xen.org/libvirt.git
++ : osst...@xenbits.xen.org:/home/xen/git/libvirt.git
++ : git://xenbits.xen.org/libvirt.git
++ : git://xenbits.xen.org/osstest/rumprun.git
++ : git
++ : git://xenbits.xen.org/osstest/rumprun.git
++ : osst...@xenbits.xen.org:/home/xen/git/osstest/rumprun.git
++ : git://git.seabios.org/seabios.git
++ : osst...@xenbits.xen.org:/home/xen/git/osstest/seabios.git
++ : git://xenbits.xen.org/osstest/seabios.git
++ : https://github.com/tianocore/edk2.git
++ : osst...@xenbits.xen.org:/home/xen/git/osstest/ovmf.git
++ : git://xenbits.xen.org/osstest/ovmf.git
++ : git://xenbits.xen.org/osstest/linux-firmware.git
++ : osst...@xenbits.xen.org:/home/osstest/ext/linux-firmware.git
++ : git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
++ : 

[Xen-devel] [ovmf baseline-only test] 68056: all pass

2016-11-17 Thread Platform Team regression test user
This run is configured for baseline tests only.

flight 68056 ovmf real [real]
http://osstest.xs.citrite.net/~osstest/testlogs/logs/68056/

Perfect :-)
All tests in this flight passed as required
version targeted for testing:
 ovmf 2048ab4b3ec966183eb87d93d9cdab05fe9cc840
baseline version:
 ovmf e242cdfb307a6dfe2c0f75c4719f5c1f6b418625

Last test of basis68051  2016-11-16 13:16:49 Z1 days
Testing same since68056  2016-11-17 17:17:56 Z0 days1 attempts


People who touched revisions under test:
  Eric Dong 
  Jeff Fan 
  Jiaxin Wu 
  Jiewen Yao 
  Laszlo Ersek 
  Liming Gao 
  Qin Long 
  Star Zeng 

jobs:
 build-amd64-xsm  pass
 build-i386-xsm   pass
 build-amd64  pass
 build-i386   pass
 build-amd64-libvirt  pass
 build-i386-libvirt   pass
 build-amd64-pvopspass
 build-i386-pvops pass
 test-amd64-amd64-xl-qemuu-ovmf-amd64 pass
 test-amd64-i386-xl-qemuu-ovmf-amd64  pass



sg-report-flight on osstest.xs.citrite.net
logs: /home/osstest/logs
images: /home/osstest/images

Logs, config files, etc. are available at
http://osstest.xs.citrite.net/~osstest/testlogs/logs

Test harness code can be found at
http://xenbits.xensource.com/gitweb?p=osstest.git;a=summary


Push not applicable.

(No revision log; it would be 558 lines long.)

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [ovmf test] 102363: all pass - PUSHED

2016-11-17 Thread osstest service owner
flight 102363 ovmf real [real]
http://logs.test-lab.xenproject.org/osstest/logs/102363/

Perfect :-)
All tests in this flight passed as required
version targeted for testing:
 ovmf 28b3a713b66998a8be3e8558eb85f18699e15b2e
baseline version:
 ovmf 5ea2bad0d9ab6a2465195badd323313553baa61b

Last test of basis   102360  2016-11-17 18:18:11 Z0 days
Testing same since   102363  2016-11-17 20:14:20 Z0 days1 attempts


People who touched revisions under test:
  Maurice Ma 

jobs:
 build-amd64-xsm  pass
 build-i386-xsm   pass
 build-amd64  pass
 build-i386   pass
 build-amd64-libvirt  pass
 build-i386-libvirt   pass
 build-amd64-pvopspass
 build-i386-pvops pass
 test-amd64-amd64-xl-qemuu-ovmf-amd64 pass
 test-amd64-i386-xl-qemuu-ovmf-amd64  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 :

+ branch=ovmf
+ revision=28b3a713b66998a8be3e8558eb85f18699e15b2e
+ . ./cri-lock-repos
++ . ./cri-common
+++ . ./cri-getconfig
+++ umask 002
+++ getrepos
 getconfig Repos
 perl -e '
use Osstest;
readglobalconfig();
print $c{"Repos"} or die $!;
'
+++ local repos=/home/osstest/repos
+++ '[' -z /home/osstest/repos ']'
+++ '[' '!' -d /home/osstest/repos ']'
+++ echo /home/osstest/repos
++ repos=/home/osstest/repos
++ repos_lock=/home/osstest/repos/lock
++ '[' x '!=' x/home/osstest/repos/lock ']'
++ OSSTEST_REPOS_LOCK_LOCKED=/home/osstest/repos/lock
++ exec with-lock-ex -w /home/osstest/repos/lock ./ap-push ovmf 
28b3a713b66998a8be3e8558eb85f18699e15b2e
+ branch=ovmf
+ revision=28b3a713b66998a8be3e8558eb85f18699e15b2e
+ . ./cri-lock-repos
++ . ./cri-common
+++ . ./cri-getconfig
+++ umask 002
+++ getrepos
 getconfig Repos
 perl -e '
use Osstest;
readglobalconfig();
print $c{"Repos"} or die $!;
'
+++ local repos=/home/osstest/repos
+++ '[' -z /home/osstest/repos ']'
+++ '[' '!' -d /home/osstest/repos ']'
+++ echo /home/osstest/repos
++ repos=/home/osstest/repos
++ repos_lock=/home/osstest/repos/lock
++ '[' x/home/osstest/repos/lock '!=' x/home/osstest/repos/lock ']'
+ . ./cri-common
++ . ./cri-getconfig
++ umask 002
+ select_xenbranch
+ case "$branch" in
+ tree=ovmf
+ xenbranch=xen-unstable
+ '[' xovmf = xlinux ']'
+ linuxbranch=
+ '[' x = x ']'
+ qemuubranch=qemu-upstream-unstable
+ select_prevxenbranch
++ ./cri-getprevxenbranch xen-unstable
+ prevxenbranch=xen-4.7-testing
+ '[' x28b3a713b66998a8be3e8558eb85f18699e15b2e = x ']'
+ : tested/2.6.39.x
+ . ./ap-common
++ : osst...@xenbits.xen.org
+++ getconfig OsstestUpstream
+++ perl -e '
use Osstest;
readglobalconfig();
print $c{"OsstestUpstream"} or die $!;
'
++ :
++ : git://xenbits.xen.org/xen.git
++ : osst...@xenbits.xen.org:/home/xen/git/xen.git
++ : git://xenbits.xen.org/qemu-xen-traditional.git
++ : git://git.kernel.org
++ : git://git.kernel.org/pub/scm/linux/kernel/git
++ : git
++ : git://xenbits.xen.org/xtf.git
++ : osst...@xenbits.xen.org:/home/xen/git/xtf.git
++ : git://xenbits.xen.org/xtf.git
++ : git://xenbits.xen.org/libvirt.git
++ : osst...@xenbits.xen.org:/home/xen/git/libvirt.git
++ : git://xenbits.xen.org/libvirt.git
++ : git://xenbits.xen.org/osstest/rumprun.git
++ : git
++ : git://xenbits.xen.org/osstest/rumprun.git
++ : osst...@xenbits.xen.org:/home/xen/git/osstest/rumprun.git
++ : git://git.seabios.org/seabios.git
++ : osst...@xenbits.xen.org:/home/xen/git/osstest/seabios.git
++ : git://xenbits.xen.org/osstest/seabios.git
++ : https://github.com/tianocore/edk2.git
++ : osst...@xenbits.xen.org:/home/xen/git/osstest/ovmf.git
++ : git://xenbits.xen.org/osstest/ovmf.git
++ : git://xenbits.xen.org/osstest/linux-firmware.git
++ : osst...@xenbits.xen.org:/home/osstest/ext/linux-firmware.git
++ : git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
++ : 

Re: [Xen-devel] Xen like VirtualBox

2016-11-17 Thread Jason Long
Please thinking about a nice GUI. After it users like me and book author 
working and introduce Xen more than it.

Thank you.

On Tue, 11/15/16, Jason Long  wrote:

 Subject: Re: [Xen-devel] Xen like VirtualBox
 To: "George Dunlap" , "John Haxby" 
 Cc: "xen-devel@lists.xen.org" 
 Date: Tuesday, November 15, 2016, 6:05 AM
 
 Thank you but I guess it is serious
 for Xen.
 Are you Sure Red Hat company help Xen? I guess you wrong.
 Red Hat employee not mean Red Hat company and they can help
 other Open Source projects as hobbyist. I guess some Citrix
 guys help KVM as hobbyist too. When you read Virtualization
 books then all of them explain VirtualBox and VMWare
 Workstation but why not Xen? It is because of a GUI leak. In
 my opinion, Xen and Citrix guys must work on a nice
 interface for Xen and don't thinking about something like
 virt-manager or..
 
 
 
 
 On Tuesday, November 15, 2016 5:28 PM, George Dunlap 
 wrote:
 On Tue, Nov 15, 2016 at 11:54 AM, John Haxby 
 wrote:
 
 > On 15/11/16 11:17, Jason Long wrote:
 >> You said a Red Hat employee and this company like
 KVM not Xen.
 >
 > That makes no sense.  You're denying what it says
 on the
 > virt-manager.org web site as well as denying what it
 says in the
 > description of the RPM.   Even the Red
 Hat RPM for virt-manager says
 > that it works with Xen (I'm looking at the RHEL6 source
 and it says
 > "administering virtual machines for KVM, Xen, and
 QEmu").
 >
 > You can choose to avoid anything to do with Red Hat
 because of their
 > preference of KVM over Xen, but, as the English saying
 goes, that's
 > cutting your nose off to spite your face.
 
 To corroborate this, two points:
 
 First, RedHat generally do Open Source properly: They run
 projects
 like virt-manager and libvirt as proper open-source
 communities, even
 when their engineers are doing the lion's share of the
 work.
 Obviously the RedHat engineers focus on functionality which
 is
 important to RedHat.  But it's been my consistent
 experience that
 these projects accommodate work that people from the 
 Xen community
 put in.  The libvirt guys don't actively develop Xen
 functionality for
 libvirt, but if we submit patches they get constructive
 review, and if
 someone else breaks existing Xen functionality they fix it.
 
 Secondly, while Citrix doesn't use virt-manager for Xen,
 SuSE and
 Oracle do (I believe).
 
 If you know of bugs or deficiencies in virt-manager's Xen
 support,
 then please do report them.  But don't dismiss it
 out-of-hand simply
 because RedHat are the main contributors.
 
 -George
 

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [qemu-mainline test] 102351: regressions - trouble: blocked/broken/fail/pass

2016-11-17 Thread osstest service owner
flight 102351 qemu-mainline real [real]
http://logs.test-lab.xenproject.org/osstest/logs/102351/

Regressions :-(

Tests which did not succeed and are blocking,
including tests which could not be run:
 test-amd64-amd64-libvirt-vhd  9 debian-di-installfail REGR. vs. 101909
 test-amd64-amd64-xl-qcow2 9 debian-di-installfail REGR. vs. 101909
 test-amd64-amd64-libvirt 11 guest-start  fail REGR. vs. 101909
 build-armhf-pvops 4 host-build-prep  fail REGR. vs. 101909
 test-amd64-amd64-libvirt-xsm 11 guest-start  fail REGR. vs. 101909
 test-amd64-i386-libvirt-pair 20 guest-start/debian   fail REGR. vs. 101909
 test-amd64-i386-libvirt  11 guest-start  fail REGR. vs. 101909
 test-amd64-i386-libvirt-xsm  11 guest-start  fail REGR. vs. 101909
 test-amd64-amd64-libvirt-pair 20 guest-start/debian  fail REGR. vs. 101909

Regressions which are regarded as allowable (not blocking):
 test-amd64-i386-xl-qemuu-win7-amd64 16 guest-stop fail like 101909
 test-amd64-amd64-xl-qemuu-win7-amd64 16 guest-stopfail like 101909
 test-amd64-amd64-xl-rtds  9 debian-install   fail  like 101909

Tests which did not succeed, but are not blocking:
 test-armhf-armhf-xl-multivcpu  1 build-check(1)   blocked  n/a
 test-armhf-armhf-xl-credit2   1 build-check(1)   blocked  n/a
 test-armhf-armhf-libvirt  1 build-check(1)   blocked  n/a
 test-armhf-armhf-xl-cubietruck  1 build-check(1)   blocked  n/a
 test-armhf-armhf-xl-rtds  1 build-check(1)   blocked  n/a
 test-armhf-armhf-libvirt-qcow2  1 build-check(1)   blocked  n/a
 test-armhf-armhf-libvirt-raw  1 build-check(1)   blocked  n/a
 test-armhf-armhf-xl-arndale   1 build-check(1)   blocked  n/a
 test-armhf-armhf-libvirt-xsm  1 build-check(1)   blocked  n/a
 test-armhf-armhf-xl   1 build-check(1)   blocked  n/a
 test-armhf-armhf-xl-xsm   1 build-check(1)   blocked  n/a
 test-armhf-armhf-xl-vhd   1 build-check(1)   blocked  n/a
 test-amd64-amd64-xl-pvh-amd  11 guest-start  fail   never pass
 test-amd64-amd64-xl-pvh-intel 11 guest-start  fail  never pass
 test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm 10 migrate-support-check 
fail never pass
 test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm 10 migrate-support-check 
fail never pass
 test-amd64-amd64-qemuu-nested-amd 16 debian-hvm-install/l1/l2  fail never pass

version targeted for testing:
 qemuub0bcc86d2a87456f5a276f941dc775b265b309cf
baseline version:
 qemuu199a5bde46b0eab898ab1ec591f423000302569f

Last test of basis   101909  2016-11-03 23:21:40 Z   13 days
Failing since101943  2016-11-04 22:40:48 Z   12 days   26 attempts
Testing same since   102290  2016-11-16 07:12:21 Z1 days4 attempts


People who touched revisions under test:
  Alberto Garcia 
  Ankit Kumar 
  ann.zhuangyany...@huawei.com
  Ashijeet Acharya 
  Balbir singh 
  Bharata B Rao 
  Brian Candler 
  Christian Borntraeger 
  Cornelia Huck 
  Cédric Le Goater 
  Daniel Oram 
  Daniel P. Berrange 
  David Gibson 
  Doug Evans 
  Eduardo Habkost 
  Eric Blake 
  Fam Zheng 
  Gautham R. Shenoy 
  Gerd Hoffmann 
  Gonglei 
  Greg Kurz 
  Halil Pasic 
  Jason Wang 
  Jeff Cody 
  John Snow 
  Jose Ricardo Ziviani 
  Juan Quintela 
  Julian Brown 
  Kevin Wolf 
  Ladi Prosek 
  Li Qiang 
  Marc-André Lureau 
  Marcel Apfelbaum 
  Marcin Krzeminski 
  Max Reitz 
  Michael S. Tsirkin 
  Michael Tokarev 
  Nikunj A Dadhania 
  Olaf Hering 
  Paolo Bonzini 
  Peter Korsgaard 
  Peter Maydell 
  Peter Xu 
  Prasad J Pandit 
  Rafael David Tinoco 
  Samuel Thibault 
  Sander Eikelenboom 
  Stefan Hajnoczi 
  Stefano 

[Xen-devel] [xtf test] 102361: all pass - PUSHED

2016-11-17 Thread osstest service owner
flight 102361 xtf real [real]
http://logs.test-lab.xenproject.org/osstest/logs/102361/

Perfect :-)
All tests in this flight passed as required
version targeted for testing:
 xtf  a8bca39aa38912c72eb7c2a1abc1a546c46b8ca8
baseline version:
 xtf  d67f14955a854474cf1a837a9bacf92bba15c152

Last test of basis   102301  2016-11-16 13:25:55 Z1 days
Testing same since   102361  2016-11-17 19:12:53 Z0 days1 attempts


People who touched revisions under test:
  Andrew Cooper 

jobs:
 build-amd64-xtf  pass
 build-amd64  pass
 build-amd64-pvopspass
 test-xtf-amd64-amd64-1   pass
 test-xtf-amd64-amd64-2   pass
 test-xtf-amd64-amd64-3   pass
 test-xtf-amd64-amd64-4   pass
 test-xtf-amd64-amd64-5   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 :

+ branch=xtf
+ revision=a8bca39aa38912c72eb7c2a1abc1a546c46b8ca8
+ . ./cri-lock-repos
++ . ./cri-common
+++ . ./cri-getconfig
+++ umask 002
+++ getrepos
 getconfig Repos
 perl -e '
use Osstest;
readglobalconfig();
print $c{"Repos"} or die $!;
'
+++ local repos=/home/osstest/repos
+++ '[' -z /home/osstest/repos ']'
+++ '[' '!' -d /home/osstest/repos ']'
+++ echo /home/osstest/repos
++ repos=/home/osstest/repos
++ repos_lock=/home/osstest/repos/lock
++ '[' x '!=' x/home/osstest/repos/lock ']'
++ OSSTEST_REPOS_LOCK_LOCKED=/home/osstest/repos/lock
++ exec with-lock-ex -w /home/osstest/repos/lock ./ap-push xtf 
a8bca39aa38912c72eb7c2a1abc1a546c46b8ca8
+ branch=xtf
+ revision=a8bca39aa38912c72eb7c2a1abc1a546c46b8ca8
+ . ./cri-lock-repos
++ . ./cri-common
+++ . ./cri-getconfig
+++ umask 002
+++ getrepos
 getconfig Repos
 perl -e '
use Osstest;
readglobalconfig();
print $c{"Repos"} or die $!;
'
+++ local repos=/home/osstest/repos
+++ '[' -z /home/osstest/repos ']'
+++ '[' '!' -d /home/osstest/repos ']'
+++ echo /home/osstest/repos
++ repos=/home/osstest/repos
++ repos_lock=/home/osstest/repos/lock
++ '[' x/home/osstest/repos/lock '!=' x/home/osstest/repos/lock ']'
+ . ./cri-common
++ . ./cri-getconfig
++ umask 002
+ select_xenbranch
+ case "$branch" in
+ tree=xtf
+ xenbranch=xen-unstable
+ '[' xxtf = xlinux ']'
+ linuxbranch=
+ '[' x = x ']'
+ qemuubranch=qemu-upstream-unstable
+ select_prevxenbranch
++ ./cri-getprevxenbranch xen-unstable
+ prevxenbranch=xen-4.7-testing
+ '[' xa8bca39aa38912c72eb7c2a1abc1a546c46b8ca8 = x ']'
+ : tested/2.6.39.x
+ . ./ap-common
++ : osst...@xenbits.xen.org
+++ getconfig OsstestUpstream
+++ perl -e '
use Osstest;
readglobalconfig();
print $c{"OsstestUpstream"} or die $!;
'
++ :
++ : git://xenbits.xen.org/xen.git
++ : osst...@xenbits.xen.org:/home/xen/git/xen.git
++ : git://xenbits.xen.org/qemu-xen-traditional.git
++ : git://git.kernel.org
++ : git://git.kernel.org/pub/scm/linux/kernel/git
++ : git
++ : git://xenbits.xen.org/xtf.git
++ : osst...@xenbits.xen.org:/home/xen/git/xtf.git
++ : git://xenbits.xen.org/xtf.git
++ : git://xenbits.xen.org/libvirt.git
++ : osst...@xenbits.xen.org:/home/xen/git/libvirt.git
++ : git://xenbits.xen.org/libvirt.git
++ : git://xenbits.xen.org/osstest/rumprun.git
++ : git
++ : git://xenbits.xen.org/osstest/rumprun.git
++ : osst...@xenbits.xen.org:/home/xen/git/osstest/rumprun.git
++ : git://git.seabios.org/seabios.git
++ : osst...@xenbits.xen.org:/home/xen/git/osstest/seabios.git
++ : git://xenbits.xen.org/osstest/seabios.git
++ : https://github.com/tianocore/edk2.git
++ : osst...@xenbits.xen.org:/home/xen/git/osstest/ovmf.git
++ : git://xenbits.xen.org/osstest/ovmf.git
++ : git://xenbits.xen.org/osstest/linux-firmware.git
++ : osst...@xenbits.xen.org:/home/osstest/ext/linux-firmware.git
++ : git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
++ : osst...@xenbits.xen.org:/home/xen/git/linux-pvops.git
++ : git://xenbits.xen.org/linux-pvops.git
++ : tested/linux-3.14
++ : tested/linux-arm-xen
++ '[' 

[Xen-devel] [PATCH v3 (re-send)] xen/gntdev: Use mempolicy instead of VM_IO flag to avoid NUMA balancing

2016-11-17 Thread Boris Ostrovsky
Commit 9c17d96500f7 ("xen/gntdev: Grant maps should not be subject to
NUMA balancing") set VM_IO flag to prevent grant maps from being
subjected to NUMA balancing.

It was discovered recently that this flag causes get_user_pages() to
always fail with -EFAULT.

check_vma_flags
__get_user_pages
__get_user_pages_locked
__get_user_pages_unlocked
get_user_pages_fast
iov_iter_get_pages
dio_refill_pages
do_direct_IO
do_blockdev_direct_IO
do_blockdev_direct_IO
ext4_direct_IO_read
generic_file_read_iter
aio_run_iocb

(which can happen if guest's vdisk has direct-io-safe option).

To avoid this don't use vm_flags. Instead, use mempolicy that prohibits
page migration (i.e. clear MPOL_F_MOF|MPOL_F_MORON) and make sure we
don't consult task's policy (which may include those flags) if vma
doesn't have one.

Reported-by: Olaf Hering 
Signed-off-by: Boris Ostrovsky 
Cc: sta...@vger.kernel.org
---

Mis-spelled David's address.

Changes in v3:
* Don't use __mpol_dup() and get_task_policy() which are not exported
  for use by drivers. Add vm_operations_struct.get_policy().
* Copy to stable


 drivers/xen/gntdev.c |   27 ++-
 1 files changed, 26 insertions(+), 1 deletions(-)

diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c
index bb95212..632edd4 100644
--- a/drivers/xen/gntdev.c
+++ b/drivers/xen/gntdev.c
@@ -35,6 +35,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -433,10 +434,28 @@ static void gntdev_vma_close(struct vm_area_struct *vma)
return map->pages[(addr - map->pages_vm_start) >> PAGE_SHIFT];
 }
 
+#ifdef CONFIG_NUMA
+/*
+ * We have this op to make sure callers (such as vma_policy_mof()) don't
+ * check current task's policy which may include migrate flags (MPOL_F_MOF
+ * or MPOL_F_MORON)
+ */
+static struct mempolicy *gntdev_vma_get_policy(struct vm_area_struct *vma,
+  unsigned long addr)
+{
+   if (mpol_needs_cond_ref(vma->vm_policy))
+   mpol_get(vma->vm_policy);
+   return vma->vm_policy;
+}
+#endif
+
 static const struct vm_operations_struct gntdev_vmops = {
.open = gntdev_vma_open,
.close = gntdev_vma_close,
.find_special_page = gntdev_vma_find_special_page,
+#ifdef CONFIG_NUMA
+   .get_policy = gntdev_vma_get_policy,
+#endif
 };
 
 /* -- */
@@ -1007,7 +1026,13 @@ static int gntdev_mmap(struct file *flip, struct 
vm_area_struct *vma)
 
vma->vm_ops = _vmops;
 
-   vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP | VM_IO;
+   vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP;
+
+#ifdef CONFIG_NUMA
+   /* Prevent NUMA balancing */
+   if (vma->vm_policy)
+   vma->vm_policy->flags &= ~(MPOL_F_MOF | MPOL_F_MORON);
+#endif
 
if (use_ptemod)
vma->vm_flags |= VM_DONTCOPY;
-- 
1.7.1


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH v3] xen/gntdev: Use mempolicy instead of VM_IO flag to avoid NUMA balancing

2016-11-17 Thread Boris Ostrovsky
Commit 9c17d96500f7 ("xen/gntdev: Grant maps should not be subject to
NUMA balancing") set VM_IO flag to prevent grant maps from being
subjected to NUMA balancing.

It was discovered recently that this flag causes get_user_pages() to
always fail with -EFAULT.

check_vma_flags
__get_user_pages
__get_user_pages_locked
__get_user_pages_unlocked
get_user_pages_fast
iov_iter_get_pages
dio_refill_pages
do_direct_IO
do_blockdev_direct_IO
do_blockdev_direct_IO
ext4_direct_IO_read
generic_file_read_iter
aio_run_iocb

(which can happen if guest's vdisk has direct-io-safe option).

To avoid this don't use vm_flags. Instead, use mempolicy that prohibits
page migration (i.e. clear MPOL_F_MOF|MPOL_F_MORON) and make sure we
don't consult task's policy (which may include those flags) if vma
doesn't have one.

Reported-by: Olaf Hering 
Signed-off-by: Boris Ostrovsky 
Cc: sta...@vger.kernel.org
---
Changes in v3:
* Don't use __mpol_dup() and get_task_policy() which are not exported
  for use by drivers. Add vm_operations_struct.get_policy().
* Copy to stable


 drivers/xen/gntdev.c |   27 ++-
 1 files changed, 26 insertions(+), 1 deletions(-)

diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c
index bb95212..632edd4 100644
--- a/drivers/xen/gntdev.c
+++ b/drivers/xen/gntdev.c
@@ -35,6 +35,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -433,10 +434,28 @@ static void gntdev_vma_close(struct vm_area_struct *vma)
return map->pages[(addr - map->pages_vm_start) >> PAGE_SHIFT];
 }
 
+#ifdef CONFIG_NUMA
+/*
+ * We have this op to make sure callers (such as vma_policy_mof()) don't
+ * check current task's policy which may include migrate flags (MPOL_F_MOF
+ * or MPOL_F_MORON)
+ */
+static struct mempolicy *gntdev_vma_get_policy(struct vm_area_struct *vma,
+  unsigned long addr)
+{
+   if (mpol_needs_cond_ref(vma->vm_policy))
+   mpol_get(vma->vm_policy);
+   return vma->vm_policy;
+}
+#endif
+
 static const struct vm_operations_struct gntdev_vmops = {
.open = gntdev_vma_open,
.close = gntdev_vma_close,
.find_special_page = gntdev_vma_find_special_page,
+#ifdef CONFIG_NUMA
+   .get_policy = gntdev_vma_get_policy,
+#endif
 };
 
 /* -- */
@@ -1007,7 +1026,13 @@ static int gntdev_mmap(struct file *flip, struct 
vm_area_struct *vma)
 
vma->vm_ops = _vmops;
 
-   vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP | VM_IO;
+   vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP;
+
+#ifdef CONFIG_NUMA
+   /* Prevent NUMA balancing */
+   if (vma->vm_policy)
+   vma->vm_policy->flags &= ~(MPOL_F_MOF | MPOL_F_MORON);
+#endif
 
if (use_ptemod)
vma->vm_flags |= VM_DONTCOPY;
-- 
1.7.1


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [ovmf test] 102360: all pass - PUSHED

2016-11-17 Thread osstest service owner
flight 102360 ovmf real [real]
http://logs.test-lab.xenproject.org/osstest/logs/102360/

Perfect :-)
All tests in this flight passed as required
version targeted for testing:
 ovmf 5ea2bad0d9ab6a2465195badd323313553baa61b
baseline version:
 ovmf 2048ab4b3ec966183eb87d93d9cdab05fe9cc840

Last test of basis   102355  2016-11-17 15:14:16 Z0 days
Testing same since   102360  2016-11-17 18:18:11 Z0 days1 attempts


People who touched revisions under test:
  Michael Kinney 

jobs:
 build-amd64-xsm  pass
 build-i386-xsm   pass
 build-amd64  pass
 build-i386   pass
 build-amd64-libvirt  pass
 build-i386-libvirt   pass
 build-amd64-pvopspass
 build-i386-pvops pass
 test-amd64-amd64-xl-qemuu-ovmf-amd64 pass
 test-amd64-i386-xl-qemuu-ovmf-amd64  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 :

+ branch=ovmf
+ revision=5ea2bad0d9ab6a2465195badd323313553baa61b
+ . ./cri-lock-repos
++ . ./cri-common
+++ . ./cri-getconfig
+++ umask 002
+++ getrepos
 getconfig Repos
 perl -e '
use Osstest;
readglobalconfig();
print $c{"Repos"} or die $!;
'
+++ local repos=/home/osstest/repos
+++ '[' -z /home/osstest/repos ']'
+++ '[' '!' -d /home/osstest/repos ']'
+++ echo /home/osstest/repos
++ repos=/home/osstest/repos
++ repos_lock=/home/osstest/repos/lock
++ '[' x '!=' x/home/osstest/repos/lock ']'
++ OSSTEST_REPOS_LOCK_LOCKED=/home/osstest/repos/lock
++ exec with-lock-ex -w /home/osstest/repos/lock ./ap-push ovmf 
5ea2bad0d9ab6a2465195badd323313553baa61b
+ branch=ovmf
+ revision=5ea2bad0d9ab6a2465195badd323313553baa61b
+ . ./cri-lock-repos
++ . ./cri-common
+++ . ./cri-getconfig
+++ umask 002
+++ getrepos
 getconfig Repos
 perl -e '
use Osstest;
readglobalconfig();
print $c{"Repos"} or die $!;
'
+++ local repos=/home/osstest/repos
+++ '[' -z /home/osstest/repos ']'
+++ '[' '!' -d /home/osstest/repos ']'
+++ echo /home/osstest/repos
++ repos=/home/osstest/repos
++ repos_lock=/home/osstest/repos/lock
++ '[' x/home/osstest/repos/lock '!=' x/home/osstest/repos/lock ']'
+ . ./cri-common
++ . ./cri-getconfig
++ umask 002
+ select_xenbranch
+ case "$branch" in
+ tree=ovmf
+ xenbranch=xen-unstable
+ '[' xovmf = xlinux ']'
+ linuxbranch=
+ '[' x = x ']'
+ qemuubranch=qemu-upstream-unstable
+ select_prevxenbranch
++ ./cri-getprevxenbranch xen-unstable
+ prevxenbranch=xen-4.7-testing
+ '[' x5ea2bad0d9ab6a2465195badd323313553baa61b = x ']'
+ : tested/2.6.39.x
+ . ./ap-common
++ : osst...@xenbits.xen.org
+++ getconfig OsstestUpstream
+++ perl -e '
use Osstest;
readglobalconfig();
print $c{"OsstestUpstream"} or die $!;
'
++ :
++ : git://xenbits.xen.org/xen.git
++ : osst...@xenbits.xen.org:/home/xen/git/xen.git
++ : git://xenbits.xen.org/qemu-xen-traditional.git
++ : git://git.kernel.org
++ : git://git.kernel.org/pub/scm/linux/kernel/git
++ : git
++ : git://xenbits.xen.org/xtf.git
++ : osst...@xenbits.xen.org:/home/xen/git/xtf.git
++ : git://xenbits.xen.org/xtf.git
++ : git://xenbits.xen.org/libvirt.git
++ : osst...@xenbits.xen.org:/home/xen/git/libvirt.git
++ : git://xenbits.xen.org/libvirt.git
++ : git://xenbits.xen.org/osstest/rumprun.git
++ : git
++ : git://xenbits.xen.org/osstest/rumprun.git
++ : osst...@xenbits.xen.org:/home/xen/git/osstest/rumprun.git
++ : git://git.seabios.org/seabios.git
++ : osst...@xenbits.xen.org:/home/xen/git/osstest/seabios.git
++ : git://xenbits.xen.org/osstest/seabios.git
++ : https://github.com/tianocore/edk2.git
++ : osst...@xenbits.xen.org:/home/xen/git/osstest/ovmf.git
++ : git://xenbits.xen.org/osstest/ovmf.git
++ : git://xenbits.xen.org/osstest/linux-firmware.git
++ : osst...@xenbits.xen.org:/home/osstest/ext/linux-firmware.git
++ : git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
++ : 

Re: [Xen-devel] [RFC PATCH 5/9] x86/HVM/SVM: Add AVIC initialization code

2016-11-17 Thread Suravee Suthikulpanit



On 11/17/16 11:18, Konrad Rzeszutek Wilk wrote:

On Thu, Nov 17, 2016 at 10:05:58AM -0600, Suravee Suthikulpanit wrote:

Konrad,

Thanks for the review comments. Got one quick question below.

On 10/12/16 15:02, Konrad Rzeszutek Wilk wrote:

+int svm_avic_init_vmcb(struct vcpu *v)

+{
+paddr_t ma;
+u32 apic_id_reg;
+struct arch_svm_struct *s = >arch.hvm_svm;
+struct vmcb_struct *vmcb = s->vmcb;
+struct svm_domain *d = >domain->arch.hvm_domain.svm;
+struct svm_avic_phy_ait_entry entry;
+
+if ( !svm_avic )
+return 0;
+
+vmcb->avic_bk_pg_pa = page_to_maddr(s->avic_bk_pg) & AVIC_HPA_MASK;
+ma = d->avic_log_ait_mfn;
+vmcb->avic_log_apic_id = (ma << PAGE_SHIFT) & AVIC_HPA_MASK;
+ma = d->avic_phy_ait_mfn;
+vmcb->avic_phy_apic_id = (ma << PAGE_SHIFT) & AVIC_HPA_MASK;
+vmcb->avic_phy_apic_id |= AVIC_PHY_APIC_ID_MAX;
+
+dprintk(XENLOG_DEBUG, "SVM: %s: bpa=%#llx, lpa=%#llx, ppa=%#llx\n",

I think you can drop the 'SVM:' part. The __func__ gives enough details.


+   __func__, (unsigned long long)vmcb->avic_bk_pg_pa,
+   (unsigned long long) vmcb->avic_log_apic_id,
+   (unsigned long long) vmcb->avic_phy_apic_id);

Is this also part of the keyboard handler? Perhaps that information should
be presented there?


I'm not sure what you mean by keyboard handler. I assume you mean the
spacing for the indentation the front should align with above line?


Well I would ditch them. And if you really want them then make the
keyboard handler, aka svm_vmcb_dump function.


Thanks,
S.


Ahh.. the xl debug-keys stuff. Got it. No problem. I can ditch this.

S

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] Xen ARM small task (WAS: Re: [Xen Question])

2016-11-17 Thread Julien Grall

Hi Stefano,

On 17/11/2016 11:26, Stefano Stabellini wrote:

On Mon, 14 Nov 2016, Julien Grall wrote:

On 11/11/2016 13:55, Stefano Stabellini wrote:

On Fri, 11 Nov 2016, Julien Grall wrote:

On 11/11/2016 02:24, Stefano Stabellini wrote:

On Thu, 10 Nov 2016, Julien Grall wrote:

(CC Stefano and change the title)
On 10/11/16 12:13, casionwoo wrote:

I’m pleased about your reply and you have a lot of code to clean-up.

As you mentioned, It’s really huge to digest at once. Thank you for
understanding me.

And that’s why i need a small fix up and todo list.

I feel familiar with ARM and c language and there’s no specific area
yet.

I think that i can find interesting area with following up the
codes.

I’m looking forward to being stuck on Xen.

Then it would be easier for me to understand about Xen on ARM.

Please let me know the TODO and bug-fix lists.


Stefano, before giving a list of code clean-up, do you have any small
TODO
on
ARM in mind?


A simple task we talked about recently is to enable the vuart
(xen/arch/arm/vuart.c) for all guests. At the moment it is only emulated
for Dom0, but some guests, in particular BareMetal guests
(https://en.wikipedia.org/wiki/BareMetal), would benefit from it.

It would be best to introduce an option in libxl to explicitly
enable/disable the vuart for DomUs. Something like vuart=1 in the VM
config file.


The vuart has not been enabled for DomU because it the UART region may
clash
with the guest memory layout (which is static).

I don't think this option should be available until we allow the guest to
use
the same memory layout as the host (see e820_host parameter for x86).


Actually there is no reason for the vuart to use the same address as
the physical uart on the platform, is there?
In fact it doesn't even
have to prentend to be the same uart as the one on the board, right?
The vuart MMIO address could be completely configurable and independent
from the one of the physical uart.


There is no reason to use the same information as the physical UART.

However, the vuart requires quite a few information (e.g base address, offset
of different register... see vuart_info structure in include/xen/serial.h for
more details) in order to fully work.

IHMO this is a lot of works for the user to configure. I would much prefer to
see a PL011 emulated at a specific base address and let the user select
whether he wants a UART to debug or not.


So you envision the configuration of the MMIO base address to be done as
part of a new dynamic guest memory map?


For guest using dynamic memory map, I would expect to expose an 
uncompleted emulation of the physical UART (e.g it would only be 
possible to write) at the exact same address as on the host.


For guest using static memory map (i.e the current approach), I would 
envision to always emulate a PL011 (or at least giving this option) and 
not the physical UART.


This has a better fit with the support of SBSA/VM Spec compliant guest 
and still allow a user to do early debugging. Also, by always exposing 
the same kind of UART, the user does not have to know what is the 
underlying platform (e.g which UART is used).


Regards,

--
Julien Grall

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH v2 32/35] libxl/libxl_vnuma.c: used LOG*D functions

2016-11-17 Thread Cédric Bosdonnat
From: Cedric Bosdonnat 

Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat 
---
 tools/libxl/libxl_vnuma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libxl/libxl_vnuma.c b/tools/libxl/libxl_vnuma.c
index db22799..8ec2abb 100644
--- a/tools/libxl/libxl_vnuma.c
+++ b/tools/libxl/libxl_vnuma.c
@@ -283,7 +283,7 @@ int libxl__vnuma_build_vmemrange_hvm(libxl__gc *gc,
 /* Consider video ram belongs to vnode 0 */
 if (nid == 0) {
 if (p->memkb < b_info->video_memkb) {
-LOG(ERROR, "vnode 0 too small to contain video ram");
+LOGD(ERROR, domid, "vnode 0 too small to contain video ram");
 rc = ERROR_INVAL;
 goto out;
 }
-- 
2.10.1


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH v2 35/35] libxl/libxl_xshelp.c: used LOG*D functions

2016-11-17 Thread Cédric Bosdonnat
From: Cedric Bosdonnat 

Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat 
---
 tools/libxl/libxl_xshelp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/libxl/libxl_xshelp.c b/tools/libxl/libxl_xshelp.c
index b3bac6d..a50805f 100644
--- a/tools/libxl/libxl_xshelp.c
+++ b/tools/libxl/libxl_xshelp.c
@@ -146,7 +146,7 @@ char *libxl__xs_get_dompath(libxl__gc *gc, uint32_t domid)
 libxl_ctx *ctx = libxl__gc_owner(gc);
 char *s = xs_get_domain_path(ctx->xsh, domid);
 if (!s) {
-LOGE(ERROR, "failed to get dompath for %"PRIu32, domid);
+LOGED(ERROR, domid, "Failed to get dompath");
 return NULL;
 }
 libxl__ptr_add(gc, s);
@@ -189,7 +189,7 @@ char *libxl__xs_libxl_path(libxl__gc *gc, uint32_t domid)
 {
 char *s = GCSPRINTF("/libxl/%i", domid);
 if (!s)
-LOG(ERROR, "cannot allocate create paths");
+LOGD(ERROR, domid, "cannot allocate create paths");
 return s;
 }
 
-- 
2.10.1


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH v2 25/35] libxl/libxl_pci.c: used LOG*D functions

2016-11-17 Thread Cédric Bosdonnat
From: Cedric Bosdonnat 

Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat 
---
 tools/libxl/libxl_pci.c | 153 +---
 1 file changed, 79 insertions(+), 74 deletions(-)

diff --git a/tools/libxl/libxl_pci.c b/tools/libxl/libxl_pci.c
index 6f8f49c..3b707f3 100644
--- a/tools/libxl/libxl_pci.c
+++ b/tools/libxl/libxl_pci.c
@@ -86,7 +86,7 @@ int libxl__create_pci_backend(libxl__gc *gc, uint32_t domid,
 front = flexarray_make(gc, 16, 1);
 back = flexarray_make(gc, 16, 1);
 
-LOG(DEBUG, "Creating pci backend");
+LOGD(DEBUG, domid, "Creating pci backend");
 
 /* add pci device */
 libxl__device_from_pcidev(gc, domid, pcidev, );
@@ -141,7 +141,7 @@ static int libxl__device_pci_add_xenstore(libxl__gc *gc, 
uint32_t domid, libxl_d
 
 back = flexarray_make(gc, 16, 1);
 
-LOG(DEBUG, "Adding new pci device to xenstore");
+LOGD(DEBUG, domid, "Adding new pci device to xenstore");
 num = atoi(num_devs);
 libxl_create_pci_backend_device(gc, back, num, pcidev);
 flexarray_append_pair(back, "num_devs", GCSPRINTF("%d", num + 1));
@@ -207,7 +207,7 @@ static int libxl__device_pci_remove_xenstore(libxl__gc *gc, 
uint32_t domid, libx
 
 if (domtype == LIBXL_DOMAIN_TYPE_PV) {
 if (libxl__wait_for_backend(gc, be_path, GCSPRINTF("%d", 
XenbusStateConnected)) < 0) {
-LOG(DEBUG, "pci backend at %s is not ready", be_path);
+LOGD(DEBUG, domid, "pci backend at %s is not ready", be_path);
 return ERROR_FAIL;
 }
 }
@@ -222,7 +222,7 @@ static int libxl__device_pci_remove_xenstore(libxl__gc *gc, 
uint32_t domid, libx
 }
 }
 if (i == num) {
-LOG(ERROR, "Couldn't find the device on xenstore");
+LOGD(ERROR, domid, "Couldn't find the device on xenstore");
 return ERROR_INVAL;
 }
 
@@ -236,7 +236,7 @@ retry_transaction:
 
 if (domtype == LIBXL_DOMAIN_TYPE_PV) {
 if (libxl__wait_for_backend(gc, be_path, GCSPRINTF("%d", 
XenbusStateConnected)) < 0) {
-LOG(DEBUG, "pci backend at %s is not ready", be_path);
+LOGD(DEBUG, domid, "pci backend at %s is not ready", be_path);
 return ERROR_FAIL;
 }
 }
@@ -981,9 +981,9 @@ static int qemu_pci_add_xenstore(libxl__gc *gc, uint32_t 
domid,
 vdevfn = libxl__xs_read(gc, XBT_NULL, path);
 path = DEVICE_MODEL_XS_PATH(gc, dm_domid, domid, "/state");
 if ( rc < 0 )
-LOG(ERROR, "qemu refused to add device: %s", vdevfn);
+LOGD(ERROR, domid, "qemu refused to add device: %s", vdevfn);
 else if ( sscanf(vdevfn, "0x%x", >vdevfn) != 1 ) {
-LOG(ERROR, "wrong format for the vdevfn: '%s'", vdevfn);
+LOGD(ERROR, domid, "wrong format for the vdevfn: '%s'", vdevfn);
 rc = -1;
 }
 xs_write(ctx->xsh, XBT_NULL, path, state, strlen(state));
@@ -1000,6 +1000,8 @@ static int do_pci_add(libxl__gc *gc, uint32_t domid, 
libxl_device_pci *pcidev, i
 unsigned long long start, end, flags, size;
 int irq, i, rc, hvm = 0;
 uint32_t flag = XEN_DOMCTL_DEV_RDM_RELAXED;
+uint32_t domainid = domid;
+bool isstubdom = !libxl_is_stubdom(ctx, domid, );
 
 if (type == LIBXL_DOMAIN_TYPE_INVALID)
 return ERROR_FAIL;
@@ -1031,7 +1033,7 @@ static int do_pci_add(libxl__gc *gc, uint32_t domid, 
libxl_device_pci *pcidev, i
 irq = 0;
 
 if (f == NULL) {
-LOGE(ERROR, "Couldn't open %s", sysfs_path);
+LOGED(ERROR, domainid, "Couldn't open %s", sysfs_path);
 return ERROR_FAIL;
 }
 for (i = 0; i < PROC_PCI_NUM_RESOURCES; i++) {
@@ -1042,10 +1044,10 @@ static int do_pci_add(libxl__gc *gc, uint32_t domid, 
libxl_device_pci *pcidev, i
 if (flags & PCI_BAR_IO) {
 rc = xc_domain_ioport_permission(ctx->xch, domid, start, size, 
1);
 if (rc < 0) {
-LOGE(ERROR,
- "Error: xc_domain_ioport_permission error 
0x%llx/0x%llx",
- start,
- size);
+LOGED(ERROR, domainid,
+  "Error: xc_domain_ioport_permission error 
0x%llx/0x%llx",
+  start,
+  size);
 fclose(f);
 return ERROR_FAIL;
 }
@@ -1053,10 +1055,10 @@ static int do_pci_add(libxl__gc *gc, uint32_t domid, 
libxl_device_pci *pcidev, i
 rc = xc_domain_iomem_permission(ctx->xch, domid, 
start>>XC_PAGE_SHIFT,
 
(size+(XC_PAGE_SIZE-1))>>XC_PAGE_SHIFT, 1);
 if (rc < 0) {
-LOGE(ERROR,
- "Error: xc_domain_iomem_permission error 
0x%llx/0x%llx",
- start,
- size);
+LOGED(ERROR, domainid,
+

[Xen-devel] [PATCH v2 29/35] libxl/libxl_remus.c: used LOG*D functions

2016-11-17 Thread Cédric Bosdonnat
From: Cedric Bosdonnat 

Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat 
---
 tools/libxl/libxl_remus.c | 27 ++-
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/tools/libxl/libxl_remus.c b/tools/libxl/libxl_remus.c
index 54ec7de..29a4783 100644
--- a/tools/libxl/libxl_remus.c
+++ b/tools/libxl/libxl_remus.c
@@ -84,7 +84,8 @@ void libxl__remus_setup(libxl__egc *egc, libxl__remus_state 
*rs)
 
 if (libxl_defbool_val(info->netbuf)) {
 if (!libxl__netbuffer_enabled(gc)) {
-LOG(ERROR, "Remus: No support for network buffering");
+LOGD(ERROR, dss->domid,
+ "Remus: No support for network buffering");
 goto out;
 }
 cds->device_kind_flags |= (1 << LIBXL__DEVICE_KIND_VIF);
@@ -101,8 +102,8 @@ void libxl__remus_setup(libxl__egc *egc, libxl__remus_state 
*rs)
 rs->interval = info->interval;
 
 if (init_device_subkind(cds)) {
-LOG(ERROR, "Remus: failed to init device subkind for guest %u",
-dss->domid);
+LOGD(ERROR, dss->domid,
+ "Remus: failed to init device subkind");
 goto out;
 }
 
@@ -130,8 +131,7 @@ static void remus_setup_done(libxl__egc *egc,
 return;
 }
 
-LOG(ERROR, "Remus: failed to setup device for guest with domid %u, rc %d",
-dss->domid, rc);
+LOGD(ERROR, dss->domid, "Remus: failed to setup device, rc %d", rc);
 cds->callback = remus_setup_failed;
 libxl__checkpoint_devices_teardown(egc, cds);
 }
@@ -143,8 +143,8 @@ static void remus_setup_failed(libxl__egc *egc,
 STATE_AO_GC(dss->ao);
 
 if (rc)
-LOG(ERROR, "Remus: failed to teardown device after setup failed"
-" for guest with domid %u, rc %d", dss->domid, rc);
+LOGD(ERROR, dss->domid,
+ "Remus: failed to teardown device after setup failed, rc %d", rc);
 
 cleanup_device_subkind(cds);
 
@@ -165,8 +165,8 @@ void libxl__remus_teardown(libxl__egc *egc,
 
 EGC_GC;
 
-LOG(WARN, "Remus: Domain suspend terminated with rc %d,"
-" teardown Remus devices...", rc);
+LOGD(WARN, dss->domid, "Remus: Domain suspend terminated with rc %d,"
+ " teardown Remus devices...", rc);
 cds->callback = remus_teardown_done;
 libxl__checkpoint_devices_teardown(egc, cds);
 }
@@ -179,8 +179,8 @@ static void remus_teardown_done(libxl__egc *egc,
 STATE_AO_GC(dss->ao);
 
 if (rc)
-LOG(ERROR, "Remus: failed to teardown device for guest with domid %u,"
-" rc %d", dss->domid, rc);
+LOGD(ERROR, dss->domid, "Remus: failed to teardown device,"
+" rc %d", rc);
 
 cleanup_device_subkind(cds);
 
@@ -309,7 +309,8 @@ static void remus_checkpoint_stream_written(
 STATE_AO_GC(dss->ao);
 
 if (rc) {
-LOG(ERROR, "Failed to save device model. Terminating Remus..");
+LOGD(ERROR, dss->domid, "Failed to save device model."
+ " Terminating Remus..");
 goto out;
 }
 
@@ -331,7 +332,7 @@ static void remus_devices_commit_cb(libxl__egc *egc,
 STATE_AO_GC(dss->ao);
 
 if (rc) {
-LOG(ERROR, "Failed to do device commit op."
+LOGD(ERROR, dss->domid, "Failed to do device commit op."
 " Terminating Remus..");
 goto out;
 }
-- 
2.10.1


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH v2 31/35] libxl/libxl_stream_write.c: used LOG*D functions

2016-11-17 Thread Cédric Bosdonnat
From: Cedric Bosdonnat 

Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat 
---
 tools/libxl/libxl_stream_write.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/libxl/libxl_stream_write.c b/tools/libxl/libxl_stream_write.c
index aba554b..c96a6a2 100644
--- a/tools/libxl/libxl_stream_write.c
+++ b/tools/libxl/libxl_stream_write.c
@@ -267,7 +267,7 @@ void libxl__stream_write_start(libxl__egc *egc,
 
 default:
 rc = ERROR_FAIL;
-LOG(ERROR, "Unknown emulator for HVM domain");
+LOGD(ERROR, dss->domid, "Unknown emulator for HVM domain");
 goto err;
 }
 stream->emu_sub_hdr.index = 0;
@@ -349,7 +349,7 @@ void libxl__xc_domain_save_done(libxl__egc *egc, void 
*dss_void,
 goto err;
 
 if (retval) {
-LOGEV(ERROR, errnoval, "saving domain: %s",
+LOGEVD(ERROR, errnoval, dss->domid, "saving domain: %s",
   dss->dsps.guest_responded ?
   "domain responded to suspend request" :
   "domain did not respond to suspend request");
@@ -464,19 +464,19 @@ static void write_emulator_context_record(libxl__egc *egc,
 stream->emu_carefd = libxl__carefd_opened(CTX, readfd);
 if (readfd == -1) {
 rc = ERROR_FAIL;
-LOGE(ERROR, "unable to open %s", filename);
+LOGED(ERROR, dss->domid, "unable to open %s", filename);
 goto err;
 }
 
 if (fstat(readfd, )) {
 rc = ERROR_FAIL;
-LOGE(ERROR, "unable to fstat %s", filename);
+LOGED(ERROR, dss->domid, "unable to fstat %s", filename);
 goto err;
 }
 
 if (!S_ISREG(st.st_mode)) {
 rc = ERROR_FAIL;
-LOG(ERROR, "%s is not a plain file!", filename);
+LOGD(ERROR, dss->domid, "%s is not a plain file!", filename);
 goto err;
 }
 
-- 
2.10.1


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH v2 16/35] libxl/libxl_dom_save.c: used LOG*D functions

2016-11-17 Thread Cédric Bosdonnat
From: Cedric Bosdonnat 

Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat 
---
 tools/libxl/libxl_dom_save.c | 29 +++--
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/tools/libxl/libxl_dom_save.c b/tools/libxl/libxl_dom_save.c
index 579039f..77fe30e 100644
--- a/tools/libxl/libxl_dom_save.c
+++ b/tools/libxl/libxl_dom_save.c
@@ -90,9 +90,9 @@ static void 
domain_suspend_switch_qemu_xen_traditional_logdirty
 if (rc) goto out;
 
 if (!got_ret || strcmp(got, got_ret)) {
-LOG(ERROR,"controlling logdirty: qemu was already sent"
-" command `%s' (xenstore path `%s') but result is `%s'",
-got, lds->cmd_path, got_ret ? got_ret : "");
+LOGD(ERROR, domid, "controlling logdirty: qemu was already 
sent"
+ " command `%s' (xenstore path `%s') but result is `%s'",
+ got, lds->cmd_path, got_ret ? got_ret : "");
 rc = ERROR_FAIL;
 goto out;
 }
@@ -115,7 +115,7 @@ static void 
domain_suspend_switch_qemu_xen_traditional_logdirty
 return;
 
  out:
-LOG(ERROR,"logdirty switch failed (rc=%d), abandoning suspend",rc);
+LOGD(ERROR, domid, "logdirty switch failed (rc=%d), abandoning 
suspend",rc);
 libxl__xs_transaction_abort(gc, );
 switch_logdirty_done(egc,lds,rc);
 }
@@ -129,7 +129,8 @@ static void domain_suspend_switch_qemu_xen_logdirty
 
 rc = libxl__qmp_set_global_dirty_log(gc, domid, enable);
 if (rc)
-LOG(ERROR,"logdirty switch failed (rc=%d), abandoning suspend",rc);
+LOGD(ERROR, domid,
+ "logdirty switch failed (rc=%d), abandoning suspend",rc);
 
 lds->callback(egc, lds, rc);
 }
@@ -179,8 +180,8 @@ void libxl__domain_common_switch_qemu_logdirty(libxl__egc 
*egc,
 lds->callback(egc, lds, 0);
 break;
 default:
-LOG(ERROR,"logdirty switch failed"
-", no valid device model version found, abandoning suspend");
+LOGD(ERROR, domid, "logdirty switch failed"
+ ", no valid device model version found, abandoning suspend");
 lds->callback(egc, lds, ERROR_FAIL);
 }
 }
@@ -346,8 +347,8 @@ void libxl__domain_save(libxl__egc *egc, 
libxl__domain_save_state *dss)
 libxl__domain_suspend_state *dsps = >dsps;
 
 if (dss->checkpointed_stream != LIBXL_CHECKPOINTED_STREAM_NONE && !r_info) 
{
-LOG(ERROR, "Migration stream is checkpointed, but there's no "
-   "checkpoint info!");
+LOGD(ERROR, domid, "Migration stream is checkpointed, but there's no "
+   "checkpoint info!");
 rc = ERROR_INVAL;
 goto out;
 }
@@ -387,7 +388,7 @@ void libxl__domain_save(libxl__egc *egc, 
libxl__domain_save_state *dss)
 ret = xc_domain_getvnuma(CTX->xch, domid, _vnodes, _vmemranges,
  _vcpus, NULL, NULL, NULL);
 if (ret != -1 || errno != EOPNOTSUPP) {
-LOG(ERROR, "Cannot save a guest with vNUMA configured");
+LOGD(ERROR, domid, "Cannot save a guest with vNUMA configured");
 rc = ERROR_FAIL;
 goto out;
 }
@@ -491,17 +492,17 @@ int 
libxl__restore_emulator_xenstore_data(libxl__domain_create_state *dcs,
 /* Sanitise 'key'. */
 if (!next) {
 rc = ERROR_FAIL;
-LOG(ERROR, "Key in xenstore data not NUL terminated");
+LOGD(ERROR, domid, "Key in xenstore data not NUL terminated");
 goto out;
 }
 if (key[0] == '\0') {
 rc = ERROR_FAIL;
-LOG(ERROR, "empty key found in xenstore data");
+LOGD(ERROR, domid, "empty key found in xenstore data");
 goto out;
 }
 if (key[0] == '/') {
 rc = ERROR_FAIL;
-LOG(ERROR, "Key in xenstore data not relative");
+LOGD(ERROR, domid, "Key in xenstore data not relative");
 goto out;
 }
 
@@ -511,7 +512,7 @@ int 
libxl__restore_emulator_xenstore_data(libxl__domain_create_state *dcs,
 /* Sanitise 'val'. */
 if (!next) {
 rc = ERROR_FAIL;
-LOG(ERROR, "Val in xenstore data not NUL terminated");
+LOGD(ERROR, domid, "Val in xenstore data not NUL terminated");
 goto out;
 }
 
-- 
2.10.1


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH v2 34/35] libxl/libxl_x86.c: used LOG*D functions

2016-11-17 Thread Cédric Bosdonnat
From: Cedric Bosdonnat 

Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat 
---
 tools/libxl/libxl_x86.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/libxl/libxl_x86.c b/tools/libxl/libxl_x86.c
index e1844c8..5da7504 100644
--- a/tools/libxl/libxl_x86.c
+++ b/tools/libxl/libxl_x86.c
@@ -327,7 +327,7 @@ int libxl__arch_domain_create(libxl__gc *gc, 
libxl_domain_config *d_config,
 tm = localtime_r(, );
 
 if (!tm) {
-LOGE(ERROR, "Failed to call localtime_r");
+LOGED(ERROR, domid, "Failed to call localtime_r");
 ret = ERROR_FAIL;
 goto out;
 }
@@ -350,7 +350,7 @@ int libxl__arch_domain_create(libxl__gc *gc, 
libxl_domain_config *d_config,
 libxl_defbool_val(d_config->b_info.u.pv.e820_host)) {
 ret = libxl__e820_alloc(gc, domid, d_config);
 if (ret) {
-LOGE(ERROR, "Failed while collecting E820 with: %d (errno:%d)\n",
+LOGED(ERROR, domid, "Failed while collecting E820 with: %d 
(errno:%d)\n",
  ret, errno);
 }
 }
@@ -532,7 +532,7 @@ int libxl__arch_domain_construct_memmap(libxl__gc *gc,
 e820_entries++;
 
 if (e820_entries >= E820MAX) {
-LOG(ERROR, "Ooops! Too many entries in the memory map!");
+LOGD(ERROR, domid, "Ooops! Too many entries in the memory map!");
 rc = ERROR_INVAL;
 goto out;
 }
-- 
2.10.1


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH v2 33/35] libxl/libxl_vtpm.c: used LOG*D functions

2016-11-17 Thread Cédric Bosdonnat
From: Cedric Bosdonnat 

Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat 
---
 tools/libxl/libxl_vtpm.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/libxl/libxl_vtpm.c b/tools/libxl/libxl_vtpm.c
index 8588569..9ee8cce 100644
--- a/tools/libxl/libxl_vtpm.c
+++ b/tools/libxl/libxl_vtpm.c
@@ -129,7 +129,7 @@ static void libxl__device_vtpm_add(libxl__egc *egc, 
uint32_t domid,
 rc = libxl__device_exists(gc, t, device);
 if (rc < 0) goto out;
 if (rc == 1) {  /* already exists in xenstore */
-LOG(ERROR, "device already exists in xenstore");
+LOGD(ERROR, domid, "device already exists in xenstore");
 aodev->action = LIBXL__DEVICE_ACTION_ADD; /* for error message */
 rc = ERROR_DEVICE_EXISTS;
 goto out;
@@ -200,7 +200,7 @@ libxl_device_vtpm *libxl_device_vtpm_list(libxl_ctx *ctx, 
uint32_t domid, int *n
   tmp = libxl__xs_read(gc, XBT_NULL, GCSPRINTF("%s/uuid", libxl_path));
   if (tmp) {
   if(libxl_uuid_from_string(&(vtpm->uuid), tmp)) {
-  LOG(ERROR, "%s/uuid is a malformed uuid?? (%s) Probably a 
bug!!\n", be_path, tmp);
+  LOGD(ERROR, domid, "%s/uuid is a malformed uuid?? (%s) 
Probably a bug!!\n", be_path, tmp);
   free(vtpms);
   return NULL;
   }
@@ -259,11 +259,11 @@ int libxl_device_vtpm_getinfo(libxl_ctx *ctx,
 val = libxl__xs_read(gc, XBT_NULL,
   GCSPRINTF("%s/uuid", libxl_path));
 if(val == NULL) {
-   LOG(ERROR, "%s/uuid does not exist!", vtpminfo->backend);
+   LOGD(ERROR, domid, "%s/uuid does not exist!", vtpminfo->backend);
goto err;
 }
 if(libxl_uuid_from_string(&(vtpminfo->uuid), val)) {
-   LOG(ERROR,
+   LOGD(ERROR, domid,
  "%s/uuid is a malformed uuid?? (%s) Probably a bug!\n",
  vtpminfo->backend, val);
goto err;
-- 
2.10.1


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH v2 27/35] libxl/libxl_pvusb.c: used LOG*D functions

2016-11-17 Thread Cédric Bosdonnat
From: Cedric Bosdonnat 

Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat 
---
 tools/libxl/libxl_usb.c | 57 ++---
 1 file changed, 30 insertions(+), 27 deletions(-)

diff --git a/tools/libxl/libxl_usb.c b/tools/libxl/libxl_usb.c
index 76260b1..ea7a2ab 100644
--- a/tools/libxl/libxl_usb.c
+++ b/tools/libxl/libxl_usb.c
@@ -254,7 +254,7 @@ static int libxl__device_usbctrl_add_xenstore(libxl__gc 
*gc, uint32_t domid,
 if (usbctrl->type == LIBXL_USBCTRL_TYPE_QUSB) {
 if (!libxl__query_qemu_backend(gc, domid, usbctrl->backend_domid,
"qusb", false)) {
-LOG(ERROR, "backend type not supported by device model");
+LOGD(ERROR, domid, "backend type not supported by device 
model");
 rc = ERROR_FAIL;
 goto out;
 }
@@ -269,7 +269,7 @@ static int libxl__device_usbctrl_add_xenstore(libxl__gc 
*gc, uint32_t domid,
 if (rc < 0) goto out;
 if (rc == 1) {
 /* already exists in xenstore */
-LOG(ERROR, "device already exists in xenstore");
+LOGD(ERROR, domid, "device already exists in xenstore");
 rc = ERROR_DEVICE_EXISTS;
 goto out;
 }
@@ -536,7 +536,7 @@ void libxl__initiate_device_usbctrl_remove(libxl__egc *egc,
 for (i = 0; i < num_usbdev; i++) {
 rc = libxl__device_usbdev_remove(gc, domid, [i]);
 if (rc) {
-LOG(ERROR, "libxl__device_usbdev_remove failed: controller %d, "
+LOGD(ERROR, domid, "libxl__device_usbdev_remove failed: controller 
%d, "
 "port %d", usbdevs[i].ctrl, usbdevs[i].port);
 goto out;
 }
@@ -633,7 +633,7 @@ libxl_device_usbctrl_list(libxl_ctx *ctx, uint32_t domid, 
int *num)
 return usbctrls;
 
 out:
-LOG(ERROR, "Unable to list USB Controllers");
+LOGD(ERROR, domid, "Unable to list USB Controllers");
 libxl_device_usbctrl_list_free(usbctrls, *num);
 GC_FREE;
 *num = 0;
@@ -1067,7 +1067,8 @@ static int libxl__device_usbdev_setdefault(libxl__gc *gc,
 
 if (usbdev->ctrl == -1) {
 if (usbdev->port) {
-LOG(ERROR, "USB controller must be specified if you specify port");
+LOGD(ERROR, domid,
+ "USB controller must be specified if you specify port");
 return ERROR_INVAL;
 }
 
@@ -1119,7 +1120,7 @@ static int libxl__device_usbdev_setdefault(libxl__gc *gc,
 if (rc) goto out;
 
 if (tmp && strcmp(tmp, "")) {
-LOG(ERROR, "The controller port isn't available");
+LOGD(ERROR, domid, "The controller port isn't available");
 rc = ERROR_FAIL;
 goto out;
 }
@@ -1146,7 +1147,7 @@ static int libxl__device_usbdev_setdefault(libxl__gc *gc,
 }
 
 if (!usbdev->port) {
-LOG(ERROR, "No available port under specified controller");
+LOGD(ERROR, domid, "No available port under specified 
controller");
 rc = ERROR_FAIL;
 goto out;
 }
@@ -1183,7 +1184,7 @@ static int libxl__device_usbdev_add_xenstore(libxl__gc 
*gc, uint32_t domid,
 busid = usbdev_busaddr_to_busid(gc, usbdev->u.hostdev.hostbus,
 usbdev->u.hostdev.hostaddr);
 if (!busid) {
-LOG(DEBUG, "Fail to get busid of usb device");
+LOGD(DEBUG, domid, "Fail to get busid of usb device");
 rc = ERROR_FAIL;
 goto out;
 }
@@ -1217,7 +1218,7 @@ static int libxl__device_usbdev_add_xenstore(libxl__gc 
*gc, uint32_t domid,
 be_path = vusb_get_port_path(gc, domid, type, usbdev->ctrl,
  usbdev->port);
 
-LOG(DEBUG, "Adding usb device %s to xenstore: controller %d, port %d",
+LOGD(DEBUG, domid, "Adding usb device %s to xenstore: controller %d, 
port %d",
 busid, usbdev->ctrl, usbdev->port);
 
 rc = libxl__xs_write_checked(gc, t, be_path, busid);
@@ -1245,8 +1246,8 @@ static int libxl__device_usbdev_remove_xenstore(libxl__gc 
*gc, uint32_t domid,
 
 be_path = vusb_get_port_path(gc, domid, type, usbdev->ctrl, usbdev->port);
 
-LOG(DEBUG, "Removing usb device from xenstore: controller %d, port %d",
-usbdev->ctrl, usbdev->port);
+LOGD(DEBUG, domid, "Removing usb device from xenstore: controller %d, port 
%d",
+ usbdev->ctrl, usbdev->port);
 
 return libxl__xs_write_checked(gc, XBT_NULL, be_path, "");
 }
@@ -1634,7 +1635,7 @@ static int do_usbdev_add(libxl__gc *gc, uint32_t domid,
 }
 break;
 default:
-LOG(ERROR, "Unsupported usb controller type");
+LOGD(ERROR, domid, "Unsupported usb controller type");
 rc = ERROR_FAIL;
 goto out;

[Xen-devel] [PATCH v2 28/35] libxl/libxl_qmp.c: used LOG*D functions

2016-11-17 Thread Cédric Bosdonnat
From: Cedric Bosdonnat 

Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat 
---
 tools/libxl/libxl_qmp.c | 56 -
 1 file changed, 28 insertions(+), 28 deletions(-)

diff --git a/tools/libxl/libxl_qmp.c b/tools/libxl/libxl_qmp.c
index f8addf9..ad22ad4 100644
--- a/tools/libxl/libxl_qmp.c
+++ b/tools/libxl/libxl_qmp.c
@@ -30,10 +30,10 @@
 /* #define DEBUG_RECEIVED */
 
 #ifdef DEBUG_RECEIVED
-#  define DEBUG_REPORT_RECEIVED(buf, len) \
-LOG(DEBUG, "received: '%.*s'", len, buf)
+#  define DEBUG_REPORT_RECEIVED(dom, buf, len) \
+LOGD(DEBUG, dom, "received: '%.*s'", len, buf)
 #else
-#  define DEBUG_REPORT_RECEIVED(buf, len) ((void)0)
+#  define DEBUG_REPORT_RECEIVED(dom, buf, len) ((void)0)
 #endif
 
 /*
@@ -137,15 +137,15 @@ static int 
register_serials_chardev_callback(libxl__qmp_handler *qmp,
 s += strlen("serial");
 port_number = strtol(s, , 10);
 if (*s == 0 || *endptr != 0) {
-LIBXL__LOG(qmp->ctx, LIBXL__LOG_ERROR,
-   "Invalid serial port number: %s", s);
+LIBXL__LOGD(qmp->ctx, LIBXL__LOG_ERROR, qmp->domid,
+"Invalid serial port number: %s", s);
 return -1;
 }
 ret = store_serial_port_info(qmp, chardev, port_number);
 if (ret) {
-LIBXL__LOG_ERRNO(qmp->ctx, LIBXL__LOG_ERROR,
- "Failed to store serial port information"
- " in xenstore");
+LIBXL__LOGD_ERRNO(qmp->ctx, LIBXL__LOG_ERROR, qmp->domid,
+  "Failed to store serial port information"
+  " in xenstore");
 return ret;
 }
 }
@@ -190,7 +190,7 @@ static int qmp_register_vnc_callback(libxl__qmp_handler 
*qmp,
 port = libxl__json_object_get_string(obj);
 
 if (!addr || !port) {
-LOG(ERROR, "Failed to retreive VNC connect information.");
+LOGD(ERROR, qmp->domid, "Failed to retreive VNC connect information.");
 goto out;
 }
 
@@ -283,8 +283,8 @@ static void qmp_handle_error_response(libxl__gc *gc, 
libxl__qmp_handler *qmp,
 free(pp);
 }
 
-LOG(ERROR, "received an error message from QMP server: %s",
-libxl__json_object_get_string(resp));
+LOGD(ERROR, qmp->domid, "received an error message from QMP server: %s",
+ libxl__json_object_get_string(resp));
 }
 
 static int qmp_handle_response(libxl__gc *gc, libxl__qmp_handler *qmp,
@@ -293,7 +293,7 @@ static int qmp_handle_response(libxl__gc *gc, 
libxl__qmp_handler *qmp,
 libxl__qmp_message_type type = LIBXL__QMP_MESSAGE_TYPE_INVALID;
 
 type = qmp_response_type(qmp, resp);
-LOG(DEBUG, "message type: %s", libxl__qmp_message_type_to_string(type));
+LOGD(DEBUG, qmp->domid, "message type: %s", 
libxl__qmp_message_type_to_string(type));
 
 switch (type) {
 case LIBXL__QMP_MESSAGE_TYPE_QMP:
@@ -342,7 +342,7 @@ static libxl__qmp_handler *qmp_init_handler(libxl__gc *gc, 
uint32_t domid)
 
 qmp = calloc(1, sizeof (libxl__qmp_handler));
 if (qmp == NULL) {
-LOGE(ERROR, "Failed to allocate qmp_handler");
+LOGED(ERROR, domid, "Failed to allocate qmp_handler");
 return NULL;
 }
 qmp->ctx = CTX;
@@ -440,26 +440,26 @@ static int qmp_next(libxl__gc *gc, libxl__qmp_handler 
*qmp)
 
 ret = select(qmp->qmp_fd + 1, , NULL, NULL, );
 if (ret == 0) {
-LOG(ERROR, "timeout");
+LOGD(ERROR, qmp->domid, "timeout");
 return -1;
 } else if (ret < 0) {
 if (errno == EINTR)
 continue;
-LOGE(ERROR, "Select error");
+LOGED(ERROR, qmp->domid, "Select error");
 return -1;
 }
 
 rd = read(qmp->qmp_fd, qmp->buffer, QMP_RECEIVE_BUFFER_SIZE);
 if (rd == 0) {
-LOG(ERROR, "Unexpected end of socket");
+LOGD(ERROR, qmp->domid, "Unexpected end of socket");
 return -1;
 } else if (rd < 0) {
-LOGE(ERROR, "Socket read error");
+LOGED(ERROR, qmp->domid, "Socket read error");
 return rd;
 }
 qmp->buffer[rd] = '\0';
 
-DEBUG_REPORT_RECEIVED(qmp->buffer, rd);
+DEBUG_REPORT_RECEIVED(qmp->domid, qmp->buffer, rd);
 
 do {
 char *end = NULL;
@@ -490,7 +490,7 @@ static int qmp_next(libxl__gc *gc, libxl__qmp_handler *qmp)
 if (o) {
 rc = qmp_handle_response(gc, qmp, o);
 } else {
-LOG(ERROR, "Parse error of : %s", s);
+LOGD(ERROR, qmp->domid, "Parse error of : %s", s);
 return -1;
 }
 
@@ -536,13 +536,13 @@ static char 

[Xen-devel] [PATCH v2 26/35] libxl/libxl_psr.c: used LOG*D functions

2016-11-17 Thread Cédric Bosdonnat
From: Cedric Bosdonnat 

Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat 
---
 tools/libxl/libxl_psr.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/libxl/libxl_psr.c b/tools/libxl/libxl_psr.c
index 786183c..ec5c79d 100644
--- a/tools/libxl/libxl_psr.c
+++ b/tools/libxl/libxl_psr.c
@@ -241,15 +241,15 @@ int libxl_psr_cmt_get_sample(libxl_ctx *ctx,
 
 rc = xc_psr_cmt_get_domain_rmid(ctx->xch, domid, );
 if (rc < 0 || rmid == 0) {
-LOGE(ERROR, "fail to get the domain rmid, "
-"or domain is not attached with platform QoS monitoring service");
+LOGED(ERROR, domid, "fail to get the domain rmid, "
+  "or domain is not attached with platform QoS monitoring 
service");
 rc = ERROR_FAIL;
 goto out;
 }
 
 cpu = libxl__pick_socket_cpu(gc, scope);
 if (cpu < 0) {
-LOGE(ERROR, "failed to get socket cpu");
+LOGED(ERROR, domid, "failed to get socket cpu");
 rc = ERROR_FAIL;
 goto out;
 }
@@ -257,14 +257,14 @@ int libxl_psr_cmt_get_sample(libxl_ctx *ctx,
 rc = xc_psr_cmt_get_data(ctx->xch, rmid, cpu, type - 1,
  _data, tsc_r);
 if (rc < 0) {
-LOGE(ERROR, "failed to get monitoring data");
+LOGED(ERROR, domid, "failed to get monitoring data");
 rc = ERROR_FAIL;
 goto out;
 }
 
 rc = xc_psr_cmt_get_l3_upscaling_factor(ctx->xch, _factor);
 if (rc < 0) {
-LOGE(ERROR, "failed to get L3 upscaling factor");
+LOGED(ERROR, domid, "failed to get L3 upscaling factor");
 rc = ERROR_FAIL;
 goto out;
 }
@@ -311,7 +311,7 @@ int libxl_psr_cat_set_cbm(libxl_ctx *ctx, uint32_t domid,
 
 rc = libxl__count_physical_sockets(gc, _sockets);
 if (rc) {
-LOGE(ERROR, "failed to get system socket count");
+LOGED(ERROR, domid, "failed to get system socket count");
 goto out;
 }
 
-- 
2.10.1


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH v2 15/35] libxl/libxl_dm.c: used LOG*D functions

2016-11-17 Thread Cédric Bosdonnat
From: Cedric Bosdonnat 

Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat 
---
 tools/libxl/libxl_dm.c | 111 ++---
 1 file changed, 59 insertions(+), 52 deletions(-)

diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index ad366a8..be928ad 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -455,7 +455,7 @@ static int libxl__build_device_model_args_old(libxl__gc *gc,
 if (vnc->listen) {
 if (strchr(vnc->listen, ':') != NULL) {
 if (vnc->display) {
-LOG(ERROR, "vncdisplay set, vnclisten contains display");
+LOGD(ERROR, domid, "vncdisplay set, vnclisten contains 
display");
 return ERROR_INVAL;
 }
 vncarg = vnc->listen;
@@ -502,15 +502,15 @@ static int libxl__build_device_model_args_old(libxl__gc 
*gc,
 char *s;
 
 if (b_info->kernel) {
-LOG(ERROR, "HVM direct kernel boot is not supported by "
-"qemu-xen-traditional");
+LOGD(ERROR, domid, "HVM direct kernel boot is not supported by "
+ "qemu-xen-traditional");
 return ERROR_INVAL;
 }
 
 if (b_info->u.hvm.serial || b_info->u.hvm.serial_list) {
 if ( b_info->u.hvm.serial && b_info->u.hvm.serial_list )
 {
-LOG(ERROR, "Both serial and serial_list set");
+LOGD(ERROR, domid, "Both serial and serial_list set");
 return ERROR_INVAL;
 }
 if (b_info->u.hvm.serial) {
@@ -550,7 +550,7 @@ static int libxl__build_device_model_args_old(libxl__gc *gc,
 case LIBXL_VGA_INTERFACE_TYPE_QXL:
 break;
 default:
-LOG(ERROR, "Invalid emulated video card specified");
+LOGD(ERROR, domid, "Invalid emulated video card specified");
 return ERROR_INVAL;
 }
 
@@ -562,7 +562,7 @@ static int libxl__build_device_model_args_old(libxl__gc *gc,
 || b_info->u.hvm.usbdevice_list) {
 if ( b_info->u.hvm.usbdevice && b_info->u.hvm.usbdevice_list )
 {
-LOG(ERROR, "Both usbdevice and usbdevice_list set");
+LOGD(ERROR, domid, "Both usbdevice and usbdevice_list set");
 return ERROR_INVAL;
 }
 flexarray_append(dm_args, "-usb");
@@ -632,7 +632,7 @@ static int libxl__build_device_model_args_old(libxl__gc *gc,
 flexarray_append(dm_args, "-gfx_passthru");
 break;
 default:
-LOG(ERROR, "unsupported gfx_passthru_kind.");
+LOGD(ERROR, domid, "unsupported gfx_passthru_kind.");
 return ERROR_INVAL;
 }
 }
@@ -970,7 +970,7 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
 break;
 default:
 /* We've forgotten to add the clause */
-LOG(ERROR, "%s: unknown channel connection %d",
+LOGD(ERROR, guest_domid, "%s: unknown channel connection %d",
 __func__, connection);
 return ERROR_INVAL;
 }
@@ -1014,7 +1014,8 @@ static int libxl__build_device_model_args_new(libxl__gc 
*gc,
 if (vnc->listen) {
 if (strchr(vnc->listen, ':') != NULL) {
 if (vnc->display) {
-LOG(ERROR, "vncdisplay set, vnclisten contains display");
+LOGD(ERROR, guest_domid,
+ "vncdisplay set, vnclisten contains display");
 return ERROR_INVAL;
 }
 vncarg = vnc->listen;
@@ -1075,7 +1076,7 @@ static int libxl__build_device_model_args_new(libxl__gc 
*gc,
 if (b_info->u.hvm.serial || b_info->u.hvm.serial_list) {
 if ( b_info->u.hvm.serial && b_info->u.hvm.serial_list )
 {
-LOG(ERROR, "Both serial and serial_list set");
+LOGD(ERROR, guest_domid, "Both serial and serial_list set");
 return ERROR_INVAL;
 }
 if (b_info->u.hvm.serial) {
@@ -1133,7 +1134,7 @@ static int libxl__build_device_model_args_new(libxl__gc 
*gc,
 (b_info->video_memkb/2/1024), (b_info->video_memkb/2/1024) ) );
 break;
 default:
-LOG(ERROR, "Invalid emulated video card specified");
+LOGD(ERROR, guest_domid, "Invalid emulated video card specified");
 return ERROR_INVAL;
 }
 
@@ -1146,7 +1147,7 @@ static int libxl__build_device_model_args_new(libxl__gc 
*gc,
 || b_info->u.hvm.usbdevice_list) {
 if ( b_info->u.hvm.usbdevice && b_info->u.hvm.usbdevice_list )
 {
-LOG(ERROR, "Both usbdevice and usbdevice_list set");
+ 

[Xen-devel] [PATCH v2 04/35] libxl.c: switch to LOG*D use

2016-11-17 Thread Cédric Bosdonnat
From: Cedric Bosdonnat 

Use LOG*D functions to output the domain ID in logs as much as
possible. This will help consumer code sorting the logs by
domain.

This commit includes all LOG* to LOG*D changes where the domain
ID is not just a domid variable.

We want the domain ID provided to the LOG*D functions to be the
one of the publicly known domain, not a stubdom one.

Signed-off-by: Cédric Bosdonnat 
---
 tools/libxl/libxl.c | 79 +++--
 1 file changed, 41 insertions(+), 38 deletions(-)

diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index 0ee7d9f..6fd4fe1 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -1125,7 +1125,7 @@ static void domain_death_occurred(libxl__egc *egc,
 EGC_GC;
 libxl_evgen_domain_death *const evg = *evg_upd;
 
-LOG(DEBUG, "%s", why);
+LOGD(DEBUG, evg->domid, "%s", why);
 
 libxl_evgen_domain_death *evg_next = LIBXL_TAILQ_NEXT(evg, entry);
 *evg_upd = evg_next;
@@ -1165,10 +1165,10 @@ static void domain_death_xswatch_callback(libxl__egc 
*egc, libxl__ev_xswatch *w,
 }
 gotend = [rc];
 
-LOG(DEBUG, "[evg=%p:%"PRIu32"] nentries=%d rc=%d %ld..%ld",
-evg, evg->domid, nentries, rc,
-rc>0 ? (long)domaininfos[0].domain : 0,
-rc>0 ? (long)domaininfos[rc-1].domain : 0);
+LOGD(DEBUG, evg->domid, "[evg=%p] nentries=%d rc=%d %ld..%ld",
+ evg, nentries, rc,
+ rc>0 ? (long)domaininfos[0].domain : 0,
+ rc>0 ? (long)domaininfos[rc-1].domain : 0);
 
 for (;;) {
 if (!evg) {
@@ -1176,10 +1176,10 @@ static void domain_death_xswatch_callback(libxl__egc 
*egc, libxl__ev_xswatch *w,
 goto all_reported;
 }
 
-LOG(DEBUG, "[evg=%p:%"PRIu32"]"
-"   got=domaininfos[%d] got->domain=%ld",
-evg, evg->domid, (int)(got - domaininfos),
-got < gotend ? (long)got->domain : -1L);
+LOGD(DEBUG, evg->domid, "[evg=%p]"
+ "   got=domaininfos[%d] got->domain=%ld",
+ evg, (int)(got - domaininfos),
+ got < gotend ? (long)got->domain : -1L);
 
 if (!rc) {
 domain_death_occurred(egc, , "empty list");
@@ -1204,8 +1204,8 @@ static void domain_death_xswatch_callback(libxl__egc 
*egc, libxl__ev_xswatch *w,
 }
 
 assert(evg->domid == got->domain);
-LOG(DEBUG, " exists shutdown_reported=%d"" dominf.flags=%x",
-evg->shutdown_reported, got->flags);
+LOGD(DEBUG, evg->domid, "Exists shutdown_reported=%d"" 
dominf.flags=%x",
+ evg->shutdown_reported, got->flags);
 
 if (got->flags & XEN_DOMINF_dying) {
 domain_death_occurred(egc, , "dying");
@@ -1455,7 +1455,7 @@ static void domain_destroy_cb(libxl__egc *egc, 
libxl__domain_destroy_state *dds,
 STATE_AO_GC(dds->ao);
 
 if (rc)
-LOG(ERROR, "destruction of domain %u failed", dds->domid);
+LOGD(ERROR, dds->domid, "Destruction of domain failed");
 
 libxl__ao_complete(egc, ao, rc);
 }
@@ -1504,7 +1504,8 @@ static void stubdom_destroy_callback(libxl__egc *egc,
 const char *savefile;
 
 if (rc) {
-LOG(ERROR, "unable to destroy stubdom with domid %u", dis->domid);
+LOGD(ERROR, dds->domain.domid, "Unable to destroy stubdom with domid 
%u",
+ dis->domid);
 dds->rc = rc;
 }
 
@@ -1512,7 +1513,8 @@ static void stubdom_destroy_callback(libxl__egc *egc,
 savefile = libxl__device_model_savefile(gc, dis->domid);
 rc = libxl__remove_file(gc, savefile);
 if (rc) {
-LOG(ERROR, "failed to remove device-model savefile %s", savefile);
+LOGD(ERROR, dds->domain.domid, "Failed to remove device-model savefile 
%s",
+ savefile);
 }
 
 destroy_finish_check(egc, dds);
@@ -1526,7 +1528,7 @@ static void domain_destroy_callback(libxl__egc *egc,
 libxl__domain_destroy_state *dds = CONTAINER_OF(dis, *dds, domain);
 
 if (rc) {
-LOG(ERROR, "unable to destroy guest with domid %u", dis->domid);
+LOGD(ERROR, dis->domid, "Unable to destroy guest");
 dds->rc = rc;
 }
 
@@ -1723,8 +1725,8 @@ static void domain_destroy_domid_cb(libxl__egc *egc,
 
 if (status) {
 if (WIFEXITED(status) && WEXITSTATUS(status)<126) {
-LOGEV(ERROR, WEXITSTATUS(status),
-  "xc_domain_destroy failed for %"PRIu32"", dis->domid);
+LOGEVD(ERROR, WEXITSTATUS(status), dis->domid,
+   "xc_domain_destroy failed");
 } else {
 libxl_report_child_exitstatus(CTX, XTL_ERROR,
   "async domain destroy", pid, status);
@@ -1999,7 +2001,7 @@ void device_addrm_aocomplete(libxl__egc *egc, 
libxl__ao_device *aodev)
 
 if (aodev->rc) {
 if 

[Xen-devel] [PATCH v2 24/35] libxl/libxl_no_colo.c: used LOG*D functions

2016-11-17 Thread Cédric Bosdonnat
From: Cedric Bosdonnat 

Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat 
---
 tools/libxl/libxl_no_colo.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/libxl/libxl_no_colo.c b/tools/libxl/libxl_no_colo.c
index 152f198..2e1315c 100644
--- a/tools/libxl/libxl_no_colo.c
+++ b/tools/libxl/libxl_no_colo.c
@@ -22,7 +22,7 @@ void libxl__colo_restore_setup(libxl__egc *egc,
 {
 STATE_AO_GC(crs->ao);
 
-LOG(ERROR, "COLO is not supported");
+LOGD(ERROR, crs->domid, "COLO is not supported");
 
 crs->callback(egc, crs, ERROR_FAIL);
 }
@@ -39,7 +39,7 @@ void libxl__colo_save_setup(libxl__egc *egc, 
libxl__colo_save_state *css)
 libxl__domain_save_state *dss = CONTAINER_OF(css, *dss, css);
 STATE_AO_GC(dss->ao);
 
-LOG(ERROR, "COLO is not supported");
+LOGD(ERROR, dss->domid, "COLO is not supported");
 
 dss->callback(egc, dss, ERROR_FAIL);
 }
-- 
2.10.1


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH v2 23/35] libxl/libxl_nic.c: used LOG*D functions

2016-11-17 Thread Cédric Bosdonnat
From: Cedric Bosdonnat 

Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat 
---
 tools/libxl/libxl_nic.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/tools/libxl/libxl_nic.c b/tools/libxl/libxl_nic.c
index 220a028..61b55ca 100644
--- a/tools/libxl/libxl_nic.c
+++ b/tools/libxl/libxl_nic.c
@@ -101,7 +101,8 @@ int libxl__device_nic_setdefault(libxl__gc *gc, 
libxl_device_nic *nic,
 break;
 case LIBXL_DOMAIN_TYPE_PV:
 if (nic->nictype == LIBXL_NIC_TYPE_VIF_IOEMU) {
-LOG(ERROR, "trying to create PV guest with an emulated interface");
+LOGD(ERROR, domid,
+ "trying to create PV guest with an emulated interface");
 return ERROR_INVAL;
 }
 nic->nictype = LIBXL_NIC_TYPE_VIF;
@@ -254,7 +255,7 @@ static void libxl__device_nic_add(libxl__egc *egc, uint32_t 
domid,
 rc = libxl__device_exists(gc, t, device);
 if (rc < 0) goto out;
 if (rc == 1) {  /* already exists in xenstore */
-LOG(ERROR, "device already exists in xenstore");
+LOGD(ERROR, domid, "device already exists in xenstore");
 aodev->action = LIBXL__DEVICE_ACTION_ADD; /* for error message */
 rc = ERROR_DEVICE_EXISTS;
 goto out;
@@ -440,7 +441,7 @@ libxl_device_nic *libxl_device_nic_list(libxl_ctx *ctx, 
uint32_t domid, int *num
 return nics;
 
 out_err:
-LOG(ERROR, "Unable to list nics");
+LOGD(ERROR, domid, "Unable to list nics");
 while (*num) {
 (*num)--;
 libxl_device_nic_dispose([*num]);
@@ -531,7 +532,7 @@ int libxl__device_nic_set_devids(libxl__gc *gc, 
libxl_domain_config *d_config,
 ret = libxl__device_nic_setdefault(gc, _config->nics[i], domid,
false);
 if (ret) {
-LOG(ERROR, "Unable to set nic defaults for nic %d", i);
+LOGD(ERROR, domid, "Unable to set nic defaults for nic %d", i);
 goto out;
 }
 
-- 
2.10.1


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH v2 22/35] libxl/libxl_netbuffer.c: used LOG*D functions

2016-11-17 Thread Cédric Bosdonnat
From: Cedric Bosdonnat 

Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat 
---
 tools/libxl/libxl_netbuffer.c | 43 ---
 1 file changed, 24 insertions(+), 19 deletions(-)

diff --git a/tools/libxl/libxl_netbuffer.c b/tools/libxl/libxl_netbuffer.c
index 5c7e8a2..323cdd8 100644
--- a/tools/libxl/libxl_netbuffer.c
+++ b/tools/libxl/libxl_netbuffer.c
@@ -48,15 +48,15 @@ int init_subkind_nic(libxl__checkpoint_devices_state *cds)
 
 rs->nlsock = nl_socket_alloc();
 if (!rs->nlsock) {
-LOG(ERROR, "cannot allocate nl socket");
+LOGD(ERROR, dss->domid, "cannot allocate nl socket");
 rc = ERROR_FAIL;
 goto out;
 }
 
 ret = nl_connect(rs->nlsock, NETLINK_ROUTE);
 if (ret) {
-LOG(ERROR, "failed to open netlink socket: %s",
-nl_geterror(ret));
+LOGD(ERROR, dss->domid, "failed to open netlink socket: %s",
+ nl_geterror(ret));
 rc = ERROR_FAIL;
 goto out;
 }
@@ -64,8 +64,8 @@ int init_subkind_nic(libxl__checkpoint_devices_state *cds)
 /* get list of all qdiscs installed on network devs. */
 ret = rtnl_qdisc_alloc_cache(rs->nlsock, >qdisc_cache);
 if (ret) {
-LOG(ERROR, "failed to allocate qdisc cache: %s",
-nl_geterror(ret));
+LOGD(ERROR, dss->domid, "failed to allocate qdisc cache: %s",
+ nl_geterror(ret));
 rc = ERROR_FAIL;
 goto out;
 }
@@ -162,7 +162,8 @@ static int init_qdisc(libxl__checkpoint_devices_state *cds,
  */
 ret = nl_cache_refill(rs->nlsock, rs->qdisc_cache);
 if (ret) {
-LOG(ERROR, "cannot refill qdisc cache: %s", nl_geterror(ret));
+LOGD(ERROR, cds->domid,
+ "cannot refill qdisc cache: %s", nl_geterror(ret));
 rc = ERROR_FAIL;
 goto out;
 }
@@ -170,7 +171,8 @@ static int init_qdisc(libxl__checkpoint_devices_state *cds,
 /* get a handle to the REMUS_IFB interface */
 ret = rtnl_link_get_kernel(rs->nlsock, 0, remus_nic->ifb, );
 if (ret) {
-LOG(ERROR, "cannot obtain handle for %s: %s", remus_nic->ifb,
+LOGD(ERROR, cds->domid,
+ "cannot obtain handle for %s: %s", remus_nic->ifb,
 nl_geterror(ret));
 rc = ERROR_FAIL;
 goto out;
@@ -178,7 +180,8 @@ static int init_qdisc(libxl__checkpoint_devices_state *cds,
 
 ifindex = rtnl_link_get_ifindex(ifb);
 if (!ifindex) {
-LOG(ERROR, "interface %s has no index", remus_nic->ifb);
+LOGD(ERROR, cds->domid,
+ "interface %s has no index", remus_nic->ifb);
 rc = ERROR_FAIL;
 goto out;
 }
@@ -196,13 +199,15 @@ static int init_qdisc(libxl__checkpoint_devices_state 
*cds,
 const char *tc_kind = rtnl_tc_get_kind(TC_CAST(qdisc));
 /* Sanity check: Ensure that the root qdisc is a plug qdisc. */
 if (!tc_kind || strcmp(tc_kind, "plug")) {
-LOG(ERROR, "plug qdisc is not installed on %s", remus_nic->ifb);
+LOGD(ERROR, cds->domid,
+ "plug qdisc is not installed on %s", remus_nic->ifb);
 rc = ERROR_FAIL;
 goto out;
 }
 remus_nic->qdisc = qdisc;
 } else {
-LOG(ERROR, "Cannot get qdisc handle from ifb %s", remus_nic->ifb);
+LOGD(ERROR, cds->domid,
+ "Cannot get qdisc handle from ifb %s", remus_nic->ifb);
 rc = ERROR_FAIL;
 goto out;
 }
@@ -366,8 +371,8 @@ static void netbuf_setup_script_cb(libxl__egc *egc,
 goto out;
 
 if (!(*ifb)) {
-LOG(ERROR, "Cannot get ifb dev name for domain %u dev %s",
-domid, vif);
+LOGD(ERROR, domid, "Cannot get ifb dev name for domain %u dev %s",
+ domid, vif);
 rc = ERROR_FAIL;
 goto out;
 }
@@ -382,8 +387,8 @@ static void netbuf_setup_script_cb(libxl__egc *egc,
 goto out;
 
 if (hotplug_error) {
-LOG(ERROR, "netbuf script %s setup failed for vif %s: %s",
-rs->netbufscript, vif, hotplug_error);
+LOGD(ERROR, domid, "netbuf script %s setup failed for vif %s: %s",
+ rs->netbufscript, vif, hotplug_error);
 rc = ERROR_FAIL;
 goto out;
 }
@@ -393,7 +398,7 @@ static void netbuf_setup_script_cb(libxl__egc *egc,
 goto out;
 }
 
-LOG(DEBUG, "%s will buffer packets from vif %s", *ifb, vif);
+LOGD(DEBUG, domid, "%s will buffer packets from vif %s", *ifb, vif);
 rc = init_qdisc(cds, remus_nic);
 
 out:
@@ -475,10 +480,10 @@ static int remus_netbuf_op(libxl__remus_device_nic 
*remus_nic,
 
 out:
 if (rc)
-LOG(ERROR, "Remus: cannot do netbuf op %s on %s:%s",
-((buffer_op == tc_buffer_start) ?
-"start_new_epoch" : "release_prev_epoch"),
-remus_nic->ifb, nl_geterror(ret));
+LOGD(ERROR, cds-> domid, "Remus: 

[Xen-devel] [PATCH v2 30/35] libxl/libxl_save_callout.c: used LOG*D functions

2016-11-17 Thread Cédric Bosdonnat
From: Cedric Bosdonnat 

Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat 
---
 tools/libxl/libxl_save_callout.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/libxl/libxl_save_callout.c b/tools/libxl/libxl_save_callout.c
index 2e6267d..46b892c 100644
--- a/tools/libxl/libxl_save_callout.c
+++ b/tools/libxl/libxl_save_callout.c
@@ -294,8 +294,8 @@ static void helper_stdout_readable(libxl__egc *egc, 
libxl__ev_fd *ev,
 int rc, errnoval;
 
 if (revents & (POLLERR|POLLPRI)) {
-LOG(ERROR, "%s signaled POLLERR|POLLPRI (%#x)",
-shs->stdout_what, revents);
+LOGD(ERROR, shs->domid, "%s signaled POLLERR|POLLPRI (%#x)",
+ shs->stdout_what, revents);
 rc = ERROR_FAIL;
  out:
 /* this is here because otherwise we bypass the decl of msg[] */
@@ -339,14 +339,14 @@ static void helper_exited(libxl__egc *egc, 
libxl__ev_child *ch,
 
 if (shs->need_results) {
 if (!shs->rc) {
-LOG(ERROR,"%s exited without providing results",what);
+LOGD(ERROR,shs->domid,"%s exited without providing results",what);
 shs->rc = ERROR_FAIL;
 }
 }
 
 if (!shs->completed) {
 if (!shs->rc) {
-LOG(ERROR,"%s exited without signaling completion",what);
+LOGD(ERROR,shs->domid,"%s exited without signaling 
completion",what);
 shs->rc = ERROR_FAIL;
 }
 }
-- 
2.10.1


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH v2 11/35] libxl/libxl_colo_restore.c: used LOG*D functions

2016-11-17 Thread Cédric Bosdonnat
From: Cedric Bosdonnat 

Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat 
---
 tools/libxl/libxl_colo_restore.c | 57 
 1 file changed, 28 insertions(+), 29 deletions(-)

diff --git a/tools/libxl/libxl_colo_restore.c b/tools/libxl/libxl_colo_restore.c
index 3483f39..6a96328 100644
--- a/tools/libxl/libxl_colo_restore.c
+++ b/tools/libxl/libxl_colo_restore.c
@@ -63,7 +63,7 @@ static void colo_enable_logdirty(libxl__colo_restore_state 
*crs, libxl__egc *egc
 if (xc_shadow_control(CTX->xch, domid,
   XEN_DOMCTL_SHADOW_OP_ENABLE_LOGDIRTY,
   NULL, 0, NULL, 0, NULL) < 0) {
-LOG(ERROR, "cannot enable secondary vm's logdirty");
+LOGD(ERROR, domid, "cannot enable secondary vm's logdirty");
 lds->callback(egc, lds, ERROR_FAIL);
 return;
 }
@@ -91,7 +91,7 @@ static void colo_disable_logdirty(libxl__colo_restore_state 
*crs,
 /* we need to know which pages are dirty to restore the guest */
 if (xc_shadow_control(CTX->xch, domid, XEN_DOMCTL_SHADOW_OP_OFF,
   NULL, 0, NULL, 0, NULL) < 0)
-LOG(WARN, "cannot disable secondary vm's logdirty");
+LOGD(WARN, domid, "cannot disable secondary vm's logdirty");
 
 if (crs->hvm) {
 libxl__domain_common_switch_qemu_logdirty(egc, domid, 0, lds);
@@ -118,14 +118,15 @@ static void colo_resume_vm(libxl__egc *egc,
 if (restore_device_model) {
 rc = libxl__qmp_restore(gc, crs->domid, crcs->state_file);
 if (rc) {
-LOG(ERROR, "cannot restore device model for secondary vm");
+LOGD(ERROR, crs->domid,
+ "cannot restore device model for secondary vm");
 crcs->callback(egc, crcs, rc);
 return;
 }
 }
 rc = libxl__domain_resume(gc, crs->domid, 0);
 if (rc)
-LOG(ERROR, "cannot resume secondary vm");
+LOGD(ERROR, crs->domid, "cannot resume secondary vm");
 
 crcs->callback(egc, crcs, rc);
 return;
@@ -317,7 +318,7 @@ void libxl__colo_restore_teardown(libxl__egc *egc, void 
*dcs_void,
 if (ret == 0 && retval == 0)
 rc = 0;
 
-LOG(INFO, "%s", rc ? "colo fails" : "failover");
+LOGD(INFO, crs->domid, "%s", rc ? "colo fails" : "failover");
 
 libxl__stream_write_abort(egc, >sws, 1);
 if (crs->saved_cb) {
@@ -351,8 +352,8 @@ static void colo_restore_teardown_devices_done(libxl__egc 
*egc,
 EGC_GC;
 
 if (rc)
-LOG(ERROR, "COLO: failed to teardown device for guest with domid %u,"
-" rc %d", cds->domid, rc);
+LOGD(ERROR, cds->domid, "COLO: failed to teardown device for guest,"
+" rc %d", rc);
 
 if (crcs->teardown_devices)
 cleanup_device_subkind(cds);
@@ -387,7 +388,7 @@ static void do_failover(libxl__egc *egc, 
libxl__colo_restore_state *crs)
  * is not called. In this case, the migration is not finished,
  * so we cannot do failover.
  */
-LOG(ERROR, "migration fails");
+LOGD(ERROR, crs->domid, "migration fails");
 crcs->callback(egc, crcs, ERROR_FAIL);
 return;
 case LIBXL_COLO_SUSPENDED:
@@ -397,7 +398,7 @@ static void do_failover(libxl__egc *egc, 
libxl__colo_restore_state *crs)
 colo_disable_logdirty(crs, egc);
 return;
 default:
-LOG(ERROR, "invalid status: %d", status);
+LOGD(ERROR, crs->domid, "invalid status: %d", status);
 crcs->callback(egc, crcs, ERROR_FAIL);
 }
 }
@@ -414,7 +415,7 @@ static void do_failover_done(libxl__egc *egc,
 EGC_GC;
 
 if (rc)
-LOG(ERROR, "cannot do failover");
+LOGD(ERROR, crs->domid, "cannot do failover");
 
 libxl__colo_restore_teardown_done(egc, crs, rc);
 }
@@ -428,7 +429,7 @@ static void colo_disable_logdirty_done(libxl__egc *egc,
 EGC_GC;
 
 if (rc)
-LOG(WARN, "cannot disable logdirty");
+LOGD(WARN, crcs->crs->domid, "cannot disable logdirty");
 
 if (crcs->status == LIBXL_COLO_SUSPENDED) {
 /*
@@ -601,13 +602,13 @@ static void colo_restore_preresume_cb(libxl__egc *egc,
 EGC_GC;
 
 if (rc) {
-LOG(ERROR, "preresume fails");
+LOGD(ERROR, crs->domid, "preresume fails");
 goto out;
 }
 
 if (crs->qdisk_setuped) {
 if (libxl__qmp_do_checkpoint(gc, crs->domid)) {
-LOG(ERROR, "doing checkpoint fails");
+LOGD(ERROR, crs->domid, "doing checkpoint fails");
 goto out;
 }
 }
@@ -644,7 +645,7 @@ static void colo_resume_vm_done(libxl__egc *egc,
 EGC_GC;
 
 if (rc) {
-LOG(ERROR, "cannot resume secondary vm");
+LOGD(ERROR, crs->domid, "cannot resume secondary vm");
 goto out;
 }
 
@@ -719,7 +720,7 @@ static void 

[Xen-devel] [PATCH v2 00/35] libxl LOG*D functions

2016-11-17 Thread Cédric Bosdonnat
Hey all,

Here is v2 addressing Wei's comments on patch #1. The 3 libxl.c
patches haven't been merged, but the commit message of the first
one has been slightly rewritten to help understanding the reason
of the split.

Cedric Bosdonnat (35):
  libxl: add LIBXL_LOGD_* and LOG*D function families.
  libxl.c: switch to LOG*D use
  libxl.c: switch to LOG*D use (refactored messages)
  libxl.c: switch to LOG*D use
  libxl/libxl_bootloader.c: used LOG*D functions
  libxl/libxl_checkpoint_device.c: used LOG*D functions
  libxl/libxl_colo.h: used LOG*D functions
  libxl/libxl_colo_nic.c: used LOG*D functions
  libxl/libxl_colo_proxy.c: used LOG*D functions
  libxl/libxl_colo_qdisk.c: used LOG*D functions
  libxl/libxl_colo_restore.c: used LOG*D functions
  libxl/libxl_colo_save.c: used LOG*D functions
  libxl/libxl_create.c: used LOG*D functions
  libxl/libxl_device.c: used LOG*D functions
  libxl/libxl_dm.c: used LOG*D functions
  libxl/libxl_dom_save.c: used LOG*D functions
  libxl/libxl_dom_suspend.c: used LOG*D functions
  libxl/libxl_freebsd.c: used LOG*D functions
  libxl/libxl_internal.c: used LOG*D functions
  libxl/libxl_linux.c: used LOG*D functions
  libxl/libxl_netbsd.c: used LOG*D functions
  libxl/libxl_netbuffer.c: used LOG*D functions
  libxl/libxl_nic.c: used LOG*D functions
  libxl/libxl_no_colo.c: used LOG*D functions
  libxl/libxl_pci.c: used LOG*D functions
  libxl/libxl_psr.c: used LOG*D functions
  libxl/libxl_pvusb.c: used LOG*D functions
  libxl/libxl_qmp.c: used LOG*D functions
  libxl/libxl_remus.c: used LOG*D functions
  libxl/libxl_save_callout.c: used LOG*D functions
  libxl/libxl_stream_write.c: used LOG*D functions
  libxl/libxl_vnuma.c: used LOG*D functions
  libxl/libxl_vtpm.c: used LOG*D functions
  libxl/libxl_x86.c: used LOG*D functions
  libxl/libxl_xshelp.c: used LOG*D functions

 tools/libxl/libxl.c   | 499 +-
 tools/libxl/libxl_bootloader.c|  84 +++---
 tools/libxl/libxl_checkpoint_device.c |  14 +-
 tools/libxl/libxl_colo.h  |   2 +-
 tools/libxl/libxl_colo_nic.c  |   2 +-
 tools/libxl/libxl_colo_proxy.c|  24 +-
 tools/libxl/libxl_colo_qdisk.c|   2 +-
 tools/libxl/libxl_colo_restore.c  |  57 ++--
 tools/libxl/libxl_colo_save.c |  49 ++--
 tools/libxl/libxl_create.c| 119 
 tools/libxl/libxl_device.c|  70 ++---
 tools/libxl/libxl_dm.c| 111 
 tools/libxl/libxl_dom_save.c  |  29 +-
 tools/libxl/libxl_dom_suspend.c   |  45 ++-
 tools/libxl/libxl_event.c |  10 +-
 tools/libxl/libxl_freebsd.c   |   8 +-
 tools/libxl/libxl_internal.c  |  45 +--
 tools/libxl/libxl_internal.h  |  38 ++-
 tools/libxl/libxl_linux.c |  23 +-
 tools/libxl/libxl_netbsd.c|   9 +-
 tools/libxl/libxl_netbuffer.c |  43 +--
 tools/libxl/libxl_nic.c   |   9 +-
 tools/libxl/libxl_no_colo.c   |   4 +-
 tools/libxl/libxl_pci.c   | 153 ++-
 tools/libxl/libxl_psr.c   |  12 +-
 tools/libxl/libxl_qmp.c   |  56 ++--
 tools/libxl/libxl_remus.c |  27 +-
 tools/libxl/libxl_save_callout.c  |   8 +-
 tools/libxl/libxl_stream_write.c  |  10 +-
 tools/libxl/libxl_usb.c   |  57 ++--
 tools/libxl/libxl_vnuma.c |   2 +-
 tools/libxl/libxl_vtpm.c  |   8 +-
 tools/libxl/libxl_x86.c   |   6 +-
 tools/libxl/libxl_xshelp.c|   4 +-
 34 files changed, 860 insertions(+), 779 deletions(-)

-- 
2.10.1


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH v2 19/35] libxl/libxl_internal.c: used LOG*D functions

2016-11-17 Thread Cédric Bosdonnat
From: Cedric Bosdonnat 

Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat 
---
 tools/libxl/libxl_internal.c | 29 ++---
 1 file changed, 14 insertions(+), 15 deletions(-)

diff --git a/tools/libxl/libxl_internal.c b/tools/libxl/libxl_internal.c
index c270a24..d288215 100644
--- a/tools/libxl/libxl_internal.c
+++ b/tools/libxl/libxl_internal.c
@@ -380,7 +380,7 @@ int libxl__device_model_version_running(libxl__gc *gc, 
uint32_t domid)
 }
 
 if (libxl_device_model_version_from_string(dm_version, ) < 0) {
-LOG(ERROR, "fatal: %s contain a wrong value (%s)", path, dm_version);
+LOGD(ERROR, domid, "fatal: %s contain a wrong value (%s)", path, 
dm_version);
 return -1;
 }
 return value;
@@ -407,7 +407,8 @@ libxl__domain_userdata_lock 
*libxl__lock_domain_userdata(libxl__gc *gc,
 libxl__carefd_begin();
 fd = open(lockfile, O_RDWR|O_CREAT, 0666);
 if (fd < 0)
-LOGE(ERROR, "cannot open lockfile %s, errno=%d", lockfile, errno);
+LOGED(ERROR, domid,
+  "cannot open lockfile %s, errno=%d", lockfile, errno);
 lock->carefd = libxl__carefd_opened(CTX, fd);
 if (fd < 0) goto out;
 
@@ -421,21 +422,21 @@ libxl__domain_userdata_lock 
*libxl__lock_domain_userdata(libxl__gc *gc,
 continue;
 default:
 /* All other errno: EBADF, EINVAL, ENOLCK, EWOULDBLOCK */
-LOGE(ERROR,
- "unexpected error while trying to lock %s, fd=%d, 
errno=%d",
- lockfile, fd, errno);
+LOGED(ERROR, domid,
+  "unexpected error while trying to lock %s, fd=%d, 
errno=%d",
+  lockfile, fd, errno);
 goto out;
 }
 }
 
 if (fstat(fd, )) {
-LOGE(ERROR, "cannot fstat %s, fd=%d, errno=%d",
- lockfile, fd, errno);
+LOGED(ERROR, domid, "cannot fstat %s, fd=%d, errno=%d",
+  lockfile, fd, errno);
 goto out;
 }
 if (stat(lockfile, )) {
 if (errno != ENOENT) {
-LOGE(ERROR, "cannot stat %s, errno=%d", lockfile, errno);
+LOGED(ERROR, domid, "cannot stat %s, errno=%d", lockfile, 
errno);
 goto out;
 }
 } else {
@@ -489,8 +490,8 @@ int libxl__get_domain_configuration(libxl__gc *gc, uint32_t 
domid,
 
 rc = libxl__userdata_retrieve(gc, domid, "libxl-json", , );
 if (rc) {
-LOGEV(ERROR, rc,
-  "failed to retrieve domain configuration for domain %d", domid);
+LOGEVD(ERROR, rc, domid,
+  "failed to retrieve domain configuration");
 rc = ERROR_FAIL;
 goto out;
 }
@@ -515,9 +516,8 @@ int libxl__set_domain_configuration(libxl__gc *gc, uint32_t 
domid,
 
 d_config_json = libxl_domain_config_to_json(CTX, d_config);
 if (!d_config_json) {
-LOGE(ERROR,
- "failed to convert domain configuration to JSON for domain %d",
- domid);
+LOGED(ERROR, domid,
+  "failed to convert domain configuration to JSON");
 rc = ERROR_FAIL;
 goto out;
 }
@@ -526,8 +526,7 @@ int libxl__set_domain_configuration(libxl__gc *gc, uint32_t 
domid,
(const uint8_t *)d_config_json,
strlen(d_config_json) + 1 /* include '\0' */);
 if (rc) {
-LOGEV(ERROR, rc, "failed to store domain configuration for domain %d",
-  domid);
+LOGEVD(ERROR, rc, domid, "failed to store domain configuration");
 rc = ERROR_FAIL;
 goto out;
 }
-- 
2.10.1


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH v2 10/35] libxl/libxl_colo_qdisk.c: used LOG*D functions

2016-11-17 Thread Cédric Bosdonnat
From: Cedric Bosdonnat 

Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat 
---
 tools/libxl/libxl_colo_qdisk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libxl/libxl_colo_qdisk.c b/tools/libxl/libxl_colo_qdisk.c
index d271d1f..303b96e 100644
--- a/tools/libxl/libxl_colo_qdisk.c
+++ b/tools/libxl/libxl_colo_qdisk.c
@@ -84,7 +84,7 @@ static void colo_qdisk_setup(libxl__egc *egc, 
libxl__checkpoint_device *dev,
 crs->port = port;
 } else {
 if (strcmp(crs->host, host) || strcmp(crs->port, port)) {
-LOG(ERROR, "The host and port of all disks must be the same");
+LOGD(ERROR, domid, "The host and port of all disks must be the 
same");
 rc = ERROR_FAIL;
 goto out;
 }
-- 
2.10.1


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH v2 07/35] libxl/libxl_colo.h: used LOG*D functions

2016-11-17 Thread Cédric Bosdonnat
From: Cedric Bosdonnat 

Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat 
---
 tools/libxl/libxl_colo.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libxl/libxl_colo.h b/tools/libxl/libxl_colo.h
index f0e438e..682275c 100644
--- a/tools/libxl/libxl_colo.h
+++ b/tools/libxl/libxl_colo.h
@@ -27,7 +27,7 @@
 \
 pid = libxl__ev_child_fork(gc, child, callback);\
 if (pid == -1) {\
-LOG(ERROR, "unable to fork");   \
+LOGD(ERROR, ao->domid, "unable to fork");   \
 goto out;   \
 }   \
 \
-- 
2.10.1


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH v2 20/35] libxl/libxl_linux.c: used LOG*D functions

2016-11-17 Thread Cédric Bosdonnat
From: Cedric Bosdonnat 

Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat 
---
 tools/libxl/libxl_linux.c | 23 ++-
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/tools/libxl/libxl_linux.c b/tools/libxl/libxl_linux.c
index 0033a0e..6ef0abc 100644
--- a/tools/libxl/libxl_linux.c
+++ b/tools/libxl/libxl_linux.c
@@ -61,7 +61,7 @@ static char **get_hotplug_env(libxl__gc *gc,
 env[nr++] = gatewaydev ? : "";
 
 if (libxl__nic_type(gc, dev, )) {
-LOG(ERROR, "unable to get nictype");
+LOGD(ERROR, dev->domid, "unable to get nictype");
 return NULL;
 }
 switch (nictype) {
@@ -107,14 +107,15 @@ static int libxl__hotplug_nic(libxl__gc *gc, 
libxl__device *dev,
 script = libxl__xs_read(gc, XBT_NULL, GCSPRINTF("%s/%s", be_path,
  "script"));
 if (!script) {
-LOGE(ERROR, "unable to read script from %s", be_path);
+LOGED(ERROR, dev->domid,
+  "unable to read script from %s", be_path);
 rc = ERROR_FAIL;
 goto out;
 }
 
 rc = libxl__nic_type(gc, dev, );
 if (rc) {
-LOG(ERROR, "error when fetching nic type");
+LOGD(ERROR, dev->domid, "error when fetching nic type");
 rc = ERROR_FAIL;
 goto out;
 }
@@ -161,14 +162,15 @@ static int libxl__hotplug_disk(libxl__gc *gc, 
libxl__device *dev,
 script = libxl__xs_read(gc, XBT_NULL,
 GCSPRINTF("%s/%s", be_path, "script"));
 if (!script) {
-LOGEV(ERROR, errno, "unable to read script from %s", be_path);
+LOGEVD(ERROR, errno, dev->domid,
+   "unable to read script from %s", be_path);
 rc = ERROR_FAIL;
 goto error;
 }
 
 *env = get_hotplug_env(gc, script, dev);
 if (!*env) {
-LOG(ERROR, "Failed to get hotplug environment");
+LOGD(ERROR, dev->domid, "Failed to get hotplug environment");
 rc = ERROR_FAIL;
 goto error;
 }
@@ -180,7 +182,7 @@ static int libxl__hotplug_disk(libxl__gc *gc, libxl__device 
*dev,
 (*args)[nr++] = NULL;
 assert(nr == arraysize);
 
-LOG(DEBUG, "Args and environment ready");
+LOGD(DEBUG, dev->domid, "Args and environment ready");
 rc = 1;
 
 error:
@@ -197,7 +199,8 @@ int libxl__get_hotplug_script_info(libxl__gc *gc, 
libxl__device *dev,
 switch (dev->backend_kind) {
 case LIBXL__DEVICE_KIND_VBD:
 if (num_exec != 0) {
-LOG(DEBUG, "num_exec %d, not running hotplug scripts", num_exec);
+LOGD(DEBUG, dev->domid,
+ "num_exec %d, not running hotplug scripts", num_exec);
 rc = 0;
 goto out;
 }
@@ -210,7 +213,8 @@ int libxl__get_hotplug_script_info(libxl__gc *gc, 
libxl__device *dev,
  */
 if ((num_exec > 1) ||
 (libxl_get_stubdom_id(CTX, dev->domid) && num_exec)) {
-LOG(DEBUG, "num_exec %d, not running hotplug scripts", num_exec);
+LOGD(DEBUG, dev->domid,
+ "num_exec %d, not running hotplug scripts", num_exec);
 rc = 0;
 goto out;
 }
@@ -218,7 +222,8 @@ int libxl__get_hotplug_script_info(libxl__gc *gc, 
libxl__device *dev,
 break;
 default:
 /* No need to execute any hotplug scripts */
-LOG(DEBUG, "backend_kind %d, no need to execute scripts", 
dev->backend_kind);
+LOGD(DEBUG, dev->domid,
+ "backend_kind %d, no need to execute scripts", dev->backend_kind);
 rc = 0;
 break;
 }
-- 
2.10.1


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH v2 14/35] libxl/libxl_device.c: used LOG*D functions

2016-11-17 Thread Cédric Bosdonnat
From: Cedric Bosdonnat 

Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat 
---
 tools/libxl/libxl_device.c | 70 --
 1 file changed, 37 insertions(+), 33 deletions(-)

diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c
index 3e7a102..5e22866 100644
--- a/tools/libxl/libxl_device.c
+++ b/tools/libxl/libxl_device.c
@@ -94,13 +94,13 @@ int libxl__nic_type(libxl__gc *gc, libxl__device *dev, 
libxl_nic_type *nictype)
 snictype = libxl__xs_read(gc, XBT_NULL,
   GCSPRINTF("%s/%s", be_path, "type"));
 if (!snictype) {
-LOGE(ERROR, "unable to read nictype from %s", be_path);
+LOGED(ERROR, dev->domid, "unable to read nictype from %s", be_path);
 rc = ERROR_FAIL;
 goto out;
 }
 rc = libxl_nic_type_from_string(snictype, nictype);
 if (rc) {
-LOGE(ERROR, "unable to parse nictype from %s", be_path);
+LOGED(ERROR, dev->domid, "unable to parse nictype from %s", be_path);
 goto out;
 }
 
@@ -231,7 +231,7 @@ retry_transaction:
 if (errno == EAGAIN)
 goto retry_transaction;
 else {
-LOGE(ERROR, "xs transaction failed");
+LOGED(ERROR, device->domid, "xs transaction failed");
 return ERROR_FAIL;
 }
 }
@@ -885,7 +885,7 @@ void libxl__wait_device_connection(libxl__egc *egc, 
libxl__ao_device *aodev)
  state_path, XenbusStateInitWait,
  LIBXL_INIT_TIMEOUT * 1000);
 if (rc) {
-LOG(ERROR, "unable to initialize device %s", be_path);
+LOGD(ERROR, aodev->dev->domid, "unable to initialize device %s", 
be_path);
 goto out;
 }
 
@@ -914,14 +914,14 @@ void libxl__initiate_device_generic_remove(libxl__egc 
*egc,
 
 rc = libxl__get_domid(gc, _domid);
 if (rc) {
-LOG(ERROR, "unable to get my domid");
+LOGD(ERROR, domid, "unable to get my domid");
 goto out;
 }
 
 if (my_domid == LIBXL_TOOLSTACK_DOMID) {
 rc = libxl_domain_info(CTX, , domid);
 if (rc) {
-LOG(ERROR, "unable to get info for domain %d", domid);
+LOGD(ERROR, domid, "unable to get info for domain %d", domid);
 goto out;
 }
 if (QEMU_BACKEND(aodev->dev) &&
@@ -934,8 +934,8 @@ void libxl__initiate_device_generic_remove(libxl__egc *egc,
  device_qemu_timeout,
  LIBXL_QEMU_BODGE_TIMEOUT * 1000);
 if (rc) {
-LOG(ERROR, "unable to register timeout for Qemu device %s",
-   be_path);
+LOGD(ERROR, domid, "unable to register timeout for Qemu device 
%s",
+be_path);
 goto out;
 }
 goto out_success;
@@ -945,7 +945,7 @@ void libxl__initiate_device_generic_remove(libxl__egc *egc,
 for (;;) {
 rc = libxl__xs_transaction_start(gc, );
 if (rc) {
-LOG(ERROR, "unable to start transaction");
+LOGD(ERROR, domid, "unable to start transaction");
 goto out;
 }
 
@@ -955,7 +955,7 @@ void libxl__initiate_device_generic_remove(libxl__egc *egc,
 
 rc = libxl__xs_read_checked(gc, t, state_path, );
 if (rc) {
-LOG(ERROR, "unable to read device state from path %s", state_path);
+LOGD(ERROR, domid, "unable to read device state from path %s", 
state_path);
 goto out;
 }
 
@@ -970,7 +970,7 @@ void libxl__initiate_device_generic_remove(libxl__egc *egc,
  if (state && atoi(state) != XenbusStateClosed) {
 rc = libxl__xs_write_checked(gc, t, state_path, GCSPRINTF("%d", 
XenbusStateClosing));
 if (rc) {
-LOG(ERROR, "unable to write to xenstore path %s", state_path);
+LOGD(ERROR, domid, "unable to write to xenstore path %s", 
state_path);
 goto out;
 }
 }
@@ -985,7 +985,7 @@ void libxl__initiate_device_generic_remove(libxl__egc *egc,
  state_path, XenbusStateClosed,
  LIBXL_DESTROY_TIMEOUT * 1000);
 if (rc) {
-LOG(ERROR, "unable to remove device %s", be_path);
+LOGD(ERROR, domid, "unable to remove device %s", be_path);
 goto out;
 }
 
@@ -1019,7 +1019,7 @@ static void device_qemu_timeout(libxl__egc *egc, 
libxl__ev_time *ev,
 for (;;) {
 rc = libxl__xs_transaction_start(gc, );
 if (rc) {
-LOG(ERROR, "unable to start transaction");
+LOGD(ERROR, aodev->dev->domid, "unable to start transaction");
 goto out;
 }
 
@@ -1056,22 +1056,22 @@ static void device_backend_callback(libxl__egc *egc, 

[Xen-devel] [PATCH v2 08/35] libxl/libxl_colo_nic.c: used LOG*D functions

2016-11-17 Thread Cédric Bosdonnat
From: Cedric Bosdonnat 

Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat 
---
 tools/libxl/libxl_colo_nic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libxl/libxl_colo_nic.c b/tools/libxl/libxl_colo_nic.c
index 5e0968c..a164e22 100644
--- a/tools/libxl/libxl_colo_nic.c
+++ b/tools/libxl/libxl_colo_nic.c
@@ -213,7 +213,7 @@ static void colo_save_setup_script_cb(libxl__egc *egc,
 goto out;
 
 if (hotplug_error) {
-LOG(ERROR, "colo_proxy script %s setup failed for vif %s: %s",
+LOGD(ERROR, domid, "colo_proxy script %s setup failed for vif %s: %s",
 aes->args[0], vif, hotplug_error);
 rc = ERROR_FAIL;
 goto out;
-- 
2.10.1


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH v2 18/35] libxl/libxl_freebsd.c: used LOG*D functions

2016-11-17 Thread Cédric Bosdonnat
From: Cedric Bosdonnat 

Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat 
---
 tools/libxl/libxl_freebsd.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/tools/libxl/libxl_freebsd.c b/tools/libxl/libxl_freebsd.c
index c527455..6442cce 100644
--- a/tools/libxl/libxl_freebsd.c
+++ b/tools/libxl/libxl_freebsd.c
@@ -121,7 +121,7 @@ static int libxl__hotplug_nic(libxl__gc *gc, libxl__device 
*dev,
 
 rc = libxl__nic_type(gc, dev, );
 if (rc) {
-LOG(ERROR, "error when fetching nic type");
+LOGD(ERROR, dev->domid, "error when fetching nic type");
 rc = ERROR_FAIL;
 goto out;
 }
@@ -143,7 +143,8 @@ static int libxl__hotplug_nic(libxl__gc *gc, libxl__device 
*dev,
 script = libxl__xs_read(gc, XBT_NULL,
 GCSPRINTF("%s/%s", be_path, "script"));
 if (!script) {
-LOGEV(ERROR, errno, "unable to read script from %s", be_path);
+LOGEVD(ERROR, errno, dev->domid,
+   "unable to read script from %s", be_path);
 rc = ERROR_FAIL;
 goto out;
 }
@@ -172,7 +173,8 @@ static int libxl__hotplug_disk(libxl__gc *gc, libxl__device 
*dev,
 script = libxl__xs_read(gc, XBT_NULL,
 GCSPRINTF("%s/%s", be_path, "script"));
 if (!script) {
-LOGEV(ERROR, errno, "unable to read script from %s", be_path);
+LOGEVD(ERROR, errno, dev->domid,
+   "unable to read script from %s", be_path);
 rc = ERROR_FAIL;
 goto out;
 }
-- 
2.10.1


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH v2 13/35] libxl/libxl_create.c: used LOG*D functions

2016-11-17 Thread Cédric Bosdonnat
From: Cedric Bosdonnat 

Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat 
---
 tools/libxl/libxl_create.c | 119 +++--
 1 file changed, 60 insertions(+), 59 deletions(-)

diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index 7c1695a..e3bc257 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -539,7 +539,7 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_config 
*d_config,
 } else if (libxl_defbool_val(info->pvh)) {
 flags |= XEN_DOMCTL_CDF_pvh_guest;
 if (!libxl_defbool_val(info->hap)) {
-LOG(ERROR, "HAP must be on for PVH");
+LOGD(ERROR, *domid, "HAP must be on for PVH");
 rc = ERROR_INVAL;
 goto out;
 }
@@ -551,7 +551,7 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_config 
*d_config,
 
 ret = libxl__arch_domain_prepare_config(gc, d_config, xc_config);
 if (ret < 0) {
-LOGE(ERROR, "fail to get domain config");
+LOGED(ERROR, *domid, "fail to get domain config");
 rc = ERROR_FAIL;
 goto out;
 }
@@ -561,7 +561,7 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_config 
*d_config,
 ret = xc_domain_create(ctx->xch, info->ssidref, handle, flags, domid,
xc_config);
 if (ret < 0) {
-LOGE(ERROR, "domain creation fail");
+LOGED(ERROR, *domid, "domain creation fail");
 rc = ERROR_FAIL;
 goto out;
 }
@@ -573,7 +573,7 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_config 
*d_config,
 
 ret = xc_cpupool_movedomain(ctx->xch, info->poolid, *domid);
 if (ret < 0) {
-LOGE(ERROR, "domain move fail");
+LOGED(ERROR, *domid, "domain move fail");
 rc = ERROR_FAIL;
 goto out;
 }
@@ -586,7 +586,7 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_config 
*d_config,
 
 vm_path = GCSPRINTF("/vm/%s", uuid_string);
 if (!vm_path) {
-LOG(ERROR, "cannot allocate create paths");
+LOGD(ERROR, *domid, "cannot allocate create paths");
 rc = ERROR_FAIL;
 goto out;
 }
@@ -697,7 +697,7 @@ retry_transaction:
 
 vm_list = libxl_list_vm(ctx, _vm);
 if (!vm_list) {
-LOG(ERROR, "cannot get number of running guests");
+LOGD(ERROR, *domid, "cannot get number of running guests");
 rc = ERROR_FAIL;
 goto out;
 }
@@ -716,7 +716,7 @@ retry_transaction:
 t = 0;
 goto retry_transaction;
 }
-LOGE(ERROR, "domain creation ""xenstore transaction commit failed");
+LOGED(ERROR, *domid, "domain creation ""xenstore transaction commit 
failed");
 rc = ERROR_FAIL;
 goto out;
 }
@@ -806,10 +806,10 @@ static void initiate_domain_create(libxl__egc *egc,
  _config->c_info.ssidref);
 if (ret) {
 if (errno == ENOSYS) {
-LOG(WARN, "XSM Disabled: init_seclabel not supported");
+LOGD(WARN, domid, "XSM Disabled: init_seclabel not supported");
 ret = 0;
 } else {
-LOG(ERROR, "Invalid init_seclabel: %s", s);
+LOGD(ERROR, domid, "Invalid init_seclabel: %s", s);
 goto error_out;
 }
 }
@@ -821,10 +821,10 @@ static void initiate_domain_create(libxl__egc *egc,
  _config->b_info.exec_ssidref);
 if (ret) {
 if (errno == ENOSYS) {
-LOG(WARN, "XSM Disabled: seclabel not supported");
+LOGD(WARN, domid, "XSM Disabled: seclabel not supported");
 ret = 0;
 } else {
-LOG(ERROR, "Invalid seclabel: %s", s);
+LOGD(ERROR, domid, "Invalid seclabel: %s", s);
 goto error_out;
 }
 }
@@ -836,10 +836,11 @@ static void initiate_domain_create(libxl__egc *egc,
  
_config->b_info.device_model_ssidref);
 if (ret) {
 if (errno == ENOSYS) {
-LOG(WARN,"XSM Disabled: device_model_stubdomain_seclabel not 
supported");
+LOGD(WARN, domid,
+ "XSM Disabled: device_model_stubdomain_seclabel not 
supported");
 ret = 0;
 } else {
-LOG(ERROR, "Invalid device_model_stubdomain_seclabel: %s", s);
+LOGD(ERROR, domid, "Invalid device_model_stubdomain_seclabel: 
%s", s);
 goto error_out;
 }
 }
@@ -852,7 +853,8 @@ static void initiate_domain_create(libxl__egc *egc,
  NULL);
 }
 if (!libxl_cpupoolid_is_valid(ctx, d_config->c_info.poolid)) {
-LOG(ERROR, "Illegal pool 

[Xen-devel] [PATCH v2 03/35] libxl.c: switch to LOG*D use (refactored messages)

2016-11-17 Thread Cédric Bosdonnat
From: Cedric Bosdonnat 

Use LOG*D functions to output the domain ID in logs as much as
possible. This will help consumer code sorting the logs by
domain.

This commit, only changes LOG*() into LOG*D() and adds a domid
parameter. The message of these LOG* calls has been altered to
remove the domain id from it since it is already contained in
the output log string.

Signed-off-by: Cédric Bosdonnat 
---
 tools/libxl/libxl.c | 118 
 1 file changed, 55 insertions(+), 63 deletions(-)

diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index b5ff309..0ee7d9f 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -428,19 +428,16 @@ int libxl__domain_rename(libxl__gc *gc, uint32_t domid,
 if (old_name) {
 got_old_name = xs_read(ctx->xsh, trans, name_path, _old_len);
 if (!got_old_name) {
-LOGEV(ERROR, errno,
-  "check old name for domain %"PRIu32" allegedly named `%s'",
-  domid,
-  old_name);
+LOGEVD(ERROR, errno, domid,
+   "Check old name for domain allegedly named `%s'",
+   old_name);
 goto x_fail;
 }
 if (strcmp(old_name, got_old_name)) {
-LOG(ERROR,
-"domain %"PRIu32" allegedly named "
-"`%s' is actually named `%s' - racing ?",
-domid,
-old_name,
-got_old_name);
+LOGD(ERROR, domid,
+ "Allegedly named `%s' is actually named `%s' - racing ?",
+ old_name,
+ got_old_name);
 free(got_old_name);
 goto x_fail;
 }
@@ -448,12 +445,11 @@ int libxl__domain_rename(libxl__gc *gc, uint32_t domid,
 }
 if (!xs_write(ctx->xsh, trans, name_path,
   new_name, strlen(new_name))) {
-LOG(ERROR,
-"failed to write new name `%s'"
-" for domain %"PRIu32" previously named `%s'",
-new_name,
-domid,
-old_name);
+LOGD(ERROR, domid,
+ "Failed to write new name `%s'"
+ " for domain previously named `%s'",
+ new_name,
+ old_name);
 goto x_fail;
 }
 
@@ -482,20 +478,18 @@ int libxl__domain_rename(libxl__gc *gc, uint32_t domid,
 if (!xs_transaction_end(ctx->xsh, our_trans, 0)) {
 trans = our_trans = 0;
 if (errno != EAGAIN) {
-LOG(ERROR,
-"failed to commit new name `%s'"
-" for domain %"PRIu32" previously named `%s'",
-new_name,
-domid,
-old_name);
+LOGD(ERROR, domid,
+ "Failed to commit new name `%s'"
+ " for domain previously named `%s'",
+ new_name,
+ old_name);
 goto x_fail;
 }
-LOG(DEBUG,
-"need to retry rename transaction"
-" for domain %"PRIu32" (name_path=\"%s\", new_name=\"%s\")",
-domid,
-name_path,
-new_name);
+LOGD(DEBUG, domid,
+ "Need to retry rename transaction"
+ " for domain (name_path=\"%s\", new_name=\"%s\")",
+ name_path,
+ new_name);
 goto retry_transaction;
 }
 our_trans = 0;
@@ -987,7 +981,7 @@ int libxl_domain_core_dump(libxl_ctx *ctx, uint32_t domid,
 
 ret = xc_domain_dumpcore(ctx->xch, domid, filename);
 if (ret<0) {
-LOGE(ERROR, "core dumping domain %d to %s", domid, filename);
+LOGED(ERROR, domid, "Core dumping domain to %s", filename);
 rc = ERROR_FAIL;
 goto out;
 }
@@ -1016,15 +1010,15 @@ int libxl_domain_unpause(libxl_ctx *ctx, uint32_t domid)
 LIBXL_DEVICE_MODEL_VERSION_NONE) {
 rc = libxl__domain_resume_device_model(gc, domid);
 if (rc < 0) {
-LOG(ERROR, "failed to unpause device model for domain %u:%d",
-domid, rc);
+LOGD(ERROR, domid, "Failed to unpause device model for 
domain:%d",
+ rc);
 goto out;
 }
 }
 }
 ret = xc_domain_unpause(ctx->xch, domid);
 if (ret<0) {
-LOGE(ERROR, "unpausing domain %d", domid);
+LOGED(ERROR, domid, "Unpausing domain");
 rc = ERROR_FAIL;
 }
  out:
@@ -1573,7 +1567,7 @@ void libxl__destroy_domid(libxl__egc *egc, 
libxl__destroy_domid_state *dis)
 case 0:
 break;
 case ERROR_DOMAIN_NOTFOUND:
-LOG(ERROR, "non-existant domain %d", domid);
+LOGD(ERROR, domid, "Non-existant domain");
 default:
 goto out;
 }
@@ -1602,14 +1596,14 @@ void 

[Xen-devel] [PATCH v2 17/35] libxl/libxl_dom_suspend.c: used LOG*D functions

2016-11-17 Thread Cédric Bosdonnat
From: Cedric Bosdonnat 

Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat 
---
 tools/libxl/libxl_dom_suspend.c | 45 -
 1 file changed, 22 insertions(+), 23 deletions(-)

diff --git a/tools/libxl/libxl_dom_suspend.c b/tools/libxl/libxl_dom_suspend.c
index 0648919..d258a1c 100644
--- a/tools/libxl/libxl_dom_suspend.c
+++ b/tools/libxl/libxl_dom_suspend.c
@@ -54,7 +54,7 @@ int libxl__domain_suspend_init(libxl__egc *egc,
 domid, port, >guest_evtchn_lockfd);
 
 if (dsps->guest_evtchn.port < 0) {
-LOG(WARN, "Suspend event channel initialization failed");
+LOGD(WARN, domid, "Suspend event channel initialization failed");
 rc = ERROR_FAIL;
 goto out;
 }
@@ -77,7 +77,7 @@ int libxl__domain_suspend_device_model(libxl__gc *gc,
 
 switch (libxl__device_model_version_running(gc, domid)) {
 case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL: {
-LOG(DEBUG, "Saving device model state to %s", filename);
+LOGD(DEBUG, domid, "Saving device model state to %s", filename);
 libxl__qemu_traditional_cmd(gc, domid, "save");
 libxl__wait_for_device_model_deprecated(gc, domid, "paused", NULL, 
NULL, NULL);
 break;
@@ -154,11 +154,11 @@ static void domain_suspend_callback_common(libxl__egc 
*egc,
 }
 
 if ((hvm_s_state == 0) && (dsps->guest_evtchn.port >= 0)) {
-LOG(DEBUG, "issuing %s suspend request via event channel",
+LOGD(DEBUG, domid, "issuing %s suspend request via event channel",
 dsps->type == LIBXL_DOMAIN_TYPE_HVM ? "PVHVM" : "PV");
 ret = xenevtchn_notify(CTX->xce, dsps->guest_evtchn.port);
 if (ret < 0) {
-LOG(ERROR, "xenevtchn_notify failed ret=%d", ret);
+LOGD(ERROR, domid, "xenevtchn_notify failed ret=%d", ret);
 rc = ERROR_FAIL;
 goto err;
 }
@@ -176,10 +176,10 @@ static void domain_suspend_callback_common(libxl__egc 
*egc,
 }
 
 if (dsps->type == LIBXL_DOMAIN_TYPE_HVM && (!hvm_pvdrv || hvm_s_state)) {
-LOG(DEBUG, "Calling xc_domain_shutdown on HVM domain");
+LOGD(DEBUG, domid, "Calling xc_domain_shutdown on HVM domain");
 ret = xc_domain_shutdown(CTX->xch, domid, SHUTDOWN_suspend);
 if (ret < 0) {
-LOGE(ERROR, "xc_domain_shutdown failed");
+LOGED(ERROR, domid, "xc_domain_shutdown failed");
 rc = ERROR_FAIL;
 goto err;
 }
@@ -189,7 +189,7 @@ static void domain_suspend_callback_common(libxl__egc *egc,
 return;
 }
 
-LOG(DEBUG, "issuing %s suspend request via XenBus control node",
+LOGD(DEBUG, domid, "issuing %s suspend request via XenBus control node",
 dsps->type == LIBXL_DOMAIN_TYPE_HVM ? "PVHVM" : "PV");
 
 libxl__domain_pvcontrol_write(gc, XBT_NULL, domid, "suspend");
@@ -260,8 +260,8 @@ static void 
domain_suspend_common_pvcontrol_suspending(libxl__egc *egc,
 
 rc = libxl__xs_transaction_commit(gc, );
 if (!rc) {
-LOG(ERROR,
-"guest didn't acknowledge suspend, cancelling request");
+LOGD(ERROR, dsps->domid,
+ "guest didn't acknowledge suspend, cancelling request");
 goto err;
 }
 if (rc<0) goto err;
@@ -272,7 +272,7 @@ static void 
domain_suspend_common_pvcontrol_suspending(libxl__egc *egc,
 }
 
 assert(domain_suspend_pvcontrol_acked(state));
-LOG(DEBUG, "guest acknowledged suspend request");
+LOGD(DEBUG, dsps->domid, "guest acknowledged suspend request");
 
 libxl__xs_transaction_abort(gc, );
 dsps->guest_responded = 1;
@@ -291,7 +291,7 @@ static void domain_suspend_common_wait_guest(libxl__egc 
*egc,
 STATE_AO_GC(dsps->ao);
 int rc;
 
-LOG(DEBUG, "wait for the guest to suspend");
+LOGD(DEBUG, dsps->domid, "wait for the guest to suspend");
 
 rc = libxl__ev_xswatch_register(gc, >guest_watch,
 suspend_common_wait_guest_watch,
@@ -328,13 +328,12 @@ static void suspend_common_wait_guest_check(libxl__egc 
*egc,
 
 ret = xc_domain_getinfolist(CTX->xch, domid, 1, );
 if (ret < 0) {
-LOGE(ERROR, "unable to check for status of guest %"PRId32"", domid);
+LOGED(ERROR, domid, "unable to check for status of guest");
 goto err;
 }
 
 if (!(ret == 1 && info.domain == domid)) {
-LOGE(ERROR, "guest %"PRId32" we were suspending has been destroyed",
- domid);
+LOGED(ERROR, domid, "guest we were suspending has been destroyed");
 goto err;
 }
 
@@ -345,12 +344,12 @@ static void suspend_common_wait_guest_check(libxl__egc 
*egc,
 shutdown_reason = (info.flags >> XEN_DOMINF_shutdownshift)
 & XEN_DOMINF_shutdownmask;
 

[Xen-devel] [PATCH v2 12/35] libxl/libxl_colo_save.c: used LOG*D functions

2016-11-17 Thread Cédric Bosdonnat
From: Cedric Bosdonnat 

Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat 
---
 tools/libxl/libxl_colo_save.c | 49 ++-
 1 file changed, 25 insertions(+), 24 deletions(-)

diff --git a/tools/libxl/libxl_colo_save.c b/tools/libxl/libxl_colo_save.c
index 26b3afd..620 100644
--- a/tools/libxl/libxl_colo_save.c
+++ b/tools/libxl/libxl_colo_save.c
@@ -90,7 +90,7 @@ void libxl__colo_save_setup(libxl__egc *egc, 
libxl__colo_save_state *css)
 STATE_AO_GC(dss->ao);
 
 if (dss->type != LIBXL_DOMAIN_TYPE_HVM) {
-LOG(ERROR, "COLO only supports hvm now");
+LOGD(ERROR, dss->domid, "COLO only supports hvm now");
 goto out;
 }
 
@@ -122,8 +122,7 @@ void libxl__colo_save_setup(libxl__egc *egc, 
libxl__colo_save_state *css)
 libxl__stream_read_start(egc, >srs);
 css->cps.ao = ao;
 if (colo_proxy_setup(>cps)) {
-LOG(ERROR, "COLO: failed to setup colo proxy for guest with domid %u",
-cds->domid);
+LOGD(ERROR, cds->domid, "COLO: failed to setup colo proxy for guest");
 goto out;
 }
 
@@ -156,8 +155,7 @@ static void colo_save_setup_done(libxl__egc *egc,
 return;
 }
 
-LOG(ERROR, "COLO: failed to setup device for guest with domid %u",
-dss->domid);
+LOGD(ERROR, dss->domid, "COLO: failed to setup device for guest");
 cds->callback = colo_save_setup_failed;
 libxl__checkpoint_devices_teardown(egc, cds);
 }
@@ -171,8 +169,9 @@ static void colo_save_setup_failed(libxl__egc *egc,
 STATE_AO_GC(cds->ao);
 
 if (rc)
-LOG(ERROR, "COLO: failed to teardown device after setup failed"
-" for guest with domid %u, rc %d", cds->domid, rc);
+LOGD(ERROR, cds->domid,
+ "COLO: failed to teardown device after setup failed"
+ " for guest, rc %d", rc);
 
 cleanup_device_subkind(cds);
 dss->callback(egc, dss, rc);
@@ -192,8 +191,9 @@ void libxl__colo_save_teardown(libxl__egc *egc,
 
 EGC_GC;
 
-LOG(WARN, "COLO: Domain suspend terminated with rc %d,"
-" teardown COLO devices...", rc);
+LOGD(WARN, dss->domid,
+ "COLO: Domain suspend terminated with rc %d,"
+ " teardown COLO devices...", rc);
 
 libxl__stream_read_abort(egc, >srs, 1);
 
@@ -268,7 +268,7 @@ static void colo_suspend_primary_vm_done(libxl__egc *egc,
 EGC_GC;
 
 if (rc) {
-LOG(ERROR, "cannot suspend primary vm");
+LOGD(ERROR, dss->domid, "cannot suspend primary vm");
 goto out;
 }
 
@@ -294,7 +294,7 @@ static void colo_postsuspend_cb(libxl__egc *egc,
 EGC_GC;
 
 if (rc) {
-LOG(ERROR, "postsuspend fails");
+LOGD(ERROR, dss->domid, "postsuspend fails");
 goto out;
 }
 
@@ -326,13 +326,14 @@ static void colo_read_svm_suspended_done(libxl__egc *egc,
 EGC_GC;
 
 if (id != CHECKPOINT_SVM_SUSPENDED) {
-LOG(ERROR, "invalid section: %d, expected: %d", id,
+LOGD(ERROR, dss->domid, "invalid section: %d, expected: %d", id,
 CHECKPOINT_SVM_SUSPENDED);
 goto out;
 }
 
 if (!css->paused && libxl__qmp_get_replication_error(gc, dss->domid)) {
-LOG(ERROR, "replication error occurs when primary vm is running");
+LOGD(ERROR, dss->domid,
+ "replication error occurs when primary vm is running");
 goto out;
 }
 
@@ -405,7 +406,7 @@ static void colo_read_svm_ready_done(libxl__egc *egc,
 EGC_GC;
 
 if (id != CHECKPOINT_SVM_READY) {
-LOG(ERROR, "invalid section: %d, expected: %d", id,
+LOGD(ERROR, dss->domid, "invalid section: %d, expected: %d", id,
 CHECKPOINT_SVM_READY);
 goto out;
 }
@@ -432,13 +433,13 @@ static void colo_preresume_cb(libxl__egc *egc,
 EGC_GC;
 
 if (rc) {
-LOG(ERROR, "preresume fails");
+LOGD(ERROR, dss->domid, "preresume fails");
 goto out;
 }
 
 if (css->qdisk_used && !css->qdisk_setuped) {
 if (libxl__qmp_start_replication(gc, dss->domid, true)) {
-LOG(ERROR, "starting replication fails");
+LOGD(ERROR, dss->domid, "starting replication fails");
 goto out;
 }
 css->qdisk_setuped = true;
@@ -446,14 +447,14 @@ static void colo_preresume_cb(libxl__egc *egc,
 
 if (!css->paused) {
 if (libxl__qmp_do_checkpoint(gc, dss->domid)) {
-LOG(ERROR, "doing checkpoint fails");
+LOGD(ERROR, dss->domid, "doing checkpoint fails");
 goto out;
 }
 }
 
 /* Resumes the domain and the device model */
 if (libxl__domain_resume(gc, dss->domid, /* Fast Suspend */1)) {
-LOG(ERROR, "cannot resume primary vm");
+LOGD(ERROR, dss->domid, "cannot resume primary vm");
 goto out;
 }
 
@@ -464,7 +465,7 @@ static void colo_preresume_cb(libxl__egc *egc,
 if 

[Xen-devel] [PATCH v2 21/35] libxl/libxl_netbsd.c: used LOG*D functions

2016-11-17 Thread Cédric Bosdonnat
From: Cedric Bosdonnat 

Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat 
---
 tools/libxl/libxl_netbsd.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/tools/libxl/libxl_netbsd.c b/tools/libxl/libxl_netbsd.c
index a79b8aa..2edfb00 100644
--- a/tools/libxl/libxl_netbsd.c
+++ b/tools/libxl/libxl_netbsd.c
@@ -42,7 +42,8 @@ static int libxl__hotplug(libxl__gc *gc, libxl__device *dev, 
char ***args,
 script = libxl__xs_read(gc, XBT_NULL,
 GCSPRINTF("%s/%s", be_path, "script"));
 if (!script) {
-LOGEV(ERROR, errno, "unable to read script from %s", be_path);
+LOGEVD(ERROR, errno, dev->domid,
+   "unable to read script from %s", be_path);
 rc = ERROR_FAIL;
 goto out;
 }
@@ -69,7 +70,8 @@ int libxl__get_hotplug_script_info(libxl__gc *gc, 
libxl__device *dev,
 switch (dev->backend_kind) {
 case LIBXL__DEVICE_KIND_VBD:
 if (num_exec != 0) {
-LOG(DEBUG, "num_exec %d, not running hotplug scripts", num_exec);
+LOGD(DEBUG, dev->domid,
+ "num_exec %d, not running hotplug scripts", num_exec);
 rc = 0;
 goto out;
 }
@@ -86,7 +88,8 @@ int libxl__get_hotplug_script_info(libxl__gc *gc, 
libxl__device *dev,
  */
 if ((num_exec != 0) ||
 (libxl_get_stubdom_id(CTX, dev->domid) && num_exec)) {
-LOG(DEBUG, "num_exec %d, not running hotplug scripts", num_exec);
+LOGD(DEBUG, dev->domid,
+ "num_exec %d, not running hotplug scripts", num_exec);
 rc = 0;
 goto out;
 }
-- 
2.10.1


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH v2 05/35] libxl/libxl_bootloader.c: used LOG*D functions

2016-11-17 Thread Cédric Bosdonnat
From: Cedric Bosdonnat 

Use LOG*D functions to output the domain ID in logs as much as
possible. This will help consumer code sorting the logs by
domain.

Signed-off-by: Cédric Bosdonnat 
---
 tools/libxl/libxl_bootloader.c | 84 --
 1 file changed, 49 insertions(+), 35 deletions(-)

diff --git a/tools/libxl/libxl_bootloader.c b/tools/libxl/libxl_bootloader.c
index 2cfc8cf..c7c2012 100644
--- a/tools/libxl/libxl_bootloader.c
+++ b/tools/libxl/libxl_bootloader.c
@@ -99,7 +99,7 @@ static int setup_xenconsoled_pty(libxl__egc *egc, 
libxl__bootloader_state *bl,
 
 r = ttyname_r(slave, slave_path, slave_path_len);
 if (r == -1) {
-LOGE(ERROR,"ttyname_r failed");
+LOGED(ERROR, bl->domid, "ttyname_r failed");
 rc = ERROR_FAIL;
 goto out;
 }
@@ -125,7 +125,7 @@ static int setup_xenconsoled_pty(libxl__egc *egc, 
libxl__bootloader_state *bl,
 }
 
 static const char *bootloader_result_command(libxl__gc *gc, const char *buf,
- const char *prefix, size_t prefixlen) {
+ const char *prefix, size_t prefixlen, uint32_t domid) 
{
 if (strncmp(buf, prefix, prefixlen))
 return 0;
 
@@ -136,7 +136,7 @@ static const char *bootloader_result_command(libxl__gc *gc, 
const char *buf,
 while (CTYPE(isspace,*rhs))
 rhs++;
 
-LOG(DEBUG,"bootloader output contained %s %s", prefix, rhs);
+LOGD(DEBUG, domid, "bootloader output contained %s %s", prefix, rhs);
 
 return rhs;
 }
@@ -151,7 +151,8 @@ static int parse_bootloader_result(libxl__egc *egc,
 
 f = fopen(bl->outputpath, "r");
 if (!f) {
-LOGE(ERROR,"open bootloader output file %s", bl->outputpath);
+LOGED(ERROR, bl->domid, "open bootloader output file %s",
+  bl->outputpath);
 goto out;
 }
 
@@ -166,21 +167,22 @@ static int parse_bootloader_result(libxl__egc *egc,
 }
 if (c == EOF) {
 if (ferror(f)) {
-LOGE(ERROR,"read bootloader output file %s", bl->outputpath);
+LOGED(ERROR, bl->domid, "read bootloader output file %s",
+  bl->outputpath);
 goto out;
 }
 if (!l)
 break;
 }
 if (l >= sizeof(buf)) {
-LOG(WARN,"bootloader output contained"
-" overly long item `%.150s...'", buf);
+LOGD(WARN, bl->domid, "bootloader output contained"
+ " overly long item `%.150s...'", buf);
 continue;
 }
 buf[l] = 0;
 
 const char *rhs;
-#define COMMAND(s) ((rhs = bootloader_result_command(gc, buf, s, sizeof(s)-1)))
+#define COMMAND(s) ((rhs = bootloader_result_command(gc, buf, s, sizeof(s)-1, 
bl->domid)))
 
 if (COMMAND("kernel")) {
 bl->kernel->path = libxl__strdup(gc, rhs);
@@ -193,7 +195,8 @@ static int parse_bootloader_result(libxl__egc *egc,
 } else if (COMMAND("args")) {
 bl->cmdline = libxl__strdup(gc, rhs);
 } else if (l) {
-LOG(WARN, "unexpected output from bootloader: `%s'", buf);
+LOGD(WARN, bl->domid,
+ "unexpected output from bootloader: `%s'", buf);
 }
 }
 rc = 0;
@@ -276,7 +279,8 @@ static void bootloader_local_detached_cb(libxl__egc *egc,
 libxl__bootloader_state *bl = CONTAINER_OF(dls, *bl, dls);
 
 if (rc) {
-LOG(ERROR, "unable to detach locally attached disk");
+LOGD(ERROR, bl->domid,
+ "unable to detach locally attached disk");
 if (!bl->rc)
 bl->rc = rc;
 }
@@ -295,8 +299,8 @@ static void bootloader_stop(libxl__egc *egc,
 libxl__datacopier_kill(>display);
 if (libxl__ev_child_inuse(>child)) {
 r = kill(bl->child.pid, SIGTERM);
-if (r) LOGE(WARN, "%sfailed to kill bootloader [%lu]",
-rc ? "after failure, " : "", (unsigned long)bl->child.pid);
+if (r) LOGED(WARN, bl->domid, "%sfailed to kill bootloader [%lu]",
+ rc ? "after failure, " : "", (unsigned 
long)bl->child.pid);
 }
 if (!bl->rc)
 bl->rc = rc;
@@ -321,13 +325,14 @@ void libxl__bootloader_run(libxl__egc *egc, 
libxl__bootloader_state *bl)
 libxl__bootloader_init(bl);
 
 if (info->type != LIBXL_DOMAIN_TYPE_PV) {
-LOG(DEBUG, "not a PV domain, skipping bootloader");
+LOGD(DEBUG, domid, "not a PV domain, skipping bootloader");
 rc = 0;
 goto out_ok;
 }
 
 if (!info->u.pv.bootloader) {
-LOG(DEBUG, "no bootloader configured, using user supplied kernel");
+LOGD(DEBUG, domid,
+ "no bootloader configured, using user supplied kernel");
 bl->kernel->path = bl->info->kernel;
 bl->ramdisk->path = bl->info->ramdisk;
 bl->cmdline = bl->info->cmdline;
@@ -336,7 +341,7 @@ void 

[Xen-devel] [PATCH v2 09/35] libxl/libxl_colo_proxy.c: used LOG*D functions

2016-11-17 Thread Cédric Bosdonnat
From: Cedric Bosdonnat 

Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat 
---
 tools/libxl/libxl_colo_proxy.c | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/tools/libxl/libxl_colo_proxy.c b/tools/libxl/libxl_colo_proxy.c
index d4b73ee..0983f42 100644
--- a/tools/libxl/libxl_colo_proxy.c
+++ b/tools/libxl/libxl_colo_proxy.c
@@ -69,7 +69,7 @@ static int colo_proxy_send(libxl__colo_proxy_state *cps, 
uint8_t *buff,
 
 ret = sendmsg(cps->sock_fd, , 0);
 if (ret <= 0) {
-LOG(ERROR, "can't send msg to kernel by netlink: %s",
+LOGD(ERROR, ao->domid, "can't send msg to kernel by netlink: %s",
 strerror(errno));
 }
 
@@ -108,7 +108,7 @@ next:
 ret = recvmsg(cps->sock_fd, , 0);
 if (ret <= 0) {
 if (errno != EAGAIN && errno != EWOULDBLOCK)
-LOGE(ERROR, "can't recv msg from kernel by netlink");
+LOGED(ERROR, ao->domid, "can't recv msg from kernel by netlink");
 goto err;
 }
 
@@ -154,7 +154,7 @@ int colo_proxy_setup(libxl__colo_proxy_state *cps)
 
 skfd = socket(PF_NETLINK, SOCK_RAW, NETLINK_COLO);
 if (skfd < 0) {
-LOG(ERROR, "can not create a netlink socket: %s", strerror(errno));
+LOGD(ERROR, ao->domid, "can not create a netlink socket: %s", 
strerror(errno));
 goto out;
 }
 cps->sock_fd = skfd;
@@ -165,16 +165,16 @@ retry:
 sa.nl_pid = i++;
 
 if (i > 10) {
-LOG(ERROR, "netlink bind error");
+LOGD(ERROR, ao->domid, "netlink bind error");
 goto out;
 }
 
 ret = bind(skfd, (struct sockaddr *), sizeof(sa));
 if (ret < 0 && errno == EADDRINUSE) {
-LOG(ERROR, "colo index %d has already in used", sa.nl_pid);
+LOGD(ERROR, ao->domid, "colo index %d has already in used", sa.nl_pid);
 goto retry;
 } else if (ret < 0) {
-LOG(ERROR, "netlink bind error");
+LOGD(ERROR, ao->domid, "netlink bind error");
 goto out;
 }
 
@@ -186,8 +186,8 @@ retry:
 /* receive ack */
 size = colo_proxy_recv(cps, , 50);
 if (size < 0) {
-LOG(ERROR, "Can't recv msg from kernel by netlink: %s",
-strerror(errno));
+LOGD(ERROR, ao->domid, "Can't recv msg from kernel by netlink: %s",
+ strerror(errno));
 goto out;
 }
 
@@ -198,12 +198,12 @@ retry:
 struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(h);
 
 if (size - sizeof(*h) < sizeof(*err)) {
-LOG(ERROR, "NLMSG_LENGTH is too short");
+LOGD(ERROR, ao->domid, "NLMSG_LENGTH is too short");
 goto out;
 }
 
 if (err->error) {
-LOG(ERROR, "NLMSG_ERROR contains error %d", err->error);
+LOGD(ERROR, ao->domid, "NLMSG_ERROR contains error %d", 
err->error);
 goto out;
 }
 }
@@ -271,12 +271,12 @@ int colo_proxy_checkpoint(libxl__colo_proxy_state *cps,
 h = (struct nlmsghdr *) buff;
 
 if (h->nlmsg_type == NLMSG_ERROR) {
-LOG(ERROR, "receive NLMSG_ERROR");
+LOGD(ERROR, ao->domid, "receive NLMSG_ERROR");
 goto out;
 }
 
 if (h->nlmsg_len < NLMSG_LENGTH(sizeof(*m))) {
-LOG(ERROR, "NLMSG_LENGTH is too short");
+LOGD(ERROR, ao->domid, "NLMSG_LENGTH is too short");
 goto out;
 }
 
-- 
2.10.1


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH v2 06/35] libxl/libxl_checkpoint_device.c: used LOG*D functions

2016-11-17 Thread Cédric Bosdonnat
From: Cedric Bosdonnat 

Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat 
---
 tools/libxl/libxl_checkpoint_device.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/tools/libxl/libxl_checkpoint_device.c 
b/tools/libxl/libxl_checkpoint_device.c
index 0a16dbb..01e74b5 100644
--- a/tools/libxl/libxl_checkpoint_device.c
+++ b/tools/libxl/libxl_checkpoint_device.c
@@ -132,7 +132,7 @@ static void device_setup_iterate(libxl__egc *egc, 
libxl__ao_device *aodev)
 if (!dev->ops) {
 libxl_device_nic * nic = NULL;
 libxl_device_disk * disk = NULL;
-uint32_t domid;
+uint32_t domid = INVALID_DOMID;
 int devid;
 if (dev->kind == LIBXL__DEVICE_KIND_VIF) {
 nic = (libxl_device_nic *)dev->backend_dev;
@@ -143,15 +143,15 @@ static void device_setup_iterate(libxl__egc *egc, 
libxl__ao_device *aodev)
 domid = disk->backend_domid;
 devid = libxl__device_disk_dev_number(disk->vdev, NULL, NULL);
 } else {
-LOG(ERROR,"device kind not handled by checkpoint: %s",
-libxl__device_kind_to_string(dev->kind));
+LOGD(ERROR, domid, "device kind not handled by checkpoint: %s",
+ libxl__device_kind_to_string(dev->kind));
 aodev->rc = ERROR_FAIL;
 goto out;
 }
-LOG(ERROR,"device not handled by checkpoint"
-" (device=%s:%"PRId32"/%"PRId32")",
-libxl__device_kind_to_string(dev->kind),
-domid, devid);
+LOGD(ERROR, domid, "device not handled by checkpoint"
+ " (device=%s:%"PRId32"/%"PRId32")",
+ libxl__device_kind_to_string(dev->kind),
+ domid, devid);
 aodev->rc = ERROR_CHECKPOINT_DEVICE_NOT_SUPPORTED;
 goto out;
 }
-- 
2.10.1


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH v2 01/35] libxl: add LIBXL_LOGD_* and LOG*D function families.

2016-11-17 Thread Cédric Bosdonnat
From: Cedric Bosdonnat 

These functions should be used to log messages when the domain
id is known. libxl__log will now prepend the log message by
"Domain %PRIu32:" if the domain id is a valid one.

This aims at helping consumers filter logs on domain IDs.

Signed-off-by: Cédric Bosdonnat 
---
  v2:
* use the domid from ao or its parent if any.
* fix style
* remove useless write of 0 at the end of snprintf result.
---
 tools/libxl/libxl_event.c| 10 +++---
 tools/libxl/libxl_internal.c | 16 ++--
 tools/libxl/libxl_internal.h | 38 +++---
 3 files changed, 48 insertions(+), 16 deletions(-)

diff --git a/tools/libxl/libxl_event.c b/tools/libxl/libxl_event.c
index 02b39e6..484f9ba 100644
--- a/tools/libxl/libxl_event.c
+++ b/tools/libxl/libxl_event.c
@@ -1362,7 +1362,7 @@ void libxl__event_disaster(libxl__egc *egc, const char 
*msg, int errnoval,
 {
 EGC_GC;
 
-libxl__log(CTX, XTL_CRITICAL, errnoval, file, line, func,
+libxl__log(CTX, XTL_CRITICAL, errnoval, file, line, func, INVALID_DOMID,
"DISASTER in event loop: %s%s%s%s",
msg,
type ? " (relates to event type " : "",
@@ -1943,7 +1943,7 @@ libxl__ao *libxl__ao_create(libxl_ctx *ctx, uint32_t 
domid,
 ao->poller = libxl__poller_get(>gc);
 if (!ao->poller) goto out;
 }
-libxl__log(ctx,XTL_DEBUG,-1,file,line,func,
+libxl__log(ctx,XTL_DEBUG,-1,file,line,func,domid,
"ao %p: create: how=%p callback=%p poller=%p",
ao, how, ao->how.callback, ao->poller);
 
@@ -1962,13 +1962,17 @@ int libxl__ao_inprogress(libxl__ao *ao,
 {
 AO_GC;
 int rc;
+uint32_t domid = ao->domid;
 
 assert(ao->magic == LIBXL__AO_MAGIC);
 assert(ao->constructing);
 assert(ao->in_initiator);
 ao->constructing = 0;
 
-libxl__log(CTX,XTL_DEBUG,-1,file,line,func,
+if (ao->nested_root)
+domid = ao->nested_root->domid;
+
+libxl__log(CTX,XTL_DEBUG,-1,file,line,func,domid,
"ao %p: inprogress: poller=%p, flags=%s%s%s%s",
ao, ao->poller,
ao->constructing ? "o" : "",
diff --git a/tools/libxl/libxl_internal.c b/tools/libxl/libxl_internal.c
index 448dd61..c270a24 100644
--- a/tools/libxl/libxl_internal.c
+++ b/tools/libxl/libxl_internal.c
@@ -22,7 +22,7 @@ void libxl__alloc_failed(libxl_ctx *ctx, const char *func,
 #define M "libxl: FATAL ERROR: memory allocation failure"
 #define L (size ? M " (%s, %lu x %lu)\n" : M " (%s)\n"), \
   func, (unsigned long)nmemb, (unsigned long)size
-libxl__log(ctx, XTL_CRITICAL, ENOMEM, 0,0, func, L);
+libxl__log(ctx, XTL_CRITICAL, ENOMEM, 0,0, func, INVALID_DOMID, L);
 fprintf(stderr, L);
 fflush(stderr);
 _exit(-1);
@@ -202,7 +202,7 @@ char *libxl__dirname(libxl__gc *gc, const char *s)
 
 void libxl__logv(libxl_ctx *ctx, xentoollog_level msglevel, int errnoval,
  const char *file, int line, const char *func,
- const char *fmt, va_list ap)
+ uint32_t domid, const char *fmt, va_list ap)
 {
 /* WARNING this function may not call any libxl-provided
  * memory allocation function, as those may
@@ -211,6 +211,7 @@ void libxl__logv(libxl_ctx *ctx, xentoollog_level msglevel, 
int errnoval,
 char *base = NULL;
 int rc, esave;
 char fileline[256];
+char domain[256];
 
 esave = errno;
 
@@ -221,22 +222,25 @@ void libxl__logv(libxl_ctx *ctx, xentoollog_level 
msglevel, int errnoval,
 if (file) snprintf(fileline, sizeof(fileline), "%s:%d",file,line);
 fileline[sizeof(fileline)-1] = 0;
 
+domain[0] = 0;
+if (domid != INVALID_DOMID)
+snprintf(domain, sizeof(domain), "Domain %"PRIu32":", domid);
  x:
 xtl_log(ctx->lg, msglevel, errnoval, "libxl",
-"%s%s%s%s" "%s",
+"%s%s%s%s%s" "%s",
 fileline, func&?":":"", func?func:"", func||file?": ":"",
-base);
+domain, base);
 if (base != enomem) free(base);
 errno = esave;
 }
 
 void libxl__log(libxl_ctx *ctx, xentoollog_level msglevel, int errnoval,
 const char *file, int line, const char *func,
-const char *fmt, ...)
+uint32_t domid, const char *fmt, ...)
 {
 va_list ap;
 va_start(ap, fmt);
-libxl__logv(ctx, msglevel, errnoval, file, line, func, fmt, ap);
+libxl__logv(ctx, msglevel, errnoval, file, line, func, domid, fmt, ap);
 va_end(ap);
 }
 
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index 8366fee..5f46578 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -152,13 +152,22 @@
 #define LIBXL__LOGGING_ENABLED
 
 #ifdef LIBXL__LOGGING_ENABLED
-#define LIBXL__LOG(ctx, loglevel, _f, _a...)   libxl__log(ctx, loglevel, -1, 
__FILE__, __LINE__, __func__, _f, ##_a)
-#define LIBXL__LOG_ERRNO(ctx, loglevel, _f, _a...)   libxl__log(ctx, 

[Xen-devel] [PATCH v2 02/35] libxl.c: switch to LOG*D use

2016-11-17 Thread Cédric Bosdonnat
From: Cedric Bosdonnat 

Use LOG*D functions to output the domain ID in logs as much as
possible. This will help consumer code sorting the logs by
domain.

libxl.c changes have been split into 3 commits to help review
them and isolate more instances that could be problematic.

This commit, only changes LOG*() into LOG*D() and adds a domid
parameter.

Signed-off-by: Cédric Bosdonnat 
---
 tools/libxl/libxl.c | 302 ++--
 1 file changed, 153 insertions(+), 149 deletions(-)

diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index 33c5e4c..b5ff309 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -394,13 +394,13 @@ int libxl__domain_rename(libxl__gc *gc, uint32_t domid,
 if (!trans) {
 trans = our_trans = xs_transaction_start(ctx->xsh);
 if (!our_trans) {
-LOGEV(ERROR, errno, "create xs transaction for domain (re)name");
+LOGEVD(ERROR, errno, domid, "Create xs transaction for domain 
(re)name");
 goto x_fail;
 }
 }
 
 if (!new_name) {
-LOG(ERROR, "new domain name not specified");
+LOGD(ERROR, domid, "New domain name not specified");
 rc = ERROR_INVAL;
 goto x_rc;
 }
@@ -412,14 +412,14 @@ int libxl__domain_rename(libxl__gc *gc, uint32_t domid,
 if (rc == ERROR_INVAL) {
 /* no such domain, good */
 } else if (rc != 0) {
-LOG(ERROR, "unexpected error checking for existing domain");
+LOGD(ERROR, domid, "Unexpected error checking for existing 
domain");
 goto x_rc;
 } else if (domid_e == domid) {
 /* domain already has this name, ok (but we do still
  * need the rest of the code as we may need to check
  * old_name, for example). */
 } else {
-LOG(ERROR, "domain with name \"%s\" already exists.", new_name);
+LOGD(ERROR, domid, "Domain with name \"%s\" already exists.", 
new_name);
 rc = ERROR_INVAL;
 goto x_rc;
 }
@@ -473,7 +473,7 @@ int libxl__domain_rename(libxl__gc *gc, uint32_t domid,
   stub_dm_new_name,
   trans);
 if (rc) {
-LOGE(ERROR, "unable to rename stub-domain");
+LOGED(ERROR, domid, "Unable to rename stub-domain");
 goto x_rc;
 }
 }
@@ -678,7 +678,7 @@ int libxl_domain_info(libxl_ctx *ctx, libxl_dominfo *info_r,
 
 ret = xc_domain_getinfolist(ctx->xch, domid, 1, );
 if (ret<0) {
-LOGE(ERROR, "getting domain info list");
+LOGED(ERROR, domid, "Getting domain info list");
 GC_FREE;
 return ERROR_FAIL;
 }
@@ -842,7 +842,7 @@ int libxl_domain_remus_start(libxl_ctx *ctx, 
libxl_domain_remus_info *info,
 
 /* The caller must set this defbool */
 if (libxl_defbool_is_default(info->colo)) {
-LOG(ERROR, "colo mode must be enabled/disabled");
+LOGD(ERROR, domid, "Colo mode must be enabled/disabled");
 rc = ERROR_FAIL;
 goto out;
 }
@@ -856,7 +856,8 @@ int libxl_domain_remus_start(libxl_ctx *ctx, 
libxl_domain_remus_info *info,
 
 if (libxl_defbool_val(info->colo) &&
 libxl_defbool_val(info->compression)) {
-LOG(ERROR, "cannot use memory checkpoint compression in COLO 
mode");
+LOGD(ERROR, domid, "Cannot use memory checkpoint "
+"compression in COLO mode");
 rc = ERROR_FAIL;
 goto out;
 }
@@ -865,8 +866,8 @@ int libxl_domain_remus_start(libxl_ctx *ctx, 
libxl_domain_remus_info *info,
 (libxl_defbool_val(info->blackhole) ||
  !libxl_defbool_val(info->netbuf) ||
  !libxl_defbool_val(info->diskbuf))) {
-LOG(ERROR, "Unsafe mode must be enabled to replicate to /dev/null,"
-   "disable network buffering and disk replication");
+LOGD(ERROR, domid, "Unsafe mode must be enabled to replicate to 
/dev/null,"
+"disable network buffering and disk replication");
 rc = ERROR_FAIL;
 goto out;
 }
@@ -969,7 +970,7 @@ int libxl_domain_pause(libxl_ctx *ctx, uint32_t domid)
 GC_INIT(ctx);
 ret = xc_domain_pause(ctx->xch, domid);
 if (ret<0) {
-LOGE(ERROR, "pausing domain %d", domid);
+LOGED(ERROR, domid, "Pausing domain");
 GC_FREE;
 return ERROR_FAIL;
 }
@@ -1047,7 +1048,7 @@ int libxl__domain_pvcontrol_available(libxl__gc *gc, 
uint32_t domid)
 
 ret = xc_hvm_param_get(ctx->xch, domid, HVM_PARAM_CALLBACK_IRQ, );
 if (ret<0) {
-LOGE(ERROR, "getting HVM callback IRQ");
+LOGED(ERROR, domid, "Getting HVM callback IRQ");
 return ERROR_FAIL;
 }
 return !!pvdriver;
@@ -1649,10 +1650,10 @@ static void devices_destroy_cb(libxl__egc *egc,
 vm_path = libxl__xs_read(gc, XBT_NULL, 

Re: [Xen-devel] [PATCH V4] xen/arm: domain_build: allocate lowmem for dom0 as much as possible

2016-11-17 Thread Stefano Stabellini
On Wed, 16 Nov 2016, Andrii Anisov wrote:
> > For example, take a look at PVCalls which is entirely based on data
> > copies:
> >
> > http://marc.info/?l=xen-devel=147639616310487
> >
> >
> > I have already shown that it performs better than netfront/netback on
> > x86 in this blog post:
> >
> > https://blog.xenproject.org/2016/08/30/pv-calls-a-new-paravirtualized-protocol-for-posix-syscalls/
> >
> >
> > I have just run the numbers on ARM64 (APM m400) and it is still much
> > faster than netfront/netback. This is what I get by running iperf -c in
> > a VM and iperf -s in Dom0:
> >
> > PVCalls Netfront/Netback
> > -P 19.9 gbit/s  4.53 gbit/s
> > -P 217.4 gbit/s 5.57 gbit/s
> > -P 424.36 gbit/s5.34 gbit/s
> >
> > PVCalls is still significantly faster than Netfront/Netback.
> This seems to be not a really fair comparison. And does not reflect
> performance impact of the data copying itself.

Why it is not a fair comparison? Because the design is different or
because of the settings? I am happy to adjust benchmarking settings to
make the comparison fairer.


> Among all, our team is working on PV DRM implementation now. I guess
> the first implementation would have a data copying, then we will
> introduce a zero-copy. So it should be a good example to collect and
> share impact numbers.

Looking forward to them.


> In embedded applications area, we are currently focused on, acceptable
> performance drop, f.e. for io operations, is estimated as 3-5%
> comparing to bare-metal system.

That's very interesting info and certainly a difficult mark to reach.


> Anyway thank you for your comments, suggestions and examples.
> I've got the point that we have to have solid reasoning baked with
> pack of numbers to get something specific to us accepted by community.

Cheers,

Stefano

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] Xen ARM small task (WAS: Re: [Xen Question])

2016-11-17 Thread Stefano Stabellini
On Mon, 14 Nov 2016, Julien Grall wrote:
> Hi Stefano,
> 
> On 11/11/2016 13:55, Stefano Stabellini wrote:
> > On Fri, 11 Nov 2016, Julien Grall wrote:
> > > Hi Stefano,
> > > 
> > > On 11/11/2016 02:24, Stefano Stabellini wrote:
> > > > On Thu, 10 Nov 2016, Julien Grall wrote:
> > > > > (CC Stefano and change the title)
> > > > > 
> > > > > Hello,
> > > > > 
> > > > > On 10/11/16 12:13, casionwoo wrote:
> > > > > > I’m pleased about your reply and you have a lot of code to clean-up.
> > > > > > 
> > > > > > As you mentioned, It’s really huge to digest at once. Thank you for
> > > > > > understanding me.
> > > > > > 
> > > > > > And that’s why i need a small fix up and todo list.
> > > > > > 
> > > > > > I feel familiar with ARM and c language and there’s no specific area
> > > > > > yet.
> > > > > > 
> > > > > > I think that i can find interesting area with following up the
> > > > > > codes.
> > > > > > 
> > > > > > I’m looking forward to being stuck on Xen.
> > > > > > 
> > > > > > Then it would be easier for me to understand about Xen on ARM.
> > > > > > 
> > > > > > Please let me know the TODO and bug-fix lists.
> > > > > 
> > > > > Stefano, before giving a list of code clean-up, do you have any small
> > > > > TODO
> > > > > on
> > > > > ARM in mind?
> > > > 
> > > > A simple task we talked about recently is to enable the vuart
> > > > (xen/arch/arm/vuart.c) for all guests. At the moment it is only emulated
> > > > for Dom0, but some guests, in particular BareMetal guests
> > > > (https://en.wikipedia.org/wiki/BareMetal), would benefit from it.
> > > > 
> > > > It would be best to introduce an option in libxl to explicitly
> > > > enable/disable the vuart for DomUs. Something like vuart=1 in the VM
> > > > config file.
> > > 
> > > The vuart has not been enabled for DomU because it the UART region may
> > > clash
> > > with the guest memory layout (which is static).
> > > 
> > > I don't think this option should be available until we allow the guest to
> > > use
> > > the same memory layout as the host (see e820_host parameter for x86).
> > 
> > Actually there is no reason for the vuart to use the same address as
> > the physical uart on the platform, is there?
> > In fact it doesn't even
> > have to prentend to be the same uart as the one on the board, right?
> > The vuart MMIO address could be completely configurable and independent
> > from the one of the physical uart.
> 
> There is no reason to use the same information as the physical UART.
> 
> However, the vuart requires quite a few information (e.g base address, offset
> of different register... see vuart_info structure in include/xen/serial.h for
> more details) in order to fully work.
> 
> IHMO this is a lot of works for the user to configure. I would much prefer to
> see a PL011 emulated at a specific base address and let the user select
> whether he wants a UART to debug or not.

So you envision the configuration of the MMIO base address to be done as
part of a new dynamic guest memory map?___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] [RFC PATCH 5/9] x86/HVM/SVM: Add AVIC initialization code

2016-11-17 Thread Konrad Rzeszutek Wilk
On Thu, Nov 17, 2016 at 10:55:52AM -0600, Suravee Suthikulpanit wrote:
> Konrad,
> 
> On 10/12/16 15:02, Konrad Rzeszutek Wilk wrote:
> > > +
> > > > +/* NOTE: Current max index allowed for physical APIC ID table is 255 */
> > > > +#define AVIC_PHY_APIC_ID_MAX0xFF
> > > > +
> > > > +#define AVIC_DOORBELL   0xc001011b
> > > > +#define AVIC_HPA_MASK   ~((0xFFFULL << 52) || 0xFFF)
> > > > +#define AVIC_APIC_BAR_MASK  0xFF000ULL
> > > > +
> > > > +bool_t svm_avic = 0;
> > > > +boolean_param("svm-avic", svm_avic);
> > Why do you want to have it disabled by default?
> 
> svm-avic has not yet fully supported with nested virtualization yet. So, I
> didn't want to enable this by default. However, when everything is stable, I
> am planning to enable this by default.

Ah, could you put an comment above the param to explain this?
Thanks!

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] [RFC PATCH 5/9] x86/HVM/SVM: Add AVIC initialization code

2016-11-17 Thread Konrad Rzeszutek Wilk
On Thu, Nov 17, 2016 at 10:05:58AM -0600, Suravee Suthikulpanit wrote:
> Konrad,
> 
> Thanks for the review comments. Got one quick question below.
> 
> On 10/12/16 15:02, Konrad Rzeszutek Wilk wrote:
> > > +int svm_avic_init_vmcb(struct vcpu *v)
> > > > +{
> > > > +paddr_t ma;
> > > > +u32 apic_id_reg;
> > > > +struct arch_svm_struct *s = >arch.hvm_svm;
> > > > +struct vmcb_struct *vmcb = s->vmcb;
> > > > +struct svm_domain *d = >domain->arch.hvm_domain.svm;
> > > > +struct svm_avic_phy_ait_entry entry;
> > > > +
> > > > +if ( !svm_avic )
> > > > +return 0;
> > > > +
> > > > +vmcb->avic_bk_pg_pa = page_to_maddr(s->avic_bk_pg) & AVIC_HPA_MASK;
> > > > +ma = d->avic_log_ait_mfn;
> > > > +vmcb->avic_log_apic_id = (ma << PAGE_SHIFT) & AVIC_HPA_MASK;
> > > > +ma = d->avic_phy_ait_mfn;
> > > > +vmcb->avic_phy_apic_id = (ma << PAGE_SHIFT) & AVIC_HPA_MASK;
> > > > +vmcb->avic_phy_apic_id |= AVIC_PHY_APIC_ID_MAX;
> > > > +
> > > > +dprintk(XENLOG_DEBUG, "SVM: %s: bpa=%#llx, lpa=%#llx, ppa=%#llx\n",
> > I think you can drop the 'SVM:' part. The __func__ gives enough details.
> > 
> > > > +   __func__, (unsigned long long)vmcb->avic_bk_pg_pa,
> > > > +   (unsigned long long) vmcb->avic_log_apic_id,
> > > > +   (unsigned long long) vmcb->avic_phy_apic_id);
> > Is this also part of the keyboard handler? Perhaps that information should
> > be presented there?
> 
> I'm not sure what you mean by keyboard handler. I assume you mean the
> spacing for the indentation the front should align with above line?

Well I would ditch them. And if you really want them then make the
keyboard handler, aka svm_vmcb_dump function.
> 
> Thanks,
> S.

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [ovmf test] 102355: all pass - PUSHED

2016-11-17 Thread osstest service owner
flight 102355 ovmf real [real]
http://logs.test-lab.xenproject.org/osstest/logs/102355/

Perfect :-)
All tests in this flight passed as required
version targeted for testing:
 ovmf 2048ab4b3ec966183eb87d93d9cdab05fe9cc840
baseline version:
 ovmf e242cdfb307a6dfe2c0f75c4719f5c1f6b418625

Last test of basis   102292  2016-11-16 08:17:51 Z1 days
Failing since102298  2016-11-16 11:44:14 Z1 days8 attempts
Testing same since   102355  2016-11-17 15:14:16 Z0 days1 attempts


People who touched revisions under test:
  Eric Dong 
  Jeff Fan 
  Jiaxin Wu 
  Jiewen Yao 
  Laszlo Ersek 
  Liming Gao 
  Qin Long 
  Star Zeng 

jobs:
 build-amd64-xsm  pass
 build-i386-xsm   pass
 build-amd64  pass
 build-i386   pass
 build-amd64-libvirt  pass
 build-i386-libvirt   pass
 build-amd64-pvopspass
 build-i386-pvops pass
 test-amd64-amd64-xl-qemuu-ovmf-amd64 pass
 test-amd64-i386-xl-qemuu-ovmf-amd64  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 :

+ branch=ovmf
+ revision=2048ab4b3ec966183eb87d93d9cdab05fe9cc840
+ . ./cri-lock-repos
++ . ./cri-common
+++ . ./cri-getconfig
+++ umask 002
+++ getrepos
 getconfig Repos
 perl -e '
use Osstest;
readglobalconfig();
print $c{"Repos"} or die $!;
'
+++ local repos=/home/osstest/repos
+++ '[' -z /home/osstest/repos ']'
+++ '[' '!' -d /home/osstest/repos ']'
+++ echo /home/osstest/repos
++ repos=/home/osstest/repos
++ repos_lock=/home/osstest/repos/lock
++ '[' x '!=' x/home/osstest/repos/lock ']'
++ OSSTEST_REPOS_LOCK_LOCKED=/home/osstest/repos/lock
++ exec with-lock-ex -w /home/osstest/repos/lock ./ap-push ovmf 
2048ab4b3ec966183eb87d93d9cdab05fe9cc840
+ branch=ovmf
+ revision=2048ab4b3ec966183eb87d93d9cdab05fe9cc840
+ . ./cri-lock-repos
++ . ./cri-common
+++ . ./cri-getconfig
+++ umask 002
+++ getrepos
 getconfig Repos
 perl -e '
use Osstest;
readglobalconfig();
print $c{"Repos"} or die $!;
'
+++ local repos=/home/osstest/repos
+++ '[' -z /home/osstest/repos ']'
+++ '[' '!' -d /home/osstest/repos ']'
+++ echo /home/osstest/repos
++ repos=/home/osstest/repos
++ repos_lock=/home/osstest/repos/lock
++ '[' x/home/osstest/repos/lock '!=' x/home/osstest/repos/lock ']'
+ . ./cri-common
++ . ./cri-getconfig
++ umask 002
+ select_xenbranch
+ case "$branch" in
+ tree=ovmf
+ xenbranch=xen-unstable
+ '[' xovmf = xlinux ']'
+ linuxbranch=
+ '[' x = x ']'
+ qemuubranch=qemu-upstream-unstable
+ select_prevxenbranch
++ ./cri-getprevxenbranch xen-unstable
+ prevxenbranch=xen-4.7-testing
+ '[' x2048ab4b3ec966183eb87d93d9cdab05fe9cc840 = x ']'
+ : tested/2.6.39.x
+ . ./ap-common
++ : osst...@xenbits.xen.org
+++ getconfig OsstestUpstream
+++ perl -e '
use Osstest;
readglobalconfig();
print $c{"OsstestUpstream"} or die $!;
'
++ :
++ : git://xenbits.xen.org/xen.git
++ : osst...@xenbits.xen.org:/home/xen/git/xen.git
++ : git://xenbits.xen.org/qemu-xen-traditional.git
++ : git://git.kernel.org
++ : git://git.kernel.org/pub/scm/linux/kernel/git
++ : git
++ : git://xenbits.xen.org/xtf.git
++ : osst...@xenbits.xen.org:/home/xen/git/xtf.git
++ : git://xenbits.xen.org/xtf.git
++ : git://xenbits.xen.org/libvirt.git
++ : osst...@xenbits.xen.org:/home/xen/git/libvirt.git
++ : git://xenbits.xen.org/libvirt.git
++ : git://xenbits.xen.org/osstest/rumprun.git
++ : git
++ : git://xenbits.xen.org/osstest/rumprun.git
++ : osst...@xenbits.xen.org:/home/xen/git/osstest/rumprun.git
++ : git://git.seabios.org/seabios.git
++ : osst...@xenbits.xen.org:/home/xen/git/osstest/seabios.git
++ : git://xenbits.xen.org/osstest/seabios.git
++ : https://github.com/tianocore/edk2.git
++ : 

[Xen-devel] [xen-unstable test] 102338: tolerable FAIL - PUSHED

2016-11-17 Thread osstest service owner
flight 102338 xen-unstable real [real]
http://logs.test-lab.xenproject.org/osstest/logs/102338/

Failures :-/ but no regressions.

Tests which are failing intermittently (not blocking):
 test-armhf-armhf-libvirt-xsm  6 xen-boot fail in 102318 pass in 102338
 test-armhf-armhf-xl-cubietruck 15 guest-start/debian.repeat fail in 102318 
pass in 102338
 test-amd64-i386-xl-raw   10 guest-startfail pass in 102318
 test-armhf-armhf-libvirt 15 guest-start/debian.repeat  fail pass in 102318
 test-armhf-armhf-xl-rtds 15 guest-start/debian.repeat  fail pass in 102318

Regressions which are regarded as allowable (not blocking):
 test-armhf-armhf-libvirt-xsm 13 saverestore-support-checkfail  like 102286
 test-amd64-i386-xl-qemuu-win7-amd64 16 guest-stop fail like 102286
 test-armhf-armhf-libvirt-qcow2 12 saverestore-support-check   fail like 102286
 test-armhf-armhf-libvirt-raw 12 saverestore-support-checkfail  like 102286
 test-amd64-amd64-xl-qemuu-win7-amd64 16 guest-stopfail like 102286
 test-amd64-i386-xl-qemut-win7-amd64 16 guest-stop fail like 102286
 test-amd64-amd64-xl-qemut-win7-amd64 16 guest-stopfail like 102286
 test-armhf-armhf-libvirt 13 saverestore-support-checkfail  like 102286
 test-amd64-amd64-xl-rtds  9 debian-install   fail  like 102286

Tests which did not succeed, but are not blocking:
 test-amd64-amd64-xl-pvh-intel 11 guest-start  fail  never pass
 test-amd64-amd64-libvirt 12 migrate-support-checkfail   never pass
 test-amd64-i386-libvirt  12 migrate-support-checkfail   never pass
 test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm 10 migrate-support-check 
fail never pass
 test-amd64-amd64-libvirt-xsm 12 migrate-support-checkfail   never pass
 test-amd64-amd64-xl-pvh-amd  11 guest-start  fail   never pass
 test-amd64-amd64-libvirt-vhd 11 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-arndale  12 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-arndale  13 saverestore-support-checkfail   never pass
 test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm 10 migrate-support-check 
fail never pass
 test-amd64-amd64-qemuu-nested-amd 16 debian-hvm-install/l1/l2  fail never pass
 test-amd64-i386-libvirt-xsm  12 migrate-support-checkfail   never pass
 test-armhf-armhf-libvirt-xsm 12 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-credit2  12 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-credit2  13 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl  12 migrate-support-checkfail   never pass
 test-armhf-armhf-xl  13 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl-cubietruck 12 migrate-support-checkfail never pass
 test-armhf-armhf-xl-cubietruck 13 saverestore-support-checkfail never pass
 test-armhf-armhf-xl-multivcpu 12 migrate-support-checkfail  never pass
 test-armhf-armhf-xl-multivcpu 13 saverestore-support-checkfail  never pass
 test-armhf-armhf-libvirt-qcow2 11 migrate-support-checkfail never pass
 test-armhf-armhf-xl-xsm  12 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-xsm  13 saverestore-support-checkfail   never pass
 test-armhf-armhf-libvirt-raw 11 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-rtds 12 migrate-support-checkfail   never pass
 test-armhf-armhf-libvirt 12 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-rtds 13 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl-vhd  11 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-vhd  12 saverestore-support-checkfail   never pass

version targeted for testing:
 xen  160e12899212f6f666fe38781fc5911fe9f8ad35
baseline version:
 xen  632ff7847a398a9d0de988633cfe180e5116ec32

Last test of basis   102286  2016-11-16 05:08:18 Z1 days
Failing since102302  2016-11-16 13:42:55 Z1 days3 attempts
Testing same since   102318  2016-11-16 21:49:51 Z0 days2 attempts


People who touched revisions under test:
  Andrew Cooper 
  Boris Ostrovsky 
  Jan Beulich 
  Kevin Tian 

jobs:
 build-amd64-xsm  pass
 build-armhf-xsm  pass
 build-i386-xsm   pass
 build-amd64-xtf  pass
 build-amd64  pass
 build-armhf  pass
 build-i386  

Re: [Xen-devel] [RFC PATCH 5/9] x86/HVM/SVM: Add AVIC initialization code

2016-11-17 Thread Suravee Suthikulpanit

Konrad,

On 10/12/16 15:02, Konrad Rzeszutek Wilk wrote:

+
> +/* NOTE: Current max index allowed for physical APIC ID table is 255 */
> +#define AVIC_PHY_APIC_ID_MAX0xFF
> +
> +#define AVIC_DOORBELL   0xc001011b
> +#define AVIC_HPA_MASK   ~((0xFFFULL << 52) || 0xFFF)
> +#define AVIC_APIC_BAR_MASK  0xFF000ULL
> +
> +bool_t svm_avic = 0;
> +boolean_param("svm-avic", svm_avic);

Why do you want to have it disabled by default?


svm-avic has not yet fully supported with nested virtualization yet. So, 
I didn't want to enable this by default. However, when everything is 
stable, I am planning to enable this by default.


Thanks,
Suravee

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] Request for a repo on xenbits for the XenProject Openstack CI Loop

2016-11-17 Thread Anthony PERARD
On Thu, Nov 17, 2016 at 04:34:16PM +, Ian Jackson wrote:
> Anthony PERARD writes ("Request for a repo on xenbits for the XenProject 
> Openstack CI Loop"):
> > I would like a new repo on xenbits to hold the configuration of our
> > OpenStack CI loop. Its name could be:
> > git://xenbits.xen.org/openstack-ci-loop-config.git
> 
> I am happy with this.  But there may be more openstack things.  How
> about
>   git://xenbits.xen.org/openstack/ci-loop-config.git
> ?

That would be fine with me.

Thanks,

-- 
Anthony PERARD

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH 01/35] libxl: add LIBXL_LOGD_* and LOG*D function families.

2016-11-17 Thread Wei Liu
On Thu, Nov 17, 2016 at 04:36:54PM +, Ian Jackson wrote:
> Wei Liu writes ("Re: [PATCH 01/35] libxl: add LIBXL_LOGD_* and LOG*D function 
> families."):
> > Oh, yes. I misunderstood. In that case libxl_is_stubdom could be handy.
> 
> How about this: check whether the ao is a nested ao, and if so, fish
> the domid out of its parent ?
> 

Yes, this is better than calling libxl_is_stubdom.

> Ian.

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH 01/35] libxl: add LIBXL_LOGD_* and LOG*D function families.

2016-11-17 Thread Ian Jackson
Wei Liu writes ("Re: [PATCH 01/35] libxl: add LIBXL_LOGD_* and LOG*D function 
families."):
> Oh, yes. I misunderstood. In that case libxl_is_stubdom could be handy.

How about this: check whether the ao is a nested ao, and if so, fish
the domid out of its parent ?

Ian.

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH 01/35] libxl: add LIBXL_LOGD_* and LOG*D function families.

2016-11-17 Thread Wei Liu
On Thu, Nov 17, 2016 at 04:29:35PM +, Ian Jackson wrote:
> Cedric Bosdonnat writes ("Re: [PATCH 01/35] libxl: add LIBXL_LOGD_* and LOG*D 
> function families."):
> > On Thu, 2016-11-17 at 14:41 +, Wei Liu wrote:
> > > You should be able to use ao->domid here, right?
> > 
> > Oh indeed. I discovered this one after writing this patch and forgot
> > about it here. Could it be possible that ao->domid is not the publicly
> > known domain id?
> 
> I think it might conceivably sometimes be a stubdom id.  That depends
> on who sets it when and whether they make a nested ao for a stubdom...
> 

Oh, yes. I misunderstood. In that case libxl_is_stubdom could be handy.

> Ian.

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] Request for a repo on xenbits for the XenProject Openstack CI Loop

2016-11-17 Thread Ian Jackson
Anthony PERARD writes ("Request for a repo on xenbits for the XenProject 
Openstack CI Loop"):
> I would like a new repo on xenbits to hold the configuration of our
> OpenStack CI loop. Its name could be:
> git://xenbits.xen.org/openstack-ci-loop-config.git

I am happy with this.  But there may be more openstack things.  How
about
  git://xenbits.xen.org/openstack/ci-loop-config.git
?

Thanks,
Ian.

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] Request for a repo on xenbits for the XenProject Openstack CI Loop

2016-11-17 Thread Anthony PERARD
Hi,

I would like a new repo on xenbits to hold the configuration of our
OpenStack CI loop. Its name could be:
git://xenbits.xen.org/openstack-ci-loop-config.git

Right now, the repo is at
https://github.com/citrix-openstack/os-ext-testing
The repo contain everything needed if someone wanted to redeploy the ci
loop on rackspace (and might work elsewhere).

about the ci loop:
https://wiki.xen.org/wiki/OpenStack_CI_Loop_for_Xen-Libvirt

Thanks,

-- 
Anthony PERARD

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH 04/35] libxl.c: switch to LOG*D use

2016-11-17 Thread Ian Jackson
Cedric Bosdonnat writes ("Re: [PATCH 04/35] libxl.c: switch to LOG*D use"):
> On Thu, 2016-11-17 at 14:50 +, Wei Liu wrote:
> > The only thing I don't understand is why you had patch 2-4 for libxl.c.
> > These three patches can probably be merged into one patch.
> 
> That was to ease the review by isolating the cases that could be problematic.
> But I'll resubmit them merged together then.

I think splitting things up is slightly nicer.  You can explain the
split in the commit messages.  But please don't bother splitting it
out again if you've already merged it

Thanks,
Ian.

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH 01/35] libxl: add LIBXL_LOGD_* and LOG*D function families.

2016-11-17 Thread Ian Jackson
Cedric Bosdonnat writes ("Re: [PATCH 01/35] libxl: add LIBXL_LOGD_* and LOG*D 
function families."):
> On Thu, 2016-11-17 at 14:41 +, Wei Liu wrote:
> > You should be able to use ao->domid here, right?
> 
> Oh indeed. I discovered this one after writing this patch and forgot
> about it here. Could it be possible that ao->domid is not the publicly
> known domain id?

I think it might conceivably sometimes be a stubdom id.  That depends
on who sets it when and whether they make a nested ao for a stubdom...

Ian.

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] [XTF PATCH] Add a Live Patch privilege check test

2016-11-17 Thread Andrew Cooper
On 17/11/16 15:40, Ross Lagerwall wrote:
> +typedef struct {
> +union {
> +void *p;
> +uint64_t __attribute__((aligned(8))) q;
> +};
> +} guest_handle_64;
> +
> +#define XEN_SYSCTL_INTERFACE_VERSION 0x000E

/sigh

This is going to require some rethinking.  We cannot have the unstable
ABI versions baked into the header files, as the tests wont function on
older versions of Xen.

The sysctl ABI is actually fixed.  The struct is always 136 bytes long,
and has two uint32_t's at the top.  XTF needs a library function to
probe which interface version is accepted by Xen.

The livepatch layout is also fixed, so the sysctl version isn't actually
relevant.

> diff --git a/include/xtf/hypercall.h b/include/xtf/hypercall.h
> index a37ebc2..75c0e9d 100644
> --- a/include/xtf/hypercall.h
> +++ b/include/xtf/hypercall.h
> @@ -34,6 +34,7 @@ extern uint8_t hypercall_page[PAGE_SIZE];
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  
> @@ -114,6 +115,11 @@ static inline long hypercall_hvm_op(unsigned int cmd, 
> void *arg)
>  return HYPERCALL2(long, __HYPERVISOR_hvm_op, cmd, arg);
>  }
>  
> +static inline long hypercall_sysctl(void *arg)

xen_sysctl_t * please.

> +{
> +return HYPERCALL1(long, __HYPERVISOR_sysctl, arg);
> +}
> +
>  /*
>   * Higher level hypercall helpers
>   */
> diff --git a/tests/livepatch-priv-check/Makefile 
> b/tests/livepatch-priv-check/Makefile
> new file mode 100644
> index 000..e27b9da
> --- /dev/null
> +++ b/tests/livepatch-priv-check/Makefile
> @@ -0,0 +1,9 @@
> +include $(ROOT)/build/common.mk
> +
> +NAME  := livepatch-priv-check
> +CATEGORY  := functional
> +TEST-ENVS := $(ALL_ENVIRONMENTS)
> +
> +obj-perenv += main.o
> +
> +include $(ROOT)/build/gen.mk
> diff --git a/tests/livepatch-priv-check/main.c 
> b/tests/livepatch-priv-check/main.c
> new file mode 100644
> index 000..357e4da
> --- /dev/null
> +++ b/tests/livepatch-priv-check/main.c
> @@ -0,0 +1,144 @@
> +/**
> + * @file tests/livepatch-priv-check/main.c
> + * @ref test-livepatch-priv-check
> + *
> + * @page test-livepatch-priv-check Live Patch Privilege Check
> + *
> + * Checks that Xen prevents using all live patching operations and
> + * sub-operations from an unprivileged guest.
> + *
> + * @see tests/livepatch-check-priv/main.c
> + */
> +#include 
> +
> +static void check_ret(int rc)
> +{
> +switch ( rc )
> +{
> +case -EPERM:
> +xtf_success("Xen correctly denied Live Patch calls\n");
> +break;

Newlines after breaks please.

Also, a quirk of multiple sub-tests like this is that you shouldn't call
xtf_success multiple times.  It can end up incorrectly declaring success
if a logical bug caused you to skip part of the test logic.

Use printk here, and have a single xtf_success() as the final action in
test_main().

> +case -ENOSYS:
> +xtf_skip("Live Patch support not detected\n");
> +break;
> +case 0:
> +xtf_failure("Live Patch call succeeded\n");
> +break;

I find it is helpful to manually prefix the strings with "Fail: ".  It
helps visually distinguish the logging if there is a mix of steps with
different results.

> +default:
> +xtf_failure("Unexpected error %d\n", rc);
> +break;

This should be xtf_error().

~Andrew

> +}
> +}
> +
>


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH 04/35] libxl.c: switch to LOG*D use

2016-11-17 Thread Wei Liu
On Thu, Nov 17, 2016 at 05:03:03PM +0100, Cedric Bosdonnat wrote:
> On Thu, 2016-11-17 at 14:50 +, Wei Liu wrote:
> > On Tue, Nov 15, 2016 at 11:18:42AM +0100, Cédric Bosdonnat wrote:
> > > Use LOG*D functions to output the domain ID in logs as much as
> > > possible. This will help consumer code sorting the logs by
> > > domain.
> > > 
> > > This commit includes all LOG* to LOG*D changes where the domain
> > > ID is not just a domid variable. We want the domain ID provided
> > > to the LOG*D functions to be the one of the publicly known
> > > domain, not a stubdom one.
> > > 
> > > Signed-off-by: Cédric Bosdonnat 
> > 
> > I skimmed through the rest of this series. The code looks good to me.
> > 
> > The only thing I don't understand is why you had patch 2-4 for libxl.c.
> > These three patches can probably be merged into one patch.
> 
> That was to ease the review by isolating the cases that could be problematic.
> But I'll resubmit them merged together then.
> 

In that case please keep them separated.

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH 01/35] libxl: add LIBXL_LOGD_* and LOG*D function families.

2016-11-17 Thread Wei Liu
On Thu, Nov 17, 2016 at 05:01:08PM +0100, Cedric Bosdonnat wrote:
> On Thu, 2016-11-17 at 14:41 +, Wei Liu wrote:
> > On Tue, Nov 15, 2016 at 11:18:39AM +0100, Cédric Bosdonnat wrote:
> > > From: Cédric Bosdonnat 
> > > 
> > > These functions should be used to log messages when the domain
> > > id is known. libxl__log will now prepend the log message by
> > > "Domain %PRIu32:" if the domain id is a valid one.
> > > 
> > > This aims at helping consumers filter logs on domain IDs.
> > > 
> > > Signed-off-by: Cédric Bosdonnat 
> > > ---
> > >  tools/libxl/libxl_event.c|  6 +++---
> > >  tools/libxl/libxl_internal.c | 16 ++--
> > >  tools/libxl/libxl_internal.h | 38 +++---
> > >  3 files changed, 44 insertions(+), 16 deletions(-)
> > > 
> > > diff --git a/tools/libxl/libxl_event.c b/tools/libxl/libxl_event.c
> > > index 02b39e6..fc9bdc9 100644
> > > --- a/tools/libxl/libxl_event.c
> > > +++ b/tools/libxl/libxl_event.c
> > > @@ -1362,7 +1362,7 @@ void libxl__event_disaster(libxl__egc *egc, const 
> > > char *msg, int errnoval,
> > >  {
> > >  EGC_GC;
> > >  
> > > -libxl__log(CTX, XTL_CRITICAL, errnoval, file, line, func,
> > > +libxl__log(CTX, XTL_CRITICAL, errnoval, file, line, func, 
> > > INVALID_DOMID,
> > > "DISASTER in event loop: %s%s%s%s",
> > > msg,
> > > type ? " (relates to event type " : "",
> > > @@ -1943,7 +1943,7 @@ libxl__ao *libxl__ao_create(libxl_ctx *ctx, 
> > > uint32_t domid,
> > >  ao->poller = libxl__poller_get(>gc);
> > >  if (!ao->poller) goto out;
> > >  }
> > > -libxl__log(ctx,XTL_DEBUG,-1,file,line,func,
> > > +libxl__log(ctx,XTL_DEBUG,-1,file,line,func,domid,
> > > "ao %p: create: how=%p callback=%p poller=%p",
> > > ao, how, ao->how.callback, ao->poller);
> > >  
> > > @@ -1968,7 +1968,7 @@ int libxl__ao_inprogress(libxl__ao *ao,
> > >  assert(ao->in_initiator);
> > >  ao->constructing = 0;
> > >  
> > > -libxl__log(CTX,XTL_DEBUG,-1,file,line,func,
> > > +libxl__log(CTX,XTL_DEBUG,-1,file,line,func,INVALID_DOMID,
> > 
> > You should be able to use ao->domid here, right?
> 
> Oh indeed. I discovered this one after writing this patch and forgot
> about it here. Could it be possible that ao->domid is not the publicly
> known domain id?

I think it is the publicly known domain id -- it was initialised in
libxl__ao_create which got domid from caller.

Wei.

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH v2] xen/gntdev: Use mempolicy instead of VM_IO flag to avoid NUMA balancing

2016-11-17 Thread Boris Ostrovsky
On 11/17/2016 11:01 AM, Olaf Hering wrote:
> On Thu, Nov 17, Boris Ostrovsky wrote:
>
>> On 11/17/2016 06:28 AM, Olaf Hering wrote:
>>> ERROR: "__mpol_dup" [drivers/xen/xen-gntdev.ko] undefined!
>>> ERROR: "get_task_policy" [drivers/xen/xen-gntdev.ko] undefined!
>> I just built 4.4.11 with this patch applied and haven't had any problems.
> Are these functions exported? How would the driver module call into the
> core kernel? Maybe the added functionality should be provided by an
> exported helper function.

You are right --- I didn't realize was building with grant device
built-in. So yes, this needs to be fixed.

-boris



signature.asc
Description: OpenPGP digital signature
___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] [RFC PATCH 5/9] x86/HVM/SVM: Add AVIC initialization code

2016-11-17 Thread Suravee Suthikulpanit

Konrad,

Thanks for the review comments. Got one quick question below.

On 10/12/16 15:02, Konrad Rzeszutek Wilk wrote:

+int svm_avic_init_vmcb(struct vcpu *v)
> +{
> +paddr_t ma;
> +u32 apic_id_reg;
> +struct arch_svm_struct *s = >arch.hvm_svm;
> +struct vmcb_struct *vmcb = s->vmcb;
> +struct svm_domain *d = >domain->arch.hvm_domain.svm;
> +struct svm_avic_phy_ait_entry entry;
> +
> +if ( !svm_avic )
> +return 0;
> +
> +vmcb->avic_bk_pg_pa = page_to_maddr(s->avic_bk_pg) & AVIC_HPA_MASK;
> +ma = d->avic_log_ait_mfn;
> +vmcb->avic_log_apic_id = (ma << PAGE_SHIFT) & AVIC_HPA_MASK;
> +ma = d->avic_phy_ait_mfn;
> +vmcb->avic_phy_apic_id = (ma << PAGE_SHIFT) & AVIC_HPA_MASK;
> +vmcb->avic_phy_apic_id |= AVIC_PHY_APIC_ID_MAX;
> +
> +dprintk(XENLOG_DEBUG, "SVM: %s: bpa=%#llx, lpa=%#llx, ppa=%#llx\n",

I think you can drop the 'SVM:' part. The __func__ gives enough details.


> +   __func__, (unsigned long long)vmcb->avic_bk_pg_pa,
> +   (unsigned long long) vmcb->avic_log_apic_id,
> +   (unsigned long long) vmcb->avic_phy_apic_id);

Is this also part of the keyboard handler? Perhaps that information should
be presented there?


I'm not sure what you mean by keyboard handler. I assume you mean the 
spacing for the indentation the front should align with above line?


Thanks,
S.

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] ACPI fixmap overflow

2016-11-17 Thread Alex Thorlton
On Thu, Nov 17, 2016 at 10:01:15AM -0500, Boris Ostrovsky wrote:
> On 11/16/2016 05:08 AM, Jan Beulich wrote:
>  On 15.11.16 at 21:51,  wrote:
> >> On 11/15/2016 03:44 PM, Andrew Cooper wrote:
> >>> On 15/11/2016 20:39, Boris Ostrovsky wrote:
>  On 11/15/2016 02:45 PM, Andrew Cooper wrote:
> > On 15/11/16 19:34, Boris Ostrovsky wrote:
> >> In addition to running out of e820 entries on that large machine that
> >> Alex was referring to in [0] he is also running out of ACPI fixmap 
> >> space
> >> while parsing MADT (the box has *lots* of processors). The
> >> quick-and-dirty solution is to increase NUM_FIXMAP_ACPI_PAGES but I
> >> wonder whether we should move to dynamic memory allocation.
> > Why do we use fixmap anyway?  It doesn't look too hard to reorder
> > vm_init() slightly higher, and be able to use ioremap() for all APCI 
> > tables.
>  Hmm... Let me see how possible this is. Just moving it up won't work
>  since heap allocator is initialized after ACPI tables.
> >>> We have plenty of usable PTEs already allocated at boot, mainly from the
> >>> init pagetables.  Given a static __init vm_bitmap, a new boot-time-only
> >>> vm range should be usable without any heap allocations at all.
> >> Wouldn't that (using pre-allocated PTEs), in a way, be equivalent to
> >> increasing fixmap size?
> > Indeed. For the time being I think growing the fixmap should be
> > fine. Clearly it being a fixed 4 pages has been wrong for a long
> > time - there's no point in it being smaller than MAX_LOCAL_APIC
> > x2apic entries, plus min(MAX_LOCAL_APIC, 256) lapic ones, plus
> > MAX_IO_APICS ioapic ones etc.
> >
> > Otoh the actual parsing of MADT happens after the heap allocator
> > has been initialized. The only earlier use is via acpi_table_init() ->
> > check_multiple_madt(); acpi_initialize_tables() doesn't appear to
> > map full tables. And check_multiple_madt() not being able to map
> > the full table would not prevent boot from continuing afaics. So
> > Andrew's suggestion to switch to dynamic mapping earlier would
> > still seem to be possible (and then preferred). In fact
> > acpi_boot_init() already gets called after vm_init(), so switching
> > acpi_os_map_memory() to use dynamic mappings when
> >> = SYS_STATE_boot should already work today (on x86 at least,
> > not sure about ARM).
> 
> Yes, switching to ioremap on SYS_STATE_boot seems to work. I asked Alex
> to test this on OVM (which is 4.4-based).

FYI, I'm going to get this done a little later today.  I'll let you know
how it worked out this evening!

- Alex

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH 04/35] libxl.c: switch to LOG*D use

2016-11-17 Thread Cedric Bosdonnat
On Thu, 2016-11-17 at 14:50 +, Wei Liu wrote:
> On Tue, Nov 15, 2016 at 11:18:42AM +0100, Cédric Bosdonnat wrote:
> > Use LOG*D functions to output the domain ID in logs as much as
> > possible. This will help consumer code sorting the logs by
> > domain.
> > 
> > This commit includes all LOG* to LOG*D changes where the domain
> > ID is not just a domid variable. We want the domain ID provided
> > to the LOG*D functions to be the one of the publicly known
> > domain, not a stubdom one.
> > 
> > Signed-off-by: Cédric Bosdonnat 
> 
> I skimmed through the rest of this series. The code looks good to me.
> 
> The only thing I don't understand is why you had patch 2-4 for libxl.c.
> These three patches can probably be merged into one patch.

That was to ease the review by isolating the cases that could be problematic.
But I'll resubmit them merged together then.

> Another thing is the From: field email address differs from patch to
> patch. That's probably ok to you, but I think I should point that out in
> case SuSE require you to always use your @suse.com address to
> contribute.

Hum, I though I've fixed those, I'll need to check them again before resending.

--
Cedric

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH v2] xen/gntdev: Use mempolicy instead of VM_IO flag to avoid NUMA balancing

2016-11-17 Thread Olaf Hering
On Thu, Nov 17, Boris Ostrovsky wrote:

> On 11/17/2016 06:28 AM, Olaf Hering wrote:
> > ERROR: "__mpol_dup" [drivers/xen/xen-gntdev.ko] undefined!
> > ERROR: "get_task_policy" [drivers/xen/xen-gntdev.ko] undefined!
> I just built 4.4.11 with this patch applied and haven't had any problems.

Are these functions exported? How would the driver module call into the
core kernel? Maybe the added functionality should be provided by an
exported helper function.

Olaf


signature.asc
Description: PGP signature
___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH 01/35] libxl: add LIBXL_LOGD_* and LOG*D function families.

2016-11-17 Thread Cedric Bosdonnat
On Thu, 2016-11-17 at 14:41 +, Wei Liu wrote:
> On Tue, Nov 15, 2016 at 11:18:39AM +0100, Cédric Bosdonnat wrote:
> > From: Cédric Bosdonnat 
> > 
> > These functions should be used to log messages when the domain
> > id is known. libxl__log will now prepend the log message by
> > "Domain %PRIu32:" if the domain id is a valid one.
> > 
> > This aims at helping consumers filter logs on domain IDs.
> > 
> > Signed-off-by: Cédric Bosdonnat 
> > ---
> >  tools/libxl/libxl_event.c|  6 +++---
> >  tools/libxl/libxl_internal.c | 16 ++--
> >  tools/libxl/libxl_internal.h | 38 +++---
> >  3 files changed, 44 insertions(+), 16 deletions(-)
> > 
> > diff --git a/tools/libxl/libxl_event.c b/tools/libxl/libxl_event.c
> > index 02b39e6..fc9bdc9 100644
> > --- a/tools/libxl/libxl_event.c
> > +++ b/tools/libxl/libxl_event.c
> > @@ -1362,7 +1362,7 @@ void libxl__event_disaster(libxl__egc *egc, const 
> > char *msg, int errnoval,
> >  {
> >  EGC_GC;
> >  
> > -libxl__log(CTX, XTL_CRITICAL, errnoval, file, line, func,
> > +libxl__log(CTX, XTL_CRITICAL, errnoval, file, line, func, 
> > INVALID_DOMID,
> > "DISASTER in event loop: %s%s%s%s",
> > msg,
> > type ? " (relates to event type " : "",
> > @@ -1943,7 +1943,7 @@ libxl__ao *libxl__ao_create(libxl_ctx *ctx, uint32_t 
> > domid,
> >  ao->poller = libxl__poller_get(>gc);
> >  if (!ao->poller) goto out;
> >  }
> > -libxl__log(ctx,XTL_DEBUG,-1,file,line,func,
> > +libxl__log(ctx,XTL_DEBUG,-1,file,line,func,domid,
> > "ao %p: create: how=%p callback=%p poller=%p",
> > ao, how, ao->how.callback, ao->poller);
> >  
> > @@ -1968,7 +1968,7 @@ int libxl__ao_inprogress(libxl__ao *ao,
> >  assert(ao->in_initiator);
> >  ao->constructing = 0;
> >  
> > -libxl__log(CTX,XTL_DEBUG,-1,file,line,func,
> > +libxl__log(CTX,XTL_DEBUG,-1,file,line,func,INVALID_DOMID,
> 
> You should be able to use ao->domid here, right?

Oh indeed. I discovered this one after writing this patch and forgot
about it here. Could it be possible that ao->domid is not the publicly
known domain id?

> > "ao %p: inprogress: poller=%p, flags=%s%s%s%s",
> > ao, ao->poller,
> > ao->constructing ? "o" : "",
> > diff --git a/tools/libxl/libxl_internal.c b/tools/libxl/libxl_internal.c
> > index 448dd61..78ed2f6 100644
> > --- a/tools/libxl/libxl_internal.c
> > +++ b/tools/libxl/libxl_internal.c
> > @@ -22,7 +22,7 @@ void libxl__alloc_failed(libxl_ctx *ctx, const char *func,
> >  #define M "libxl: FATAL ERROR: memory allocation failure"
> >  #define L (size ? M " (%s, %lu x %lu)\n" : M " (%s)\n"), \
> >    func, (unsigned long)nmemb, (unsigned long)size
> > -libxl__log(ctx, XTL_CRITICAL, ENOMEM, 0,0, func, L);
> > +libxl__log(ctx, XTL_CRITICAL, ENOMEM, 0,0, func, INVALID_DOMID, L);
> >  fprintf(stderr, L);
> >  fflush(stderr);
> >  _exit(-1);
> > @@ -202,7 +202,7 @@ char *libxl__dirname(libxl__gc *gc, const char *s)
> >  
> >  void libxl__logv(libxl_ctx *ctx, xentoollog_level msglevel, int errnoval,
> >   const char *file, int line, const char *func,
> > - const char *fmt, va_list ap)
> > + uint32_t domid, const char *fmt, va_list ap)
> >  {
> >  /* WARNING this function may not call any libxl-provided
> >   * memory allocation function, as those may
> > @@ -211,6 +211,7 @@ void libxl__logv(libxl_ctx *ctx, xentoollog_level 
> > msglevel, int errnoval,
> >  char *base = NULL;
> >  int rc, esave;
> >  char fileline[256];
> > +char domain[256];
> >  
> >  esave = errno;
> >  
> > @@ -221,22 +222,25 @@ void libxl__logv(libxl_ctx *ctx, xentoollog_level 
> > msglevel, int errnoval,
> >  if (file) snprintf(fileline, sizeof(fileline), "%s:%d",file,line);
> >  fileline[sizeof(fileline)-1] = 0;
> >  
> > +domain[0] = 0;
> > +if (domid != INVALID_DOMID) snprintf(domain, sizeof(domain), "Domain 
> > %"PRIu32":", domid);
> 
> Coding style issue, please put snprintf in a new line.

I've mimicked what is a few lines above (see first line of the hunk context).
I agree it doesn't look too pretty. but then may be I should reformat the one 
above ;)

> > +domain[sizeof(domain)-1] = 0;
> 
> This probably does do what you want it to do - sizeof(domain) -> 256.  I
> don't think you need this at all because IIRC snprintf puts a \0 at the
> end.

Oh indeed. I'll remove it then.

> Overall I think this is in line with what we discussed before.

I expected to send a v2 anyway, I'll resend with the changes.
--
Cedric

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


  1   2   >