[libvirt] [PATCH] fix memory leak in qemuMonitorJSONAttachCharDevCommand

2017-06-11 Thread Yi Wang
The @tlsalias allocated in qemuAliasTLSObjFromSrcAlias may lost
 when append string to json.

Signed-off-by: Xi Xu 
---
 src/qemu/qemu_monitor_json.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index f208dd0..773de0f 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -6487,6 +6487,7 @@ qemuMonitorJSONAttachCharDevCommand(const char *chrID,
 
 if (virJSONValueObjectAppendString(data, "tls-creds", tlsalias) < 
0)
 goto error;
+VIR_FREE(tlsalias);
 }
 break;
 
-- 
1.8.3.1


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH] fix memory leak in daemonUnixSocketPaths

2017-06-11 Thread Yi Wang
The @rundir is allocated in virGetUserRuntimeDirectory, may lost
when virFileMakePath failed.

Signed-off-by: Xi Xu 
---
 daemon/libvirtd.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index bac4bc1..d17a694 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -288,6 +288,7 @@ daemonUnixSocketPaths(struct daemonConfig *config,
 old_umask = umask(077);
 if (virFileMakePath(rundir) < 0) {
 umask(old_umask);
+VIR_FREE(rundir);
 goto error;
 }
 umask(old_umask);
-- 
1.8.3.1


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH 04/26] tests: Update qemumemlock data

2017-06-11 Thread Andrea Bolognani
On Sun, 2017-06-11 at 22:14 -0400, Laine Stump wrote:
> > Use 0001:01:00.0 instead of :04:02.0 as the source address
> > for the host device. This doesn't change anything at the moment,
> > but it will make a difference later on.
> 
> Now I'm curious - a non-0 domain is *extremely* rare on x86 machines. Is
> it more normal on PPC?

Yup. Most PCI devices have their own PCI domain on POWER
hosts and PowerVM guests, and getting libvirt to behave the
same way is kind of the whole point of this series :)

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH v2] Report more correct information for cache control

2017-06-11 Thread Eli Qiao
Thanks martin, 

Looks good to me. 


On Friday, 9 June 2017 at 4:52 PM, Martin Kletzander wrote:

> On some platforms the number of bits in the cbm_mask might not be
> divisible by 4 (and not even by 2), so we need to properly count the
> bits. Similar file, min_cbm_bits, is properly parsed and used, but if
> the number is greater than one, we lose the information about
> granularity when reporting the data in capabilities. For that matter
> always report granularity, but if it is not the same as the minimum,
> add that information in there as well.
> 
> Signed-off-by: Martin Kletzander  (mailto:mklet...@redhat.com)>
> ---
> v2:
> - More expressive comments for structure members
> - Cache size adjusted to match the SKX machine (33M)
> 
> v1:
> - https://www.redhat.com/archives/libvir-list/2017-June/msg00229.html
> 
ACK 

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH 04/26] tests: Update qemumemlock data

2017-06-11 Thread Laine Stump
On 06/02/2017 12:07 PM, Andrea Bolognani wrote:
> Use 0001:01:00.0 instead of :04:02.0 as the source address
> for the host device. This doesn't change anything at the moment,
> but it will make a difference later on.

Now I'm curious - a non-0 domain is *extremely* rare on x86 machines. Is
it more normal on PPC?


Reviewed-by: Laine Stump 

