netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: David Vrabel <david.vrabel@citrix.com>,
	netdev@vger.kernel.org, xen-devel@lists.xenproject.org,
	konrad.wilk@oracle.com, boris.ostrovsky@oracle.com,
	edumazet@google.com, "David S. Miller" <davem@davemloft.net>
Subject: Re: caif: Fix napi poll list corruption
Date: Mon, 22 Dec 2014 10:10:01 +0008	[thread overview]
Message-ID: <1419242521.4592.0@smtp.corp.redhat.com> (raw)
In-Reply-To: <20141222093525.GA18616@gondor.apana.org.au>



On Mon, Dec 22, 2014 at 5:35 PM, Herbert Xu 
<herbert@gondor.apana.org.au> wrote:
> On Mon, Dec 22, 2014 at 04:18:33PM +0800, Jason Wang wrote:
>> 
>>  btw, looks like at least caif_virtio has the same issue.
> 
> Good catch.
> 
> -- >8 --
> The commit d75b1ade567ffab085e8adbbdacf0092d10cd09c (net: less
> interrupt masking in NAPI) breaks caif.
> 
> It is now required that if the entire budget is consumed when poll
> returns, the napi poll_list must remain empty.  However, like some
> other drivers caif tries to do a last-ditch check and if there is
> more work it will call napi_schedule and then immediately process
> some of this new work.  Should the entire budget be consumed while
> processing such new work then we will violate the new caller
> contract.
> 
> This patch fixes this by not touching any work when we reschedule
> in caif.
> 
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Acked-by: Jason Wang <jasowang@redhat.com>

Thanks.
> 
> 
> diff --git a/drivers/net/caif/caif_virtio.c 
> b/drivers/net/caif/caif_virtio.c
> index a5fefb9..b306210 100644
> --- a/drivers/net/caif/caif_virtio.c
> +++ b/drivers/net/caif/caif_virtio.c
> @@ -257,7 +257,6 @@ static int cfv_rx_poll(struct napi_struct *napi, 
> int quota)
>  	struct vringh_kiov *riov = &cfv->ctx.riov;
>  	unsigned int skb_len;
>  
> -again:
>  	do {
>  		skb = NULL;
>  
> @@ -322,7 +321,6 @@ exit:
>  		    napi_schedule_prep(napi)) {
>  			vringh_notify_disable_kern(cfv->vr_rx);
>  			__napi_schedule(napi);
> -			goto again;
>  		}
>  		break;
> 
> Thanks,
> -- 
> Email: Herbert Xu <herbert@gondor.apana.org.au>
> Home Page: http://gondor.apana.org.au/~herbert/
> PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
> 

  reply	other threads:[~2014-12-23  8:56 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-16 18:59 [PATCHv1 net] xen-netfront: use napi_complete() correctly to prevent Rx stalling David Vrabel
2014-12-16 20:22 ` David Miller
2014-12-20  0:23 ` virtio_net: Fix napi poll list corruption Herbert Xu
2014-12-20  0:36   ` net: Detect drivers that reschedule NAPI and exhaust budget Herbert Xu
2014-12-20  1:34     ` Eric Dumazet
2014-12-20  2:40       ` David Miller
2014-12-20  6:55         ` Herbert Xu
2014-12-20 18:00           ` Eric Dumazet
2014-12-20 20:14             ` [0/4] net: net_rx_action fixes and clean-ups Herbert Xu
2014-12-20 20:16               ` [PATCH 1/4] net: Move napi polling code out of net_rx_action Herbert Xu
2014-12-24  4:20                 ` David Miller
2014-12-20 20:16               ` [PATCH 2/4] net: Detect drivers that reschedule NAPI and exhaust budget Herbert Xu
2014-12-24  4:20                 ` David Miller
2014-12-20 20:16               ` [PATCH 3/4] net: Always poll at least one device in net_rx_action Herbert Xu
2014-12-24  4:20                 ` David Miller
2014-12-20 20:16               ` [PATCH 4/4] net: Rearrange loop " Herbert Xu
2014-12-24  4:20                 ` David Miller
2014-12-22  8:18   ` virtio_net: Fix napi poll list corruption Jason Wang
2014-12-22  9:35     ` caif: " Herbert Xu
2014-12-22 10:02       ` Jason Wang [this message]
2014-12-22 21:35       ` David Miller
2014-12-22 16:19   ` virtio_net: " Marcelo Ricardo Leitner
2014-12-22 21:10   ` David Miller

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=1419242521.4592.0@smtp.corp.redhat.com \
    --to=jasowang@redhat.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=davem@davemloft.net \
    --cc=david.vrabel@citrix.com \
    --cc=edumazet@google.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=konrad.wilk@oracle.com \
    --cc=netdev@vger.kernel.org \
    --cc=xen-devel@lists.xenproject.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 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).