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


Groups > linux.kernel > #1651545 > unrolled thread

Re: [PATCH v2 11/18] xen/pvcalls: implement accept command

Started byBoris Ostrovsky <boris.ostrovsky@oracle.com>
First post2017-05-26 20:20 +0200
Last post2017-06-02 21:30 +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 v2 11/18] xen/pvcalls: implement accept command Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2017-05-26 20:20 +0200
    Re: [PATCH v2 11/18] xen/pvcalls: implement accept command Stefano Stabellini <sstabellini@kernel.org> - 2017-06-02 21:30 +0200

#1651545 — Re: [PATCH v2 11/18] xen/pvcalls: implement accept command

FromBoris Ostrovsky <boris.ostrovsky@oracle.com>
Date2017-05-26 20:20 +0200
SubjectRe: [PATCH v2 11/18] xen/pvcalls: implement accept command
Message-ID<tLs0a-Rn-5@gated-at.bofh.it>
>  static void __pvcalls_back_accept(struct work_struct *work)
>  {
> +	struct sockpass_mapping *mappass = container_of(
> +		work, struct sockpass_mapping, register_work);
> +	struct sock_mapping *map;
> +	struct pvcalls_ioworker *iow;
> +	struct pvcalls_back_priv *priv;
> +	struct xen_pvcalls_response *rsp;
> +	struct xen_pvcalls_request *req;
> +	void *page = NULL;
> +	int notify;
> +	int ret = -EINVAL;
> +	unsigned long flags;
> +
> +	priv = mappass->priv;
> +	/* We only need to check the value of "cmd" atomically on read. */
> +	spin_lock_irqsave(&mappass->copy_lock, flags);
> +	req = &mappass->reqcopy;
> +	if (req->cmd != PVCALLS_ACCEPT) {
> +		spin_unlock_irqrestore(&mappass->copy_lock, flags);
> +		return;
> +	}
> +	spin_unlock_irqrestore(&mappass->copy_lock, flags);
> +
> +	map = kzalloc(sizeof(*map), GFP_KERNEL);

From here on, the code looks almost identical to connect. Can this be
factored out?

-boris

[toc] | [next] | [standalone]


#1656480

FromStefano Stabellini <sstabellini@kernel.org>
Date2017-06-02 21:30 +0200
Message-ID<tO0qJ-5iK-1@gated-at.bofh.it>
In reply to#1651545
On Fri, 26 May 2017, Boris Ostrovsky wrote:
> >  static void __pvcalls_back_accept(struct work_struct *work)
> >  {
> > +	struct sockpass_mapping *mappass = container_of(
> > +		work, struct sockpass_mapping, register_work);
> > +	struct sock_mapping *map;
> > +	struct pvcalls_ioworker *iow;
> > +	struct pvcalls_back_priv *priv;
> > +	struct xen_pvcalls_response *rsp;
> > +	struct xen_pvcalls_request *req;
> > +	void *page = NULL;
> > +	int notify;
> > +	int ret = -EINVAL;
> > +	unsigned long flags;
> > +
> > +	priv = mappass->priv;
> > +	/* We only need to check the value of "cmd" atomically on read. */
> > +	spin_lock_irqsave(&mappass->copy_lock, flags);
> > +	req = &mappass->reqcopy;
> > +	if (req->cmd != PVCALLS_ACCEPT) {
> > +		spin_unlock_irqrestore(&mappass->copy_lock, flags);
> > +		return;
> > +	}
> > +	spin_unlock_irqrestore(&mappass->copy_lock, flags);
> > +
> > +	map = kzalloc(sizeof(*map), GFP_KERNEL);
> 
> >From here on, the code looks almost identical to connect. Can this be
> factored out?

Yes, good idea, I'll do that

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web