[libvirt] [PATCH v2 3/6] virThreadPool: Prevent switching between zero and non-zero maxWorkers

Marc Hartmayer posted 6 patches 6 years, 10 months ago
[libvirt] [PATCH v2 3/6] virThreadPool: Prevent switching between zero and non-zero maxWorkers
Posted by Marc Hartmayer 6 years, 10 months ago
...since maxWorkers=0 is only intended for virtlockd or virlogd which
must not be multithreaded.

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com>
---
 src/util/virthreadpool.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/util/virthreadpool.c b/src/util/virthreadpool.c
index f18eafb35deb..e615c8c07c82 100644
--- a/src/util/virthreadpool.c
+++ b/src/util/virthreadpool.c
@@ -479,6 +479,14 @@ virThreadPoolSetParameters(virThreadPoolPtr pool,
         goto error;
     }
 
+    if ((maxWorkers == 0 && pool->maxWorkers > 0) ||
+        (maxWorkers > 0 && pool->maxWorkers == 0)) {
+        virReportError(VIR_ERR_INVALID_ARG, "%s",
+                       _("maxWorkers must not be switched from zero to non-zero"
+                         " and vice versa"));
+        goto error;
+    }
+
     if (minWorkers >= 0) {
         if ((size_t) minWorkers > pool->nWorkers &&
             virThreadPoolExpand(pool, minWorkers - pool->nWorkers,
-- 
2.13.4

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2 3/6] virThreadPool: Prevent switching between zero and non-zero maxWorkers
Posted by John Ferlan 6 years, 9 months ago

On 07/03/2018 07:37 AM, Marc Hartmayer wrote:
> ...since maxWorkers=0 is only intended for virtlockd or virlogd which
> must not be multithreaded.
> 
> Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
> Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
> Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com>
> ---
>  src/util/virthreadpool.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 

I think this is separable - this could be pushed regardless of the
outcome of patch2, right? Let me know - I can reduce the load the next
update based on patch2 comments.

Reviewed-by: John Ferlan <jferlan@redhat.com>

John

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2 3/6] virThreadPool: Prevent switching between zero and non-zero maxWorkers
Posted by Marc Hartmayer 6 years, 9 months ago
On Thu, Jul 19, 2018 at 04:53 PM +0200, John Ferlan <jferlan@redhat.com> wrote:
> On 07/03/2018 07:37 AM, Marc Hartmayer wrote:
>> ...since maxWorkers=0 is only intended for virtlockd or virlogd which
>> must not be multithreaded.
>>
>> Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
>> Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
>> Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com>
>> ---
>>  src/util/virthreadpool.c | 8 ++++++++
>>  1 file changed, 8 insertions(+)
>>
>
> I think this is separable - this could be pushed regardless of the
> outcome of patch2, right? Let me know - I can reduce the load the next
> update based on patch2 comments.

Yep. Thanks for reviewing.

>
> Reviewed-by: John Ferlan <jferlan@redhat.com>
>
> John
>
--
Beste Grüße / Kind regards
   Marc Hartmayer

IBM Deutschland Research & Development GmbH
Vorsitzende des Aufsichtsrats: Martina Koederitz
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294


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