Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1664571 > unrolled thread

Re: [PATCH v3 15/18] xen/pvcalls: implement the ioworker functions

Started byJuergen Gross <jgross@suse.com>
First post2017-06-13 10:00 +0200
Last post2017-06-14 03:00 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH v3 15/18] xen/pvcalls: implement the ioworker functions Juergen Gross <jgross@suse.com> - 2017-06-13 10:00 +0200
    Re: [PATCH v3 15/18] xen/pvcalls: implement the ioworker functions Stefano Stabellini <sstabellini@kernel.org> - 2017-06-14 03:00 +0200

#1664571 — Re: [PATCH v3 15/18] xen/pvcalls: implement the ioworker functions

FromJuergen Gross <jgross@suse.com>
Date2017-06-13 10:00 +0200
SubjectRe: [PATCH v3 15/18] xen/pvcalls: implement the ioworker functions
Message-ID<tROU1-5d9-1@gated-at.bofh.it>
On 02/06/17 21:31, Stefano Stabellini wrote:
> We have one ioworker per socket. Each ioworker goes through the list of
> outstanding read/write requests. Once all requests have been dealt with,
> it returns.
> 
> We use one atomic counter per socket for "read" operations and one
> for "write" operations to keep track of the reads/writes to do.
> 
> We also use one atomic counter ("io") per ioworker to keep track of how
> many outstanding requests we have in total assigned to the ioworker. The
> ioworker finishes when there are none.
> 
> Signed-off-by: Stefano Stabellini <stefano@aporeto.com>
> CC: boris.ostrovsky@oracle.com
> CC: jgross@suse.com
> ---
>  drivers/xen/pvcalls-back.c | 27 +++++++++++++++++++++++++++
>  1 file changed, 27 insertions(+)
> 
> diff --git a/drivers/xen/pvcalls-back.c b/drivers/xen/pvcalls-back.c
> index 6afe7a0..0283d49 100644
> --- a/drivers/xen/pvcalls-back.c
> +++ b/drivers/xen/pvcalls-back.c
> @@ -99,8 +99,35 @@ static int pvcalls_back_release_active(struct xenbus_device *dev,
>  				       struct pvcalls_fedata *priv,
>  				       struct sock_mapping *map);
>  
> +static void pvcalls_conn_back_read(unsigned long opaque)

Why not void *opaque? You could drop the cast below then.


Juergen

> +{
> +}
> +
> +static int pvcalls_conn_back_write(struct sock_mapping *map)
> +{
> +	return 0;
> +}
> +
>  static void pvcalls_back_ioworker(struct work_struct *work)
>  {
> +	struct pvcalls_ioworker *ioworker = container_of(work,
> +		struct pvcalls_ioworker, register_work);
> +	struct sock_mapping *map = container_of(ioworker, struct sock_mapping,
> +		ioworker);
> +
> +	while (atomic_read(&map->io) > 0) {
> +		if (atomic_read(&map->release) > 0) {
> +			atomic_set(&map->release, 0);
> +			return;
> +		}
> +
> +		if (atomic_read(&map->read) > 0)
> +			pvcalls_conn_back_read((unsigned long)map);
> +		if (atomic_read(&map->write) > 0)
> +			pvcalls_conn_back_write(map);
> +
> +		atomic_dec(&map->io);
> +	}
>  }
>  
>  static int pvcalls_back_socket(struct xenbus_device *dev,
> 

[toc] | [next] | [standalone]


#1665335

FromStefano Stabellini <sstabellini@kernel.org>
Date2017-06-14 03:00 +0200
Message-ID<tS4P8-6AG-7@gated-at.bofh.it>
In reply to#1664571
On Tue, 13 Jun 2017, Juergen Gross wrote:
> On 02/06/17 21:31, Stefano Stabellini wrote:
> > We have one ioworker per socket. Each ioworker goes through the list of
> > outstanding read/write requests. Once all requests have been dealt with,
> > it returns.
> > 
> > We use one atomic counter per socket for "read" operations and one
> > for "write" operations to keep track of the reads/writes to do.
> > 
> > We also use one atomic counter ("io") per ioworker to keep track of how
> > many outstanding requests we have in total assigned to the ioworker. The
> > ioworker finishes when there are none.
> > 
> > Signed-off-by: Stefano Stabellini <stefano@aporeto.com>
> > CC: boris.ostrovsky@oracle.com
> > CC: jgross@suse.com
> > ---
> >  drivers/xen/pvcalls-back.c | 27 +++++++++++++++++++++++++++
> >  1 file changed, 27 insertions(+)
> > 
> > diff --git a/drivers/xen/pvcalls-back.c b/drivers/xen/pvcalls-back.c
> > index 6afe7a0..0283d49 100644
> > --- a/drivers/xen/pvcalls-back.c
> > +++ b/drivers/xen/pvcalls-back.c
> > @@ -99,8 +99,35 @@ static int pvcalls_back_release_active(struct xenbus_device *dev,
> >  				       struct pvcalls_fedata *priv,
> >  				       struct sock_mapping *map);
> >  
> > +static void pvcalls_conn_back_read(unsigned long opaque)
> 
> Why not void *opaque? You could drop the cast below then.

Good idea

 
> > +{
> > +}
> > +
> > +static int pvcalls_conn_back_write(struct sock_mapping *map)
> > +{
> > +	return 0;
> > +}
> > +
> >  static void pvcalls_back_ioworker(struct work_struct *work)
> >  {
> > +	struct pvcalls_ioworker *ioworker = container_of(work,
> > +		struct pvcalls_ioworker, register_work);
> > +	struct sock_mapping *map = container_of(ioworker, struct sock_mapping,
> > +		ioworker);
> > +
> > +	while (atomic_read(&map->io) > 0) {
> > +		if (atomic_read(&map->release) > 0) {
> > +			atomic_set(&map->release, 0);
> > +			return;
> > +		}
> > +
> > +		if (atomic_read(&map->read) > 0)
> > +			pvcalls_conn_back_read((unsigned long)map);
> > +		if (atomic_read(&map->write) > 0)
> > +			pvcalls_conn_back_write(map);
> > +
> > +		atomic_dec(&map->io);
> > +	}
> >  }
> >  
> >  static int pvcalls_back_socket(struct xenbus_device *dev,
> > 
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web