virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Matias Ezequiel Vara Larsen <mvaralar@redhat.com>
Cc: Francesco Valla <francesco@valla.it>,
	Marc Kleine-Budde <mkl@pengutronix.de>,
	Vincent Mailhol <mailhol@kernel.org>,
	Harald Mommer <harald.mommer@oss.qualcomm.com>,
	Mikhail Golubev-Ciuchea
	<mikhail.golubev-ciuchea@oss.qualcomm.com>,
	Jason Wang <jasowang@redhat.com>,
	Xuan Zhuo <xuanzhuo@linux.alibaba.com>,
	linux-can@vger.kernel.org, virtualization@lists.linux.dev,
	Wolfgang Grandegger <wg@grandegger.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Stefano Garzarella <sgarzare@redhat.com>
Subject: Re: [PATCH v6] can: virtio: Add virtio CAN driver
Date: Sun, 14 Dec 2025 02:20:36 -0500	[thread overview]
Message-ID: <20251214022000-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <aTw2LORF0QiEcgM1@fedora>

On Fri, Dec 12, 2025 at 04:35:08PM +0100, Matias Ezequiel Vara Larsen wrote:
> > > +
> > > +	priv->can_ctr_msg.cpkt_out.msg_type = cpu_to_le16(msg_type);
> > > +	sg_init_one(&sg_out, &priv->can_ctr_msg.cpkt_out,
> > > +		    sizeof(priv->can_ctr_msg.cpkt_out));
> > > +	sg_init_one(&sg_in, &priv->can_ctr_msg.cpkt_in, sizeof(priv->can_ctr_msg.cpkt_in));
> > > +
> > > +	err = virtqueue_add_sgs(vq, sgs, 1u, 1u, priv, GFP_ATOMIC);
> > > +	if (err != 0) {
> > > +		/* Not expected to happen */
> > > +		dev_err(dev, "%s(): virtqueue_add_sgs() failed\n", __func__);
> > > +		mutex_unlock(&priv->ctrl_lock);
> > > +		return VIRTIO_CAN_RESULT_NOT_OK;
> > > +	}
> > > +
> > > +	if (!virtqueue_kick(vq)) {
> > > +		/* Not expected to happen */
> > > +		dev_err(dev, "%s(): Kick failed\n", __func__);
> > > +		mutex_unlock(&priv->ctrl_lock);
> > > +		return VIRTIO_CAN_RESULT_NOT_OK;
> > > +	}
> > > +
> > > +	while (!virtqueue_get_buf(vq, &len) && !virtqueue_is_broken(vq))
> > > +		wait_for_completion(&priv->ctrl_done);
> > > +
> > 
> > Since the call is synchronous, does can_ctr_msg really need to be part
> > of priv? Cannot be it allocated from the stack?
> > 
> 
> I tried to allocate in the stack but the guest blocks when during `ip
> link set up can0`, any idea?

you can not DMA to/from the stack, really.

-- 
MST


  reply	other threads:[~2025-12-14  7:20 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-29 17:40 [PATCH v6] can: virtio: Add virtio CAN driver Matias Ezequiel Vara Larsen
2025-11-03 21:37 ` Francesco Valla
2025-12-11 17:52   ` Matias Ezequiel Vara Larsen
2025-12-14 15:25     ` Francesco Valla
2025-12-18 19:51       ` Harald Mommer
2025-12-18 23:07         ` Francesco Valla
2025-12-21 13:01         ` Michael S. Tsirkin
2025-12-26 19:45         ` Matias Ezequiel Vara Larsen
2025-12-26 15:08       ` Francesco Valla
2025-12-26 20:52       ` Matias Ezequiel Vara Larsen
2025-12-26 22:22         ` Francesco Valla
2025-12-29 15:47           ` Matias Ezequiel Vara Larsen
2025-12-29 18:53       ` Matias Ezequiel Vara Larsen
2025-12-29 20:55         ` Francesco Valla
2025-12-31 21:08           ` Matias Ezequiel Vara Larsen
2025-12-12 15:35   ` Matias Ezequiel Vara Larsen
2025-12-14  7:20     ` Michael S. Tsirkin [this message]
2025-12-14 14:24       ` Francesco Valla
2025-11-17  9:49 ` Michael S. Tsirkin

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=20251214022000-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=francesco@valla.it \
    --cc=harald.mommer@oss.qualcomm.com \
    --cc=jasowang@redhat.com \
    --cc=kuba@kernel.org \
    --cc=linux-can@vger.kernel.org \
    --cc=mailhol@kernel.org \
    --cc=mikhail.golubev-ciuchea@oss.qualcomm.com \
    --cc=mkl@pengutronix.de \
    --cc=mvaralar@redhat.com \
    --cc=pabeni@redhat.com \
    --cc=sgarzare@redhat.com \
    --cc=virtualization@lists.linux.dev \
    --cc=wg@grandegger.com \
    --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;
as well as URLs for NNTP newsgroup(s).