netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Krzysztof Mazur <krzysiek@podlesie.net>
To: David Woodhouse <dwmw2@infradead.org>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>,
	davem@davemloft.net
Subject: Re: [PATCH v3 8/7] pppoatm: fix missing wakeup in pppoatm_send()
Date: Sun, 11 Nov 2012 14:50:02 +0100	[thread overview]
Message-ID: <20121111135002.GA32390@shrek.podlesie.net> (raw)
In-Reply-To: <1352633993.9449.120.camel@shinybook.infradead.org>

On Sun, Nov 11, 2012 at 11:39:53AM +0000, David Woodhouse wrote:
> 
> Right. Something like this then, instead of my previous patch 8/7?
> 
> Only addresses the sock_owned_by_user() case and not ATM_VF_RELEASED,
> ATM_VF_CLOSE or !ATM_VF_READY, but your amended patch 6 fixes that I
> think.
> 

Looks and works ok after:

diff --git a/net/atm/pppoatm.c b/net/atm/pppoatm.c
index 7b8dafe..87e792c 100644
--- a/net/atm/pppoatm.c
+++ b/net/atm/pppoatm.c
@@ -414,6 +414,7 @@ static int pppoatm_assign_vcc(struct atm_vcc *atmvcc, void __user *arg)
 	atmvcc->user_back = pvcc;
 	atmvcc->push = pppoatm_push;
 	atmvcc->pop = pppoatm_pop;
+	atmvcc->unlock_cb = pppoatm_unlock_cb;
 	__module_get(THIS_MODULE);
 	atmvcc->owner = THIS_MODULE;

With this change:
Acked-by: Krzysztof Mazur <krzysiek@podlesie.net>

This patch should be also acked by Chas, at least changes in generic ATM
code (maybe as separate patch).

I need also an ack for new version of patch 6 (pppoatm: drop frames to
not-ready vcc).

Maybe we should schedule tasklet in pppoatm_unlock_cb() only when it's needed.


Thanks,

Krzysiek

-- >8 --
Subject: [PATCH] pppoatm: wakeup after ATM unlock only when it's needed

We need to schedule wakeup tasklet only when ATM socket locked
was previously locked. The locking is provided by the sk->sk_lock.slock
spinlock.

Signed-off-by: Krzysztof Mazur <krzysiek@podlesie.net>
---
 net/atm/pppoatm.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/net/atm/pppoatm.c b/net/atm/pppoatm.c
index 87e792c..841b9f8 100644
--- a/net/atm/pppoatm.c
+++ b/net/atm/pppoatm.c
@@ -66,6 +66,7 @@ struct pppoatm_vcc {
 	enum pppoatm_encaps encaps;
 	atomic_t inflight;
 	unsigned long blocked;
+	int need_wakeup;
 	int flags;			/* SC_COMP_PROT - compress protocol */
 	struct ppp_channel chan;	/* interface to generic ppp layer */
 	struct tasklet_struct wakeup_tasklet;
@@ -113,7 +114,10 @@ static void pppoatm_unlock_cb(struct atm_vcc *atmvcc)
 {
 	struct pppoatm_vcc *pvcc = atmvcc_to_pvcc(atmvcc);
 
-	tasklet_schedule(&pvcc->wakeup_tasklet);
+	if (pvcc->need_wakeup) {
+		pvcc->need_wakeup = 0;
+		tasklet_schedule(&pvcc->wakeup_tasklet);
+	}
 	if (pvcc->old_unlock_cb)
 		pvcc->old_unlock_cb(atmvcc);
 }
@@ -292,8 +296,10 @@ static int pppoatm_send(struct ppp_channel *chan, struct sk_buff *skb)
 
 	vcc = ATM_SKB(skb)->vcc;
 	bh_lock_sock(sk_atm(vcc));
-	if (sock_owned_by_user(sk_atm(vcc)))
+	if (sock_owned_by_user(sk_atm(vcc))) {
+		pvcc->need_wakeup = 1;
 		goto nospace;
+	}
 	if (test_bit(ATM_VF_RELEASED, &vcc->flags)
 			|| test_bit(ATM_VF_CLOSE, &vcc->flags)
 			|| !test_bit(ATM_VF_READY, &vcc->flags)) {
-- 
1.8.0.268.g9d5ca2e

  reply	other threads:[~2012-11-11 13:50 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-06 22:16 [PATCH v3 0/7] pppoatm: fix multiple issues with pppoatm driver Krzysztof Mazur
2012-11-06 22:16 ` [PATCH v3 1/7] atm: detach protocol before closing vcc Krzysztof Mazur
2012-11-06 22:16 ` [PATCH v3 2/7] atm: add owner of push() callback to atmvcc Krzysztof Mazur
2012-11-07 19:05   ` chas williams - CONTRACTOR
2012-11-06 22:16 ` [PATCH v3 3/7] pppoatm: allow assign only on a connected socket Krzysztof Mazur
2012-11-06 22:16 ` [PATCH v3 4/7] pppoatm: fix module_put() race Krzysztof Mazur
2012-11-06 22:17 ` [PATCH v3 5/7] pppoatm: take ATM socket lock in pppoatm_send() Krzysztof Mazur
2012-11-06 22:57   ` Woodhouse, David
2012-11-06 22:17 ` [PATCH v3 6/7] pppoatm: don't send frames on not-ready vcc Krzysztof Mazur
2012-11-06 22:17 ` [PATCH v3 7/7] pppoatm: do not inline pppoatm_may_send() Krzysztof Mazur
2012-11-07 12:52 ` [PATCH v3 8/7] pppoatm: fix missing wakeup in pppoatm_send() David Woodhouse
2012-11-09 21:30   ` David Miller
2012-11-10  7:36     ` David Woodhouse
2012-11-10 18:38       ` David Miller
2012-11-10 20:23   ` Krzysztof Mazur
2012-11-10 21:02     ` David Woodhouse
2012-11-10 22:33       ` Krzysztof Mazur
2012-11-11  7:28     ` David Woodhouse
2012-11-11 11:04       ` Krzysztof Mazur
2012-11-11 11:39         ` David Woodhouse
2012-11-11 13:50           ` Krzysztof Mazur [this message]
2012-11-11 15:26             ` David Woodhouse
2012-11-11 16:12               ` Krzysztof Mazur
2012-11-11 17:03                 ` David Woodhouse
2012-11-11 18:49                   ` Krzysztof Mazur
2012-11-11 20:51                     ` David Woodhouse
2012-11-11 22:57                       ` Chas Williams (CONTRACTOR)
2012-11-27 13:27                         ` David Woodhouse
2012-11-27 15:23                           ` chas williams - CONTRACTOR
2012-11-28  0:48                             ` David Woodhouse
2012-11-28  8:12                               ` Krzysztof Mazur
2012-11-28  9:24                                 ` David Woodhouse
2012-11-28  9:58                                   ` Krzysztof Mazur
2012-11-28 10:19                                     ` David Woodhouse
2012-11-11 22:47         ` Chas Williams (CONTRACTOR)

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=20121111135002.GA32390@shrek.podlesie.net \
    --to=krzysiek@podlesie.net \
    --cc=chas@cmf.nrl.navy.mil \
    --cc=davem@davemloft.net \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.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).