From nobody Mon Nov 25 17:48:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1598215139; cv=none; d=zohomail.com; s=zohoarc; b=UNyz8HCAi6fZ1ADiSZt1Mqs6FxW3lT1GCCMLAAL/mHupalHWJ1RHpCooFEkbewVK4MqkXyXsTQ9k96AoUWFQ18CQzz0yr7n7Ak+qm2FWOuLruuBCvBIu0rF8PGZpn156lq6v6re/kwWGRjIBjJ17VQInKZPmTceQRUdwpI3jHtE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598215139; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=RJ1n5flgOyMwuwFCVnGLqKHo5VL2R1efnPY21PX0xtw=; b=BqjUqKWdYVh6kzPNsapPCBmSWIgh8xPX0ImM612uh+dSrYpJicquQ4ERWjXjt8Z0rSguDC5SYGQeAtPv51hJS95lsPeHwy9kJoXh2/JBxo65vf7RGxf6yABiOetgLvzTOBP10HgLWNPUs9gw7pmLq4/p9S8HJHX50qlxeztxfPo= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1598215139559611.5232831081746; Sun, 23 Aug 2020 13:38:59 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-132-1Hdgc4XrOKy4Yn-2OVNGGg-1; Sun, 23 Aug 2020 16:38:55 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C6D18801AC3; Sun, 23 Aug 2020 20:38:49 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A25A62B3A2; Sun, 23 Aug 2020 20:38:49 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 75B6D6691C; Sun, 23 Aug 2020 20:38:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 07NKcSoS021007 for ; Sun, 23 Aug 2020 16:38:28 -0400 Received: by smtp.corp.redhat.com (Postfix) id 405F24407D; Sun, 23 Aug 2020 20:38:28 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3B9023325F for ; Sun, 23 Aug 2020 20:38:28 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 19E2F80029D for ; Sun, 23 Aug 2020 20:38:28 +0000 (UTC) Received: from mail-pl1-f193.google.com (mail-pl1-f193.google.com [209.85.214.193]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-455-clYrIRUPNs2GZH_m1Y40lg-1; Sun, 23 Aug 2020 16:38:25 -0400 Received: by mail-pl1-f193.google.com with SMTP id q3so1908973pls.11 for ; Sun, 23 Aug 2020 13:38:25 -0700 (PDT) Received: from localhost.localdomain ([125.99.149.9]) by smtp.gmail.com with ESMTPSA id t19sm8926898pfq.179.2020.08.23.13.38.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Aug 2020 13:38:24 -0700 (PDT) X-MC-Unique: 1Hdgc4XrOKy4Yn-2OVNGGg-1 X-MC-Unique: clYrIRUPNs2GZH_m1Y40lg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RJ1n5flgOyMwuwFCVnGLqKHo5VL2R1efnPY21PX0xtw=; b=mFWXenOzkpN7uz7Uw5wQ4Uvjxdww63UcdxfPYCijru74zrvYVHPWivcR5DHAVRIgTm MKmjRprxrG+1JOeM7im207suaSrBY5doZebxg6Y0DY5PgmjgqP6P9k/1eHLTFgzRkpxi AqoCT5BQl6r86WJk4ikXsQSMlnN7cKGc4yKi72d2flrecXoqV/OKhE0NLkGgnvJm2VV2 +mZsR/M75Fv1y+D2uzZjwcWZ9m763KLeVtew/TdioVeRc54JX1OgGU5HUyBT1Zx/LzAU pfniPjOEF0OXGAjjNsK0iDwOxKt157pH5JQR64TEkAJYMFRpmc/FnR7QJjZEO0/P83Lg X/og== X-Gm-Message-State: AOAM530y2FaX/jyNc5jMSp5piqe56hEwbStIX1m6J93dWmHJM5DGB874 Ohfubn1l1qx1c9+pE3E8FvGI5Bao++EjyQ== X-Google-Smtp-Source: ABdhPJz8WGriurqDykVOlfd994N/obMJXkBg9WJF8kHpYxA11URBxQl9fBsc4Mr3emHmZarI0+MCaA== X-Received: by 2002:a17:90b:238d:: with SMTP id mr13mr1899857pjb.132.1598215104501; Sun, 23 Aug 2020 13:38:24 -0700 (PDT) From: Prathamesh Chavan To: libvir-list@redhat.com Subject: [GSoC][PATCH v3 5/8] qemu_domainjob: `maxQueuedJobs` added to `qemuDomainJobPrivate` Date: Mon, 24 Aug 2020 02:08:05 +0530 Message-Id: <20200823203808.97348-6-pc44800@gmail.com> In-Reply-To: <20200823203808.97348-1-pc44800@gmail.com> References: <20200823203808.97348-1-pc44800@gmail.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false; X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: Prathamesh Chavan X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.003 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Reference to `maxQueuedJobs` required us to access config of the qemu-driver. To avoid jobs accessing them directly, we add callback function `getMaxQueuedJobs` to job's private-callback functions structure. Signed-off-by: Prathamesh Chavan --- src/qemu/qemu_domain.c | 11 +++++++++++ src/qemu/qemu_domainjob.c | 9 ++++----- src/qemu/qemu_domainjob.h | 2 ++ 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 8deac9d21e..f366c77191 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -797,6 +797,14 @@ qemuDomainDecreaseJobsQueued(virDomainObjPtr vm) priv->jobs_queued--; } =20 +static int +qemuDomainGetMaxQueuedJobs(virDomainObjPtr vm) +{ + qemuDomainObjPrivatePtr priv =3D vm->privateData; + virQEMUDriverConfigPtr cfg =3D virQEMUDriverGetConfig(priv->driver); + return cfg->maxQueuedJobs; +} + static qemuDomainObjPrivateJobCallbacks qemuPrivateJobCallbacks =3D { .allocJobPrivate =3D qemuJobAllocPrivate, .freeJobPrivate =3D qemuJobFreePrivate, @@ -808,6 +816,7 @@ static qemuDomainObjPrivateJobCallbacks qemuPrivateJobC= allbacks =3D { .getJobsQueued =3D qemuDomainGetJobsQueued, .increaseJobsQueued =3D qemuDomainIncreaseJobsQueued, .decreaseJobsQueued =3D qemuDomainDecreaseJobsQueued, + .getMaxQueuedJobs =3D qemuDomainGetMaxQueuedJobs, }; =20 /** @@ -2255,6 +2264,8 @@ static void * qemuDomainObjPrivateAlloc(void *opaque) { qemuDomainObjPrivatePtr priv; + virQEMUDriverPtr driver =3D opaque; + g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); =20 if (VIR_ALLOC(priv) < 0) return NULL; diff --git a/src/qemu/qemu_domainjob.c b/src/qemu/qemu_domainjob.c index e15619b792..4e29c5a460 100644 --- a/src/qemu/qemu_domainjob.c +++ b/src/qemu/qemu_domainjob.c @@ -344,7 +344,6 @@ qemuDomainObjBeginJobInternal(virQEMUDriverPtr driver, unsigned long long then; bool nested =3D job =3D=3D QEMU_JOB_ASYNC_NESTED; bool async =3D job =3D=3D QEMU_JOB_ASYNC; - g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); const char *blocker =3D NULL; const char *agentBlocker =3D NULL; int ret =3D -1; @@ -370,8 +369,8 @@ qemuDomainObjBeginJobInternal(virQEMUDriverPtr driver, =20 retry: if ((!async && job !=3D QEMU_JOB_DESTROY) && - cfg->maxQueuedJobs && - priv->job.cb->getJobsQueued(obj) > cfg->maxQueuedJobs) { + priv->job.cb->getMaxQueuedJobs(obj) && + priv->job.cb->getJobsQueued(obj) > priv->job.cb->getMaxQueuedJobs(= obj)) { goto error; } =20 @@ -501,8 +500,8 @@ qemuDomainObjBeginJobInternal(virQEMUDriverPtr driver, _("cannot acquire state change lock")); } ret =3D -2; - } else if (cfg->maxQueuedJobs && - priv->job.cb->getJobsQueued(obj) > cfg->maxQueuedJobs) { + } else if (priv->job.cb->getMaxQueuedJobs(obj) && + priv->job.cb->getJobsQueued(obj) > priv->job.cb->getMaxQueu= edJobs(obj)) { if (blocker && agentBlocker) { virReportError(VIR_ERR_OPERATION_FAILED, _("cannot acquire state change " diff --git a/src/qemu/qemu_domainjob.h b/src/qemu/qemu_domainjob.h index d3bc59cbcb..f3d9218ec0 100644 --- a/src/qemu/qemu_domainjob.h +++ b/src/qemu/qemu_domainjob.h @@ -116,6 +116,7 @@ typedef void (*qemuDomainObjCurrentJobInfoInit)(qemuDom= ainJobObjPtr, typedef int (*qemuDomainObjGetJobsQueued)(virDomainObjPtr); typedef void (*qemuDomainObjIncreaseJobsQueued)(virDomainObjPtr); typedef void (*qemuDomainObjDecreaseJobsQueued)(virDomainObjPtr); +typedef int (*qemuDomainObjGetMaxQueuedJobs)(virDomainObjPtr); =20 typedef struct _qemuDomainObjPrivateJobCallbacks qemuDomainObjPrivateJobCa= llbacks; typedef qemuDomainObjPrivateJobCallbacks *qemuDomainObjPrivateJobCallbacks= Ptr; @@ -130,6 +131,7 @@ struct _qemuDomainObjPrivateJobCallbacks { qemuDomainObjGetJobsQueued getJobsQueued; qemuDomainObjIncreaseJobsQueued increaseJobsQueued; qemuDomainObjDecreaseJobsQueued decreaseJobsQueued; + qemuDomainObjGetMaxQueuedJobs getMaxQueuedJobs; }; =20 struct _qemuDomainJobObj { --=20 2.25.1