From nobody Sun Apr 28 19:35:28 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=1603216516; cv=none; d=zohomail.com; s=zohoarc; b=Gcjmb3mPi33vSxS5RkbouJ/j5HsRTW7KGI2xT5ak7fOU7RgLQHS5udqemr5uqCOEpcx7fjMba1490thS4AaIhLvucXbsdHmTMwcZhrhNfbxFtrOr6cKZlIGK+Lr+pVZg/DScCxswbDVzTCjwn49HCNSsOF5V00Pnk+QBPPmPE0g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603216516; h=Content-Type:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:Sender:Subject:To; bh=6V/3vPDigDW99Osj1UyVvDGo+xZ0nzLXVKlfOxKipfw=; b=XorMWFBvkBPrRSK9m7obaJE7KFmaXTXW7hqGgr7sQeUC4ftqdwvRo5T+d1e8MTVeo6jNWgsG9hEcAdUrcxozniuGoBIaF4byw6A+NyRjhQlaE4C01UTcfr4DXQjRDPgmo0HguAb7hvkLNBl3IYfCzQr2j0UphojbtVecRHn7FRQ= 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 1603216516137569.7404738048724; Tue, 20 Oct 2020 10:55:16 -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-86-eH5mbxt-PsGqY57CEXQfMQ-1; Tue, 20 Oct 2020 13:55:10 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 53AE11006C91; Tue, 20 Oct 2020 17:55:04 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7F3AC6EF45; Tue, 20 Oct 2020 17:55:02 +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 A6054181A869; Tue, 20 Oct 2020 17:55:00 +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 09KHswdH015201 for ; Tue, 20 Oct 2020 13:54:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6268A10F1C1C; Tue, 20 Oct 2020 17:54:58 +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 5E1AC10F1C09 for ; Tue, 20 Oct 2020 17:54:51 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.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 C4D7D805BD6 for ; Tue, 20 Oct 2020 17:54:51 +0000 (UTC) Received: from mail-il1-f196.google.com (mail-il1-f196.google.com [209.85.166.196]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-212-lEoxhomMPOeh_JTL-TcYtQ-1; Tue, 20 Oct 2020 13:54:47 -0400 Received: by mail-il1-f196.google.com with SMTP id p9so3543283ilr.1 for ; Tue, 20 Oct 2020 10:54:47 -0700 (PDT) Received: from localhost (209-6-122-159.s2973.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [209.6.122.159]) by smtp.gmail.com with ESMTPSA id n138sm2154932iod.40.2020.10.20.10.54.42 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Oct 2020 10:54:43 -0700 (PDT) X-MC-Unique: eH5mbxt-PsGqY57CEXQfMQ-1 X-MC-Unique: lEoxhomMPOeh_JTL-TcYtQ-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; bh=6V/3vPDigDW99Osj1UyVvDGo+xZ0nzLXVKlfOxKipfw=; b=IZNkpSXxF5f2N8UzVo4DVIjhn++KkYmogRq/Peio267cjw5rS0vlsq3N3I9+Mkuo4S BqwpD/hvO8P8/89nAP/2zldLPZeRPxJJ2ETG3W06uEt9knp5gvO3gRI69pnVaXo6NDC9 MmYQZWZkd262ZYMkjch16p5AYNq7oxzG9MLFA+AEjCiKZVcqZw2HEVAgW/CQ4tiWtGxu qmaHYVt1+6OtLR2DlNCPpWUAp9vk2+LhqoigjIfGYLco1egkldtaQyuDCGLGyaT5VmW3 ArrEytGMwk37JffshEih6un1EPyHmh6Kdc7Fx2SQT/jUL6NgLKywDjm5PnHg7VYG1Pfa 50tQ== X-Gm-Message-State: AOAM533RIEMHxNMT7a5uv5dbzo5E6quXyEtpIWuJgPpv+z4HkiCu1CTP DvD4LidVjICeyJsbNCCpyF0P6eqowQ== X-Google-Smtp-Source: ABdhPJzf2Z+2Q3PB9YbC3thaYur4NEeIu32wv/GEAJphtAV4zb4NLJ7QYaTnhIIM/XfhKJTwV6C7oQ== X-Received: by 2002:a92:d80c:: with SMTP id y12mr3007073ilm.107.1603216483546; Tue, 20 Oct 2020 10:54:43 -0700 (PDT) From: Masayoshi Mizuma To: libvir-list@redhat.com Subject: [PATCH] qemu: virtiofs: Add pool element to limit thread pool Date: Tue, 20 Oct 2020 13:54:33 -0400 Message-Id: <20201020175433.10644-1-msys.mizuma@gmail.com> 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: Masayoshi Mizuma , Masayoshi Mizuma 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.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 2 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Masayoshi Mizuma virtiofsd has --thread-pool-size=3DNUM option to limit the thread pool size. It will be useful to tune the performance. Add pool element to use the option like as: Signed-off-by: Masayoshi Mizuma --- docs/formatdomain.rst | 6 ++++-- docs/schemas/domaincommon.rng | 5 +++++ src/conf/domain_conf.c | 12 ++++++++++++ src/conf/domain_conf.h | 1 + src/qemu/qemu_virtiofs.c | 3 +++ 5 files changed, 25 insertions(+), 2 deletions(-) diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index bfa80e4bc2..0f66af5dc3 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -3070,7 +3070,7 @@ A directory on the host that can be accessed directly= from the guest. - + @@ -3188,7 +3188,9 @@ A directory on the host that can be accessed directly= from the guest. the use of filesystem extended attributes. Caching can be tuned via the ``cache`` element, possible ``mode`` values being ``none`` and ``always= ``. Locking can be controlled via the ``lock`` element - attributes ``posix= `` and - ``flock`` both accepting values ``on`` or ``off``. ( :since:`Since 6.2.= 0` ) + ``flock`` both accepting values ``on`` or ``off``. ( :since:`Since 6.2.= 0` ). + Thread pool size limit can be tuned via the ``pool`` element. + ( :since:`Since 6.9.0` ) ``source`` The resource on the host that is being accessed in the guest. The ``nam= e`` attribute must be used with ``type=3D'template'``, and the ``dir`` attr= ibute diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index c25a742581..cd5de2ba80 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -2839,6 +2839,11 @@ + + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index efa5ac527b..9d06f8c75f 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -11588,6 +11588,7 @@ virDomainFSDefParseXML(virDomainXMLOptionPtr xmlopt, g_autofree char *cache =3D virXPathString("string(./binary/cache/@= mode)", ctxt); g_autofree char *posix_lock =3D virXPathString("string(./binary/lo= ck/@posix)", ctxt); g_autofree char *flock =3D virXPathString("string(./binary/lock/@f= lock)", ctxt); + g_autofree char *thread_pool_size =3D virXPathString("string(./bin= ary/@pool)", ctxt); int val; =20 if (queue_size && virStrToLong_ull(queue_size, NULL, 10, &def->que= ue_size) < 0) { @@ -11597,6 +11598,14 @@ virDomainFSDefParseXML(virDomainXMLOptionPtr xmlop= t, goto error; } =20 + if (thread_pool_size && + virStrToLong_ull(thread_pool_size, NULL, 10, &def->thread_pool= _size) < 0) { + virReportError(VIR_ERR_XML_ERROR, + _("cannot parse thread pool size '%s' for virti= ofs"), + thread_pool_size); + goto error; + } + if (binary) def->binary =3D virFileSanitizePath(binary); =20 @@ -26191,6 +26200,9 @@ virDomainFSDefFormat(virBufferPtr buf, virTristateSwitchTypeToString(def->xattr)); } =20 + if (def->thread_pool_size) + virBufferAsprintf(&binaryAttrBuf, " pool=3D'%llu'", def->threa= d_pool_size); + if (def->cache !=3D VIR_DOMAIN_FS_CACHE_MODE_DEFAULT) { virBufferAsprintf(&binaryBuf, "\n", virDomainFSCacheModeTypeToString(def->cache)= ); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index cd344716a3..98ab0a51c7 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -860,6 +860,7 @@ struct _virDomainFSDef { bool symlinksResolved; char *binary; unsigned long long queue_size; + unsigned long long thread_pool_size; virTristateSwitch xattr; virDomainFSCacheMode cache; virTristateSwitch posix_lock; diff --git a/src/qemu/qemu_virtiofs.c b/src/qemu/qemu_virtiofs.c index 2e239cad66..e35c278a1b 100644 --- a/src/qemu/qemu_virtiofs.c +++ b/src/qemu/qemu_virtiofs.c @@ -126,6 +126,9 @@ qemuVirtioFSBuildCommandLine(virQEMUDriverConfigPtr cfg, virCommandPassFD(cmd, *fd, VIR_COMMAND_PASS_FD_CLOSE_PARENT); *fd =3D -1; =20 + if (fs->thread_pool_size) + virCommandAddArgFormat(cmd, "--thread-pool-size=3D%llu", fs->threa= d_pool_size); + virCommandAddArg(cmd, "-o"); virBufferAddLit(&opts, "source=3D"); virQEMUBuildBufferEscapeComma(&opts, fs->src->path); --=20 2.27.0