From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 251FE2C029C for ; Fri, 19 Sep 2025 07:32:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758267129; cv=none; b=IlWOClghvddzxHjLTOYqNjCk2KfRC/H9T3S+Ul8vC13eI38IfV0k49nBTeH7Cqr/VxUPrjSwjmyPs4/mkbvWn4Y5wt5r0T0+sQ0nmhpVz40ED+5/kIajI0Uj4eDTopOzxEm6YS5hUXhRVccJ2mzinhAlmhQzNOnl4jxTKRV1gBo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758267129; c=relaxed/simple; bh=Q9V10L3zpFt542NCMSXEmdPFVTCJ9BGBkLn+Yt2+Dqo=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=NilCvhcb3HCRTkeH5BgR5fnYNbXsbvYsyrVv8BockESMWA5EsULFMiwiTfg+420nzqGh6uLgdq4ysBYZKliyByAj4sHLZFk9ZgXdETVgMEorhT9YwH5KcM+BQ0y/icMHJM2LdZGZdmkftdy/NUJo7yx4DBHdIPWF6guCxpwu+FU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=AnftLK9a; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="AnftLK9a" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1758267127; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Cj8To7SQBh/tsj0Y0jXY9nEJTzI5ZwuQKEQXYkBKpnw=; b=AnftLK9agAh+wzsvuGkFT58iz3hQR5aW4wmkJr90+Ry94PRMfw4Kg11UcVMi6QKhWApX5c W2oXHQFn7llRv+ohA2z8wa+IFVHHV01a12Jd80wj/VSCuvQv7UKMLX5rVuFVAOyblqX4a5 rKGDn1Pqr/oFBlF2LjP3zbo35fkjQ6M= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-401--NN6HZk5OJCTgy-XABJ1Dw-1; Fri, 19 Sep 2025 03:32:03 -0400 X-MC-Unique: -NN6HZk5OJCTgy-XABJ1Dw-1 X-Mimecast-MFC-AGG-ID: -NN6HZk5OJCTgy-XABJ1Dw_1758267122 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1ED8618002D6; Fri, 19 Sep 2025 07:32:02 +0000 (UTC) Received: from localhost.localdomain (unknown [10.72.112.45]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id BC6821956045; Fri, 19 Sep 2025 07:31:58 +0000 (UTC) From: Jason Wang To: mst@redhat.com, jasowang@redhat.com, xuanzhuo@linux.alibaba.com, eperezma@redhat.com, virtualization@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH V6 00/19] virtio_ring in order support Date: Fri, 19 Sep 2025 15:31:35 +0800 Message-ID: <20250919073154.49278-1-jasowang@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Hello all: This sereis tries to implement the VIRTIO_F_IN_ORDER to virtio_ring. This is done by introducing virtqueue ops so we can implement separate helpers for different virtqueue layout/features then the in-order were implemented on top. Tests shows 2%-19% imporvment with packed virtqueue PPS with KVM guest vhost-net/testpmd on the host. Changes since V5: - rebase on vhost.git linux-next branch - reorder the total_len to reduce memory comsuming Changes since V4: - Fix build error when DEBUG is enabled - Fix function duplications - Remove unnecessary new lines Changes since V3: - Re-benchmark with the recent vhost-net in order support - Rename the batched used id and length - Other minor tweaks Changes since V2: - Fix build warning when DEBUG is enabled Changes since V1: - use const global array of function pointers to avoid indirect branches to eliminate retpoline when mitigation is enabled - fix used length calculation when processing used ids in a batch - fix sparse warnings Jason Wang (19): virtio_ring: rename virtqueue_reinit_xxx to virtqueue_reset_xxx() virtio_ring: switch to use vring_virtqueue in virtqueue_poll variants virtio_ring: unify logic of virtqueue_poll() and more_used() virtio_ring: switch to use vring_virtqueue for virtqueue resize variants virtio_ring: switch to use vring_virtqueue for virtqueue_kick_prepare variants virtio_ring: switch to use vring_virtqueue for virtqueue_add variants virtio: switch to use vring_virtqueue for virtqueue_add variants virtio_ring: switch to use vring_virtqueue for enable_cb_prepare variants virtio_ring: use vring_virtqueue for enable_cb_delayed variants virtio_ring: switch to use vring_virtqueue for disable_cb variants virtio_ring: switch to use vring_virtqueue for detach_unused_buf variants virtio_ring: use u16 for last_used_idx in virtqueue_poll_split() virtio_ring: introduce virtqueue ops virtio_ring: determine descriptor flags at one time virtio_ring: factor out core logic of buffer detaching virtio_ring: factor out core logic for updating last_used_idx virtio_ring: factor out split indirect detaching logic virtio_ring: factor out split detaching logic virtio_ring: add in order support drivers/virtio/virtio_ring.c | 889 ++++++++++++++++++++++++++--------- 1 file changed, 678 insertions(+), 211 deletions(-) -- 2.31.1