netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Graf <tgraf@suug.ch>
To: jamal <hadi@cyberus.ca>
Cc: kaber@trash.net, netdev@vger.kernel.org,
	David Miller <davem@davemloft.net>
Subject: Re: [PATCH 2/3] [VLAN]: Update iif when receiving via VLAN device
Date: Sat, 8 Jul 2006 12:54:51 +0200	[thread overview]
Message-ID: <20060708105451.GG14627@postel.suug.ch> (raw)
In-Reply-To: <1151760901.5093.141.camel@jzny2>

* jamal <hadi@cyberus.ca> 2006-07-01 09:35
> On Sat, 2006-01-07 at 13:28 +0200, Thomas Graf wrote:
> > Please enlighten me, I may be making a wrong assumption again.
> > 
> > 1) tc_verd is reset to 0 after dq in ri_tasklet()
> > 2) TC_AT is set to AT_EGRESS in dev_queue_xmit()
> > 3) TC_FROM being derived from TC_AT in tcf_mirred() when redirecting
> > 4) TC_FROM has the value AT_EGRESS when entering ifb_xmit()
> > 
> 
> Let me answer the next bit and it may clear this.

It's pretty clear actually, given eth0->ifb0->ifb1 it would look
like:

dev_queue_xmit(eth0)
  tcf_mirred -> ifb0
dev_queue_xmit(ifb0)
  tcf_mirred -> ifb1
dev_queue_xmit(ifb1)
  ifb_xmit(ifb1)
  <QUEUE> /* Here we queue the packet for the first time and
             release the stack of tx locks acquired on the
	     way. TC_FROM was never reset up here so this can't
	     possibly prevent any tx deadlocks. However, the
	     !from check is effective later on ... */
  ri_tasklet(ifb1)
dev_queue_xmit(ifb0)
  ifb_xmit(ifb0) /* classification disabled */
    /* Drop due to !from with input_dev = ifb1 which is
       good as it prevents to loop the packet back to
       ifb1 again which I refered to earlier */

Is this how it was intented?

> using what i said as looping in the case of A->B->C->D->A for the case
> of egress since that is what you are alluding to;
> note that ifb0 will be entered twice: First for example the tasklet in
> ifb0 will emit the packet, and then it will go all the way back to xmit
> on ifb0. This is where the issue is. Does that clear it?

I tried to stay out of A->B->A for now since that's currently
broken due to mirred unless the deadlock is intentional, f.e.
when setting up eth0->ifb0->eth0 like this:

ip link set ifb0 up
tc qdisc add dev ifb0 parent root handle 1: prio
tc qdisc add dev eth0 parent root handle 1: prio
tc filter add dev eth0 parent 1: protocol ip prio 10 u32
          match ip protocol 1 0xff flowid 1:1
	  action mirred egress redirect dev ifb0
tc filter add dev ifb0 parent 1: protocol ip prio 10 u32
          match ip protocol 1 0xff flowid 1:1
	  action mirred egress redirect dev eth0

The following deadlock will ocur:

dev_queue_xmit(eth0)
  tcf_mirred -> ifb0  /* acquire tcf_mirred->lock on eth0 */
dev_queue_xmit(ifb0)
  tcf_mirred -> eth0  /* acquire tcf_mirred->lock on ifb0
dev_queue_xmit(eth0)
  tcf_mirred -> ifb0  /* deadlock */

This is assuming that no tx deadlock happens of course. I
did try this out just to make sure, the machine just hung.
I can't see any code trying to prevent this but this is
another discussion as ifb is not involved in this, I think
it's purely a problem of mirred.

  reply	other threads:[~2006-07-08 10:54 UTC|newest]

