From nobody Sat May 18 10:48:39 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1560164583; cv=none; d=zoho.com; s=zohoarc; b=Rh/CIrlJe52/y7g37qtAnwcAhYknW7lth2iDs61BGhlW8JVAYvh3W3tEmZWZ9E/RHZZoqTysWDdiOD14tVfb+xIijieCZOqgh1JJlMr0pNY7OMmqm+6JC3Phbv+zfZVw1z8/jsCYqtoN7wun12mIm+YgHWdZWknYMoeoMGs75AE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560164583; h=Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=TyxOY6SjFhly33sFNIdt7y8GoyOdGb6wE7+9JRxcxPI=; b=mhZh7OH4hcBin9/G2qwFAftrA24UaGNOLZlm8+oO8xU0F4ZPdxphox7W9H9DRumCQn0lQKPRbYQxvPoiabflIJwFJOLoLDXdxFi+gw53vyE/JihjZlY89muaQL3Kt5QpSFDmbmUMKxn5uGtYbEpTH1YC3V8ROqcQh25NUFMz6e8= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1560164583537665.5727196668954; Mon, 10 Jun 2019 04:03:03 -0700 (PDT) Received: from localhost ([::1]:44318 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haI4n-0004N9-4l for importer@patchew.org; Mon, 10 Jun 2019 07:02:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38552) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haI1P-0002nQ-Ql for qemu-devel@nongnu.org; Mon, 10 Jun 2019 06:59:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1haI1O-00070A-Tb for qemu-devel@nongnu.org; Mon, 10 Jun 2019 06:59:27 -0400 Received: from relay.sw.ru ([185.231.240.75]:55742) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1haI1O-0006xp-LA for qemu-devel@nongnu.org; Mon, 10 Jun 2019 06:59:26 -0400 Received: from [10.94.4.71] (helo=dptest2.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.91) (envelope-from ) id 1haI1I-0002bD-VK; Mon, 10 Jun 2019 13:59:21 +0300 From: Denis Plotnikov To: dgilbert@redhat.com, armbru@redhat.com Date: Mon, 10 Jun 2019 13:59:06 +0300 Message-Id: <20190610105906.28524-1-dplotnikov@virtuozzo.com> X-Mailer: git-send-email 2.17.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 185.231.240.75 Subject: [Qemu-devel] [PATCH] monitor: increase amount of data for monitor to read X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, den@virtuozzo.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Right now QMP and HMP monitors read 1 byte at a time from the socket, which is very inefficient. With 100+ VMs on the host this easily reasults in a lot of unnecessary system calls and CPU usage in the system. This patch changes the amount of data to read to 4096 bytes, which matches buffer size on the channel level. Fortunately, monitor protocol is synchronous right now thus we should not face side effects in reality. Signed-off-by: Denis V. Lunev Signed-off-by: Denis Plotnikov --- include/monitor/monitor.h | 2 +- monitor.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h index c1b40a9cac..afa1ed34a4 100644 --- a/include/monitor/monitor.h +++ b/include/monitor/monitor.h @@ -14,7 +14,7 @@ extern __thread Monitor *cur_mon; #define MONITOR_USE_CONTROL 0x04 #define MONITOR_USE_PRETTY 0x08 =20 -#define QMP_REQ_QUEUE_LEN_MAX 8 +#define QMP_REQ_QUEUE_LEN_MAX 4096 =20 bool monitor_cur_is_qmp(void); =20 diff --git a/monitor.c b/monitor.c index 4807bbe811..a08e020b61 100644 --- a/monitor.c +++ b/monitor.c @@ -4097,7 +4097,7 @@ static int monitor_can_read(void *opaque) { Monitor *mon =3D opaque; =20 - return !atomic_mb_read(&mon->suspend_cnt); + return !atomic_mb_read(&mon->suspend_cnt) ? 4096 : 0; } =20 /* --=20 2.17.0