> ---
>  tests/qemumemlockdata/qemumemlock-pc-hardlimit+hostdev.xml | 2 +-
>  tests/qemumemlockdata/qemumemlock-pc-hardlimit+locked+hostdev.xml  | 2 +-
>  tests/qemumemlockdata/qemumemlock-pc-hostdev.xml   | 2 +-
>  tests/qemumemlockdata/qemumemlock-pc-locked+hostdev.xml| 2 +-
>  tests/qemumemlockdata/qemumemlock-pseries-hardlimit+hostdev.xml| 2 +-
>  tests/qemumemlockdata/qemumemlock-pseries-hardlimit+locked+hostdev.xml | 2 +-
>  tests/qemumemlockdata/qemumemlock-pseries-hostdev.xml  | 2 +-
>  tests/qemumemlockdata/qemumemlock-pseries-locked+hostdev.xml   | 2 +-
>  8 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/tests/qemumemlockdata/qemumemlock-pc-hardlimit+hostdev.xml 
> b/tests/qemumemlockdata/qemumemlock-pc-hardlimit+hostdev.xml
> index 5443145..e03f5a5 100644
> --- a/tests/qemumemlockdata/qemumemlock-pc-hardlimit+hostdev.xml
> +++ b/tests/qemumemlockdata/qemumemlock-pc-hardlimit+hostdev.xml
> @@ -13,7 +13,7 @@
>  
>
>
> -
> +
>
>  
>
> diff --git 
> a/tests/qemumemlockdata/qemumemlock-pc-hardlimit+locked+hostdev.xml 
> b/tests/qemumemlockdata/qemumemlock-pc-hardlimit+locked+hostdev.xml
> index 8184eef..7070e5a 100644
> --- a/tests/qemumemlockdata/qemumemlock-pc-hardlimit+locked+hostdev.xml
> +++ b/tests/qemumemlockdata/qemumemlock-pc-hardlimit+locked+hostdev.xml
> @@ -16,7 +16,7 @@
>  
>
>
> -
> +
>
>  
>
> diff --git a/tests/qemumemlockdata/qemumemlock-pc-hostdev.xml 
> b/tests/qemumemlockdata/qemumemlock-pc-hostdev.xml
> index 6c058a9..cd517ee 100644
> --- a/tests/qemumemlockdata/qemumemlock-pc-hostdev.xml
> +++ b/tests/qemumemlockdata/qemumemlock-pc-hostdev.xml
> @@ -10,7 +10,7 @@
>  
>
>
> -
> +
>
>  
>
> diff --git a/tests/qemumemlockdata/qemumemlock-pc-locked+hostdev.xml 
> b/tests/qemumemlockdata/qemumemlock-pc-locked+hostdev.xml
> index fbc1dc3..da79cb5 100644
> --- a/tests/qemumemlockdata/qemumemlock-pc-locked+hostdev.xml
> +++ b/tests/qemumemlockdata/qemumemlock-pc-locked+hostdev.xml
> @@ -13,7 +13,7 @@
>  
>
>
> -
> +
>
>  
>
> diff --git a/tests/qemumemlockdata/qemumemlock-pseries-hardlimit+hostdev.xml 
> b/tests/qemumemlockdata/qemumemlock-pseries-hardlimit+hostdev.xml
> index ddd3b47..baf0649 100644
> --- a/tests/qemumemlockdata/qemumemlock-pseries-hardlimit+hostdev.xml
> +++ b/tests/qemumemlockdata/qemumemlock-pseries-hardlimit+hostdev.xml
> @@ -13,7 +13,7 @@
>  
>
>
> -
> +
>
>  
>
> diff --git 
> a/tests/qemumemlockdata/qemumemlock-pseries-hardlimit+locked+hostdev.xml 
> b/tests/qemumemlockdata/qemumemlock-pseries-hardlimit+locked+hostdev.xml
> index 73c28c1..04ae4e9 100644
> --- a/tests/qemumemlockdata/qemumemlock-pseries-hardlimit+locked+hostdev.xml
> +++ b/tests/qemumemlockdata/qemumemlock-pseries-hardlimit+locked+hostdev.xml
> @@ -16,7 +16,7 @@
>  
>
>
> -
> +
>
>  
>
> diff --git a/tests/qemumemlockdata/qemumemlock-pseries-hostdev.xml 
> b/tests/qemumemlockdata/qemumemlock-pseries-hostdev.xml
> index daf70a4..a52768c 100644
> --- a/tests/qemumemlockdata/qemumemlock-pseries-hostdev.xml
> +++ b/tests/qemumemlockdata/qemumemlock-pseries-hostdev.xml
> @@ -10,7 +10,7 @@
>  
>
>
> -
> +
>
>  
>
> diff --git a/tests/qemumemlockdata/qemumemlock-pseries-locked+hostdev.xml 
> b/tests/qemumemlockdata/qemumemlock-pseries-locked+hostdev.xml
> index 74212f1..f5abef0 100644
> --- a/tests/qemumemlockdata/qemumemlock-pseries-locked+hostdev.xml
> +++ b/tests/qemumemlockdata/qemumemlock-pseries-locked+hostdev.xml
> @@ -13,7 +13,7 @@
>  
>
>
> -
> +
>
>  
>
> 

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH 03/26] conf: Tweak virDomainPCIAddressGetNextAddr() signature

