mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Cc: "Xuan Zhuo" <xuanzhuo@linux.alibaba.com>,
	"Jason Wang" <jasowang@redhat.com>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	virtualization@lists.linux.dev,
	"Si-Wei Liu" <si-wei.liu@oracle.com>,
	"Darren Kenny" <darren.kenny@oracle.com>,
	"Boris Ostrovsky" <boris.ostrovsky@oracle.com>,
	"Eugenio Pérez" <eperezma@redhat.com>
Subject: [RFC PATCH v2 7/7] Revert "virtio_ring: enable premapped mode whatever use_dma_api"
Date: Fri, 6 Sep 2024 05:52:44 -0400	[thread overview]
Message-ID: <e8a8f8c3a2d67b25dd261184da6684fda1813c6d.1725616135.git.mst@redhat.com> (raw)
In-Reply-To: <cover.1725616135.git.mst@redhat.com>

This reverts commit f9dac92ba9081062a6477ee015bd3b8c5914efc4.

leads to crashes with no ACCESS_PLATFORM when
sysctl net.core.high_order_alloc_disable=1

Cc: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Reported-by: Si-Wei Liu <si-wei.liu@oracle.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 drivers/virtio/virtio_ring.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index be7309b1e860..06b5bdf0920e 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -2782,7 +2782,7 @@ EXPORT_SYMBOL_GPL(virtqueue_resize);
  *
  * Returns zero or a negative error.
  * 0: success.
- * -EINVAL: too late to enable premapped mode, the vq already contains buffers.
+ * -EINVAL: vring does not use the dma api, so we can not enable premapped mode.
  */
 int virtqueue_set_dma_premapped(struct virtqueue *_vq)
 {
@@ -2798,6 +2798,11 @@ int virtqueue_set_dma_premapped(struct virtqueue *_vq)
 		return -EINVAL;
 	}
 
+	if (!vq->use_dma_api) {
+		END_USE(vq);
+		return -EINVAL;
+	}
+
 	vq->premapped = true;
 	vq->do_unmap = false;
 
-- 
MST


      parent reply	other threads:[~2024-09-06  9:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-06  9:52 [RFC PATCH v2 0/7] Revert "virtio_net: rx enable premapped mode by default" Michael S. Tsirkin
2024-09-06  9:52 ` [RFC PATCH v2 1/7] Revert "virtio_net: xsk: rx: support recv merge mode" Michael S. Tsirkin
2024-09-06  9:52 ` [RFC PATCH v2 2/7] Revert "virtio_net: xsk: rx: support recv small mode" Michael S. Tsirkin
2024-09-06  9:52 ` [RFC PATCH v2 3/7] Revert "virtio_net: xsk: rx: support fill with xsk buffer" Michael S. Tsirkin
2024-09-06  9:52 ` [RFC PATCH v2 4/7] Revert "virtio_net: xsk: bind/unbind xsk for rx" Michael S. Tsirkin
2024-09-06  9:52 ` [RFC PATCH v2 5/7] Revert "virtio_net: rx remove premapped failover code" Michael S. Tsirkin
2024-09-06 10:02   ` Xuan Zhuo
2024-09-06 10:12     ` Michael S. Tsirkin
2024-09-06  9:52 ` [RFC PATCH v2 6/7] Revert "virtio_net: big mode skip the unmap check" Michael S. Tsirkin
2024-09-06  9:52 ` Michael S. Tsirkin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e8a8f8c3a2d67b25dd261184da6684fda1813c6d.1725616135.git.mst@redhat.com \
    --to=mst@redhat.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=darren.kenny@oracle.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eperezma@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=si-wei.liu@oracle.com \
    --cc=virtualization@lists.linux.dev \
    --cc=xuanzhuo@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®