Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1731266
| From | Stefano Stabellini <sstabellini@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v3 11/13] xen/pvcalls: implement poll command |
| Date | 2017-09-13 00:20 +0200 |
| Message-ID | <up1Hc-7bb-9@gated-at.bofh.it> (permalink) |
| References | (1 earlier) <u9rPj-3Gg-17@gated-at.bofh.it> <u9rPk-3Gg-37@gated-at.bofh.it> <ueQN4-63Q-21@gated-at.bofh.it> <unAzn-5dI-7@gated-at.bofh.it> <uoUcG-2jr-25@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tue, 12 Sep 2017, Boris Ostrovsky wrote:
> >>> +
> >>> +unsigned int pvcalls_front_poll(struct file *file, struct socket *sock,
> >>> + poll_table *wait)
> >>> +{
> >>> + struct pvcalls_bedata *bedata;
> >>> + struct sock_mapping *map;
> >>> +
> >>> + if (!pvcalls_front_dev)
> >>> + return POLLNVAL;
> >>> + bedata = dev_get_drvdata(&pvcalls_front_dev->dev);
> >>> +
> >>> + map = (struct sock_mapping *) READ_ONCE(sock->sk->sk_send_head);
> >> I just noticed this --- why is it READ_ONCE? Are you concerned that
> >> sk_send_head may change?
> > No, but I wanted to avoid partial reads. A caller could call
> > pvcalls_front_accept and pvcalls_front_poll on newsock almost at the
> > same time (it is probably not the correct way to use the API), I wanted
> > to make sure that "map" is either read correctly, or not read at all.
>
> How can you have a partial read on a pointer?
I don't think that the compiler makes any promises on translating a
pointer read into a single read instruction. Of couse, I expect gcc to
actually do it without any need for READ/WRITE_ONCE.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [PATCH v3 11/13] xen/pvcalls: implement poll command Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2017-09-12 16:20 +0200
Re: [PATCH v3 11/13] xen/pvcalls: implement poll command Stefano Stabellini <sstabellini@kernel.org> - 2017-09-13 00:20 +0200
Re: [PATCH v3 11/13] xen/pvcalls: implement poll command Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2017-09-13 01:10 +0200
Re: [PATCH v3 11/13] xen/pvcalls: implement poll command Stefano Stabellini <sstabellini@kernel.org> - 2017-09-13 01:20 +0200
Re: [PATCH v3 11/13] xen/pvcalls: implement poll command Stefano Stabellini <sstabellini@kernel.org> - 2017-09-13 01:20 +0200
csiph-web