Thread overview: 91+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-26 14:54 [PATCHSET] Towards accurate incoming interface information Thomas Graf
2006-06-25 22:00 ` [PATCH 1/3] [NET]: Use interface index to keep input device information Thomas Graf
2006-06-25 22:00 ` [PATCH 2/3] [VLAN]: Update iif when receiving via VLAN device Thomas Graf
2006-06-26 17:04   ` Patrick McHardy
2006-06-26 17:46     ` David Miller
2006-06-26 18:24       ` Patrick McHardy
2006-06-26 18:44       ` Thomas Graf
2006-06-26 22:29         ` Patrick McHardy
2006-06-26 22:49           ` Patrick McHardy
2006-06-27 10:03           ` Thomas Graf
2006-06-27 13:07             ` jamal
2006-06-28 10:18               ` Thomas Graf
2006-06-28 12:22                 ` jamal
2006-06-28 13:01                   ` Thomas Graf
2006-06-28 13:46                     ` jamal
2006-06-29  8:51                       ` Thomas Graf
2006-06-29 20:55                         ` Thomas Graf
2006-06-29 23:23                         ` jamal
2006-06-29 23:39                           ` Thomas Graf
2006-06-29 23:47                             ` David Miller
2006-06-30  0:08                               ` jamal
2006-06-30  0:12                                 ` David Miller
2006-06-30  0:26                                   ` jamal
2006-06-30  0:29                                     ` David Miller
2006-06-30  0:44                                       ` Ben Greear
2006-06-30  0:48                                       ` jamal
2006-06-30  0:55                                         ` Thomas Graf
2006-06-30  1:18                                           ` jamal
2006-06-30  0:03                             ` jamal
2006-06-30  0:46                               ` Thomas Graf
2006-06-30  1:11                                 ` jamal
2006-06-30 13:08                                   ` Thomas Graf
2006-06-30 13:20                                     ` Nicolas Dichtel
2006-06-30 13:57                                     ` jamal
2006-06-30 14:15                                       ` Thomas Graf
2006-06-30 14:35                                         ` jamal
2006-06-30 15:40                                           ` Ben Greear
2006-06-30 16:32                                           ` Thomas Graf
2006-06-30 17:13                                             ` Thomas Graf
2006-06-30 17:18                                               ` Patrick McHardy
2006-06-30 17:32                                                 ` jamal
2006-06-30 17:42                                                   ` Patrick McHardy
2006-06-30 17:44                                                     ` Thomas Graf
2006-06-30 19:40                                                     ` jamal
2006-06-30 20:17                                                       ` David Miller
2006-06-30 17:42                                                   ` Thomas Graf
2006-06-30 19:34                                                     ` jamal
2006-06-30 20:08                                                       ` Thomas Graf
2006-06-30 20:42                                                         ` jamal
2006-06-30 17:27                                               ` Ben Greear
2006-06-30 21:09                                               ` jamal
2006-06-30 21:20                                                 ` Thomas Graf
2006-06-30 21:35                                                   ` jamal
2006-06-30 23:22                                                     ` Thomas Graf
2006-07-01  2:23                                                       ` jamal
2006-07-01 11:51                                                         ` Thomas Graf
2006-07-01 13:47                                                           ` jamal
2006-06-30 17:19                                             ` jamal
2006-06-30 17:33                                               ` Patrick McHardy
2006-06-30 19:59                                                 ` jamal
2006-06-30 20:30                                                   ` Thomas Graf
2006-06-30 20:33                                                     ` David Miller
2006-06-30 20:54                                                       ` jamal
2006-06-30 21:10                                                         ` Thomas Graf
2006-06-30 21:31                                                           ` jamal
2006-06-30 23:45                                                             ` Thomas Graf
2006-07-01  2:59                                                               ` jamal
2006-07-01 11:28                                                                 ` Thomas Graf
2006-07-01 13:35                                                                   ` jamal
2006-07-08 10:54                                                                     ` Thomas Graf [this message]
2006-07-08 14:14                                                                       ` Jamal Hadi Salim
2006-07-08 14:29                                                                         ` Jamal Hadi Salim
2006-07-08 23:46                                                                         ` Thomas Graf
2006-07-08 23:48                                                                           ` Thomas Graf
2006-07-09 12:52                                                                           ` Jamal Hadi Salim
2006-07-09 13:17                                                                             ` Jamal Hadi Salim
2006-07-09 13:33                                                                             ` Thomas Graf
2006-07-09 14:03                                                                               ` Jamal Hadi Salim
2006-07-09 14:19                                                                                 ` Thomas Graf
2006-07-09 15:00                                                                                   ` Jamal Hadi Salim
2006-07-09 15:54                                                                                     ` Thomas Graf
2006-07-09 23:06                                                                                       ` Jamal Hadi Salim
2006-07-01  2:47                                                   ` Patrick McHardy
2006-06-30 17:34                                               ` Thomas Graf
     [not found]                                     ` <44A52435.20909@6wind.com>
2006-06-30 13:36                                       ` Thomas Graf
2006-06-30 13:43                                         ` Nicolas Dichtel
2006-06-30 17:01                                       ` Patrick McHardy
2006-06-30 17:02                                         ` Patrick McHardy
2006-06-25 22:00 ` [PATCH 3/3] [PKT_SCHED]: Add iif meta match Thomas Graf
2006-06-27 15:07 ` [PATCHSET] Towards accurate incoming interface information Thomas Graf
2006-06-27 20:24   ` 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=20060708105451.GG14627@postel.suug.ch \
    --to=tgraf@suug.ch \
    --cc=davem@davemloft.net \
    --cc=hadi@cyberus.ca \
    --cc=kaber@trash.net \
    --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).