All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: Peng Tao <bergwolf@gmail.com>
Cc: David Miller <davem@davemloft.net>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	Jorgen Hansen <jhansen@vmware.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	kvm@vger.kernel.org, virtualization@lists.linux-foundation.org
Subject: Re: [PATCH-v4-RESEND 1/4] vsock: track pkt owner vsock
Date: Fri, 10 Mar 2017 09:48:49 +0800	[thread overview]
Message-ID: <20170310014849.GA3213@stefanha-x1.localdomain> (raw)
In-Reply-To: <CA+a=Yy4T1WRZoYM3WPD0et7QzF0RYUtRerDS_X-dU5uABixTJw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1797 bytes --]

On Fri, Mar 03, 2017 at 09:25:54AM +0800, Peng Tao wrote:
> On Fri, Mar 3, 2017 at 5:13 AM, David Miller <davem@davemloft.net> wrote:
> > From: Peng Tao <bergwolf@gmail.com>
> > Date: Wed,  1 Mar 2017 11:56:24 +0800
> >
> >> So that we can cancel a queued pkt later if necessary.
> >>
> >> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
> >> Signed-off-by: Peng Tao <bergwolf@gmail.com>
> >> ---
> >>  include/linux/virtio_vsock.h            | 2 ++
> >>  net/vmw_vsock/virtio_transport_common.c | 7 +++++++
> >>  2 files changed, 9 insertions(+)
> >>
> >> diff --git a/include/linux/virtio_vsock.h b/include/linux/virtio_vsock.h
> >> index 9638bfe..193ad3a 100644
> >> --- a/include/linux/virtio_vsock.h
> >> +++ b/include/linux/virtio_vsock.h
> >> @@ -48,6 +48,7 @@ struct virtio_vsock_pkt {
> >>       struct virtio_vsock_hdr hdr;
> >>       struct work_struct work;
> >>       struct list_head list;
> >> +     void *cancel_token; /* only used for cancellation */
> >
> > The type here is fixed, you only store vhost_sock object pointers
> > here, so don't use "void *" please.
> It used to be "struct vhost_sock *" but no refcount is held. Stefan
> suggested to use "void *cancel_token" to make the code harder to
> misuse.
> 
> Quoting Stefan:
> "This field is just an opaque token used for cancellation rather than
> a struct vsock_sock pointer that we are allowed to dereference.  You
> could change this field to void *cancel_token to make the code harder
> to misuse."
> 
> Ref:
> https://www.mail-archive.com/netdev@vger.kernel.org/msg142550.html

Yes, the key point is that it shouldn't be used as a struct vsock_sock
since we don't hold a reference.  It's purely a token so the queued
packet can be found later for cancellation.

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

  parent reply	other threads:[~2017-03-10  1:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-01  3:56 [PATCH-v4-RESEND 0/4] vsock: cancel connect packets when failing to connect Peng Tao
2017-03-01  3:56 ` [PATCH-v4-RESEND 1/4] vsock: track pkt owner vsock Peng Tao
2017-03-02 21:13   ` David Miller
2017-03-03  1:25     ` Peng Tao
2017-03-10  1:48       ` Stefan Hajnoczi
2017-03-10  1:48       ` Stefan Hajnoczi [this message]
2017-03-01  3:56 ` [PATCH-v4-RESEND 2/4] vhost-vsock: add pkt cancel capability Peng Tao
2017-03-01  3:56 ` [PATCH-v4-RESEND 3/4] vsock: " Peng Tao
2017-03-01  3:56 ` [PATCH-v4-RESEND 4/4] vsock: cancel packets when failing to connect Peng Tao

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=20170310014849.GA3213@stefanha-x1.localdomain \
    --to=stefanha@gmail.com \
    --cc=bergwolf@gmail.com \
    --cc=davem@davemloft.net \
    --cc=jhansen@vmware.com \
    --cc=kvm@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=stefanha@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.