2017-06-11 Thread Laine Stump
On 06/02/2017 12:07 PM, Andrea Bolognani wrote:
> Move @function after @flags to match other functions in the
> same module like virDomainPCIAddressReserveNextAddr().

I might have changed the other functions to put flags last (or maybe
not). Anyway, consistency is good.

Reviewed-by: Laine Stump 

> 
> Also move virDomainPCIAddressReserveNextAddr() closer to
> virDomainPCIAddressReserveAddr() in the header file.
> ---
>  src/conf/domain_addr.c |  6 +++---
>  src/conf/domain_addr.h | 12 ++--
>  2 files changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
> index 9c809e8..6fd8bfc 100644
> --- a/src/conf/domain_addr.c
> +++ b/src/conf/domain_addr.c
> @@ -738,8 +738,8 @@ 
> virDomainPCIAddressFindUnusedFunctionOnBus(virDomainPCIAddressBusPtr bus,
>  static int ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
>  virDomainPCIAddressGetNextAddr(virDomainPCIAddressSetPtr addrs,
> virPCIDeviceAddressPtr next_addr,
> -   int function,
> -   virDomainPCIConnectFlags flags)
> +   virDomainPCIConnectFlags flags,
> +   int function)
>  {
>  /* default to starting the search for a free slot from
>   * the first slot of domain 0 bus 0...
> @@ -845,7 +845,7 @@ 
> virDomainPCIAddressReserveNextAddr(virDomainPCIAddressSetPtr addrs,
>  {
>  virPCIDeviceAddress addr;
>  
> -if (virDomainPCIAddressGetNextAddr(addrs, , function, flags) < 0)
> +if (virDomainPCIAddressGetNextAddr(addrs, , flags, function) < 0)
>  return -1;
>  
>  if (virDomainPCIAddressReserveAddrInternal(addrs, , flags, false) < 
> 0)
> diff --git a/src/conf/domain_addr.h b/src/conf/domain_addr.h
> index efa97ca..77e19bb 100644
> --- a/src/conf/domain_addr.h
> +++ b/src/conf/domain_addr.h
> @@ -150,6 +150,12 @@ int 
> virDomainPCIAddressReserveAddr(virDomainPCIAddressSetPtr addrs,
> virDomainPCIConnectFlags flags)
>  ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
>  
> +int virDomainPCIAddressReserveNextAddr(virDomainPCIAddressSetPtr addrs,
> +   virDomainDeviceInfoPtr dev,
> +   virDomainPCIConnectFlags flags,
> +   int function)
> +ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
> +
>  int virDomainPCIAddressEnsureAddr(virDomainPCIAddressSetPtr addrs,
>virDomainDeviceInfoPtr dev,
>virDomainPCIConnectFlags flags)
> @@ -159,12 +165,6 @@ int 
> virDomainPCIAddressReleaseAddr(virDomainPCIAddressSetPtr addrs,
> virPCIDeviceAddressPtr addr)
>  ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
>  
> -int virDomainPCIAddressReserveNextAddr(virDomainPCIAddressSetPtr addrs,
> -   virDomainDeviceInfoPtr dev,
> -   virDomainPCIConnectFlags flags,
> -   int function)
> -ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
> -
>  void virDomainPCIAddressSetAllMulti(virDomainDefPtr def)
>  ATTRIBUTE_NONNULL(1);
>  
> 

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH 02/26] conf: Make virDomainPCIAddressSetGrow() private

2017-06-11 Thread Laine Stump
On 06/02/2017 12:07 PM, Andrea Bolognani wrote:
> There are no external users.
> ---
>  src/conf/domain_addr.c   | 2 +-
>  src/conf/domain_addr.h   | 5 -
>  src/libvirt_private.syms | 1 -
>  3 files changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
> index 639168e..9c809e8 100644
> --- a/src/conf/domain_addr.c
> +++ b/src/conf/domain_addr.c
> @@ -362,7 +362,7 @@ virDomainPCIAddressBusSetModel(virDomainPCIAddressBusPtr 
> bus,
>   *  0 = no action performed
>   * >0 = number of buses added
>   */
> -int
> +static int
>  virDomainPCIAddressSetGrow(virDomainPCIAddressSetPtr addrs,
> virPCIDeviceAddressPtr addr,
> virDomainPCIConnectFlags flags)
> diff --git a/src/conf/domain_addr.h b/src/conf/domain_addr.h
> index f884b8a..efa97ca 100644
> --- a/src/conf/domain_addr.h
> +++ b/src/conf/domain_addr.h
> @@ -145,11 +145,6 @@ bool 
> virDomainPCIAddressSlotInUse(virDomainPCIAddressSetPtr addrs,
>virPCIDeviceAddressPtr addr)
>  ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
>  
> -int virDomainPCIAddressSetGrow(virDomainPCIAddressSetPtr addrs,
> -   virPCIDeviceAddressPtr addr,
> -   virDomainPCIConnectFlags flags)
> -ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
> -
>  int virDomainPCIAddressReserveAddr(virDomainPCIAddressSetPtr addrs,
> virPCIDeviceAddressPtr addr,
> virDomainPCIConnectFlags flags)
> diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
> index 429b095..901cc99 100644
> --- a/src/libvirt_private.syms
> +++ b/src/libvirt_private.syms
> @@ -113,7 +113,6 @@ virDomainPCIAddressReserveNextAddr;
>  virDomainPCIAddressSetAllMulti;
>  virDomainPCIAddressSetAlloc;
>  virDomainPCIAddressSetFree;
> -virDomainPCIAddressSetGrow;
>  virDomainPCIAddressSlotInUse;
>  virDomainPCIAddressValidate;
>  virDomainPCIControllerModelToConnectType;
> 

Reviewed-by: Laine Stump 

(This *is* the new hot way to say ACK, right?)

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH 01/26] conf: Remove obsolete comment

2017-06-11 Thread Laine Stump
On 06/02/2017 12:07 PM, Andrea Bolognani wrote:
> The virDomainDeviceInfoIsSet() function no longer exists.
> ---
>  src/conf/device_conf.h | 4 
>  1 file changed, 4 deletions(-)
> 
> diff --git a/src/conf/device_conf.h b/src/conf/device_conf.h
> index a20de85..58b2c9c 100644
> --- a/src/conf/device_conf.h
> +++ b/src/conf/device_conf.h
> @@ -134,10 +134,6 @@ struct _virDomainDeviceDimmAddress {
>  typedef struct _virDomainDeviceInfo virDomainDeviceInfo;
>  typedef virDomainDeviceInfo *virDomainDeviceInfoPtr;
>  struct _virDomainDeviceInfo {
> -/* If adding to this struct, ensure that
> - * virDomainDeviceInfoIsSet() is updated
> - * to consider the new fields
> - */
>  char *alias;
>  int type; /* virDomainDeviceAddressType */
>  union {
> 

Reviewed-by: Laine Stump 

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list