From nobody Fri Apr 19 03:24:28 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1573659648; cv=none; d=zoho.com; s=zohoarc; b=RQR3V6VCFzvmyxvuqo3Flv1Xy8ZUIJcGjqpKZ7HfLazSd8QSqGXk4Tarx07xDjcE/FaR+5hPAy2GGFu1NuABko0/kefWO+tvRwck3IxGZebpnLCFAa8ArU+IlyCMXNEqLCOuxyiltz4Bo6M/7rJnEvJYMp6hNfc/p8LLys20Rqc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573659648; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Subject:To; bh=P4Zo05cmFa2EZI6eWH6yRXphHF7h3LfQcwMzvjT8ywc=; b=VrYCEy5Esp6ZfbeUl1niCPOh+3FfJN15A4xfR/Yx6+2W6uRgG2j3YqQJy1W4rKZTkvfNcXCZpWhuoMMDIxphaWva4kekNYq/bKFhw+Ovw+3qaAnrJuyY2ZrV95mhWyApVkaLl3QC1zzRFHRnh68oNh7opn0VxyCD4+Hxldxhy9o= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1573659648030107.8152204561951; Wed, 13 Nov 2019 07:40:48 -0800 (PST) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id 81AFD12A0EFF; Wed, 13 Nov 2019 15:40:44 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id C5F9212A0FEA for ; Mon, 11 Nov 2019 09:10:50 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by relay.sw.ru with esmtp (Exim 4.92.3) (envelope-from ) id 1iU5ii-0001QU-6B; Mon, 11 Nov 2019 12:10:48 +0300 From: Denis Plotnikov To: seabios@seabios.org Date: Mon, 11 Nov 2019 12:10:47 +0300 Message-Id: <20191111091047.25374-1-dplotnikov@virtuozzo.com> X-MailFrom: dplotnikov@virtuozzo.com X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1 Message-ID-Hash: YVQOO7YBJ6JGZNOPSTQQHLEGWBUSJ3K2 X-Message-ID-Hash: YVQOO7YBJ6JGZNOPSTQQHLEGWBUSJ3K2 X-Mailman-Approved-At: Wed, 13 Nov 2019 15:40:18 +0000 CC: kraxel@redhat.com, den@virtuozzo.com X-Mailman-Version: 3.2.3 Precedence: list Subject: [SeaBIOS] [PATCH v1--annotate] virtio: extend virtio queue size to 256 List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Bar: +++++ X-Spam-Level: ***** Authentication-Results: coreboot.org; auth=pass smtp.auth=mailman@coreboot.org smtp.mailfrom=seabios-bounces@seabios.org Content-Type: text/plain; charset="utf-8" v1: * more verbose commit message [Gerd] --- The goal of the patch is to work around a performance bug in guest linux kernels. Old linux kernels has a performance flaw in virtio block device access: on some frequent disk access patterns, e.g. 1M read, the kernel produces more block requests than needed. This happens because of virtio seg_max parameter set to 126 (virtqueue_size - 2) which limits the maximum block request to 516096 (126 * 4096_PAGE_SIZE) bytes. Setting seg_max > 126 fixes the issue, however, not all linux kernels allow that without increasing virtio virtqueue size. The old kernels have a restriction: virtqueue_size >=3D seg_max. In case of the restriction violation the old kernels crash. The restriction is relaxed in the recent linux kernels (ver >=3D 4.13) with: commit 44ed8089e991a60d614abe0ee4b9057a28b364e4 Author: Richard W.M. Jones Date: Thu Aug 10 17:56:51 2017 +0100 scsi: virtio: Reduce BUG if total_sg > virtqueue size to WARN. and the recent linux kernels don't crash if total_sg > virtqueue size allowing to set seg_max to the needed value without virtqueue size increasing. To fix the performance flaw in the old linux kernels, it's needed to increse seg_max to 254, and comply the restriction by setting virtqueue_size to 256. This is achievable if seabios can support virtqueue size > 128 which this patch actually does. Windows kernels don't have virtqueue_size >=3D seg_max restriction and isn't affected with this kind of the performance bug. Signed-off-by: Denis Plotnikov --- src/hw/virtio-ring.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hw/virtio-ring.h b/src/hw/virtio-ring.h index 8604a01..dccc50d 100644 --- a/src/hw/virtio-ring.h +++ b/src/hw/virtio-ring.h @@ -20,7 +20,7 @@ #define VIRTIO_F_VERSION_1 32 #define VIRTIO_F_IOMMU_PLATFORM 33 =20 -#define MAX_QUEUE_NUM (128) +#define MAX_QUEUE_NUM (256) =20 #define VRING_DESC_F_NEXT 1 #define VRING_DESC_F_WRITE 2 --=20 2.17.0 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org