From nobody Sat Feb 7 15:11:58 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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=1597640880; cv=none; d=zohomail.com; s=zohoarc; b=lsPvPB8S9briHHTA0W27Orrrw7pukg42JgNzJgBL2dEQGqQKDiJyH9+h1w3uaxU5tFuD6SWNjvMpcN8YIWHm/ZTs9Im+bQBQpH8gXsTiV1ZutqKDUvWf0rLUA1h17lAOVOGMWxwrHBxEA+NC8jfAWsKxZo23AY77fHmDGjgqNQM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597640880; 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=+UAk78MtjEWe0Szib8bFy+uf0t/N/d1xhbg9RwMPJWQ=; b=kvOKg3yETntS2TFYAsWU4artGqIWga+FrxkOJ/XQXzTJKHSTqUhJUjiWVFyHNWclJnG7F3PbM7Tezi3vAezoHyZxRW/t2iLnKdsHFRzMBzBlXlL+PoJD4b1ObNLBFkzFeRnITcrJMQt8RJVai5j20xubUkN2dGPYempvH6F7UpQ= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1597640880321683.0261178668185; Sun, 16 Aug 2020 22:08:00 -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-424-B85JCPw4NzmBpB45KQH-Yw-1; Mon, 17 Aug 2020 01:07:57 -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 BFEC43F10; Mon, 17 Aug 2020 05:07:51 +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 9B82F21E8E; Mon, 17 Aug 2020 05:07:51 +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 6D8884EE38; Mon, 17 Aug 2020 05:07:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 07H57ihj021747 for ; Mon, 17 Aug 2020 01:07:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id 81436110F0B1; Mon, 17 Aug 2020 05:07:44 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7CD14110F0AF for ; Mon, 17 Aug 2020 05:07:44 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (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 65ACE80121D for ; Mon, 17 Aug 2020 05:07:44 +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-8-JEyeUgGTN7Knx1UFlPqPMA-1; Mon, 17 Aug 2020 01:07:42 -0400 Received: by mail-pl1-f193.google.com with SMTP id bh1so6906261plb.12 for ; Sun, 16 Aug 2020 22:07:42 -0700 (PDT) Received: from localhost.localdomain ([125.99.150.200]) by smtp.gmail.com with ESMTPSA id s64sm18091678pfs.111.2020.08.16.22.07.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Aug 2020 22:07:40 -0700 (PDT) X-MC-Unique: B85JCPw4NzmBpB45KQH-Yw-1 X-MC-Unique: JEyeUgGTN7Knx1UFlPqPMA-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=+UAk78MtjEWe0Szib8bFy+uf0t/N/d1xhbg9RwMPJWQ=; b=qQdg3NR5GsKKXJYuI1qepc7iMTLh6MBmlmi2asdpzW3TVagz3gSvsz5Be6WWp+gZL6 KZ3bKbDHxOmv4cXV5cE3MzDT7/FxaMt9A2NVNZLdgJleK/Jmio5oT6GGV1CDMETiYHI2 tm2+5KdZ5cXaU9tZ4HOttJZwim7VkS+Yh3CoQakFLtJUk32mlMwCzOBjtsxAiFHNJ+lz Zqoy8YuHW8Vituu8CPi/jUqc4kxfkoEitkSmwDwlYwSz6MjY4w/MyR7I1ao6l++dm6/y fDEbKiIf6mJhQ0u77FTytygu0wC7nxLWu+I0NGO87Ci/LH6XVVaHyhNN9QOhjTVmHaa6 eN7g== X-Gm-Message-State: AOAM5315c3vNQJtk8E3GYhHClCQx2V6yitaxQJy6CJBQAGZiCx29m4Yi XQD2wQtrAX1Ijc/lRu26wZC3ZvCLh7ioCw== X-Google-Smtp-Source: ABdhPJxV+q7Ci5ivm7+KkdKEjrCynD39XugCj2LI+aeZW9vJYb/h2fUDXoDeTscyh1xqoyu2IywJrg== X-Received: by 2002:a17:90b:368c:: with SMTP id mj12mr10213327pjb.152.1597640860861; Sun, 16 Aug 2020 22:07:40 -0700 (PDT) From: Prathamesh Chavan To: libvir-list@redhat.com Subject: [GSoC][PATCH v2 3/6] qemu_domainjob: `maxQueuedJobs` added to `qemuDomainJobPrivate` Date: Mon, 17 Aug 2020 10:37:18 +0530 Message-Id: <20200817050721.7063-4-pc44800@gmail.com> In-Reply-To: <20200817050721.7063-1-pc44800@gmail.com> References: <20200817050721.7063-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.78 on 10.11.54.3 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. And creating its copy in the `qemuDomainJob` helped us access the variable without referencing the driver's config. Signed-off-by: Prathamesh Chavan --- src/qemu/qemu_domain.c | 5 ++++- src/qemu/qemu_domainjob.c | 13 +++++++------ src/qemu/qemu_domainjob.h | 4 +++- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 1ae44ae39f..677fa7ea91 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2085,11 +2085,14 @@ 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; =20 - if (qemuDomainObjInitJob(&priv->job, &qemuPrivateJobCallbacks) < 0) { + if (qemuDomainObjInitJob(&priv->job, &qemuPrivateJobCallbacks, + cfg->maxQueuedJobs) < 0) { virReportSystemError(errno, "%s", _("Unable to init qemu driver mutexes")); goto error; diff --git a/src/qemu/qemu_domainjob.c b/src/qemu/qemu_domainjob.c index 7cd1aabd9e..eebc144747 100644 --- a/src/qemu/qemu_domainjob.c +++ b/src/qemu/qemu_domainjob.c @@ -117,10 +117,12 @@ qemuDomainAsyncJobPhaseFromString(qemuDomainAsyncJob = job, =20 int qemuDomainObjInitJob(qemuDomainJobObjPtr job, - qemuDomainObjPrivateJobCallbacksPtr cb) + qemuDomainObjPrivateJobCallbacksPtr cb, + unsigned int maxQueuedJobs) { memset(job, 0, sizeof(*job)); job->cb =3D cb; + job->maxQueuedJobs =3D maxQueuedJobs; =20 if (!(job->privateData =3D job->cb->allocJobPrivate())) return -1; @@ -344,7 +346,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 +371,8 @@ qemuDomainObjBeginJobInternal(virQEMUDriverPtr driver, =20 retry: if ((!async && job !=3D QEMU_JOB_DESTROY) && - cfg->maxQueuedJobs && - priv->job.jobs_queued > cfg->maxQueuedJobs) { + priv->job.maxQueuedJobs && + priv->job.jobs_queued > priv->job.maxQueuedJobs) { goto error; } =20 @@ -501,8 +502,8 @@ qemuDomainObjBeginJobInternal(virQEMUDriverPtr driver, _("cannot acquire state change lock")); } ret =3D -2; - } else if (cfg->maxQueuedJobs && - priv->job.jobs_queued > cfg->maxQueuedJobs) { + } else if (priv->job.maxQueuedJobs && + priv->job.jobs_queued > priv->job.maxQueuedJobs) { 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 0696b79fe3..11e7f2f432 100644 --- a/src/qemu/qemu_domainjob.h +++ b/src/qemu/qemu_domainjob.h @@ -153,6 +153,7 @@ struct _qemuDomainJobObj { unsigned long apiFlags; /* flags passed to the API which started the a= sync job */ =20 int jobs_queued; + unsigned int maxQueuedJobs; =20 void *privateData; /* job specific collection of data= */ qemuDomainObjPrivateJobCallbacksPtr cb; @@ -215,7 +216,8 @@ void qemuDomainObjFreeJob(qemuDomainJobObjPtr job); =20 int qemuDomainObjInitJob(qemuDomainJobObjPtr job, - qemuDomainObjPrivateJobCallbacksPtr cb); + qemuDomainObjPrivateJobCallbacksPtr cb, + unsigned int maxQueuedJobs); =20 bool qemuDomainJobAllowed(qemuDomainJobObjPtr jobs, qemuDomainJob newJob); =20 --=20 2.25.1