netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Duyck <alexander.h.duyck@redhat.com>
To: David Miller <davem@davemloft.net>, netdev@vger.kernel.org
Subject: Re: eth_get_headlen() and unaligned accesses...
Date: Thu, 09 Oct 2014 20:10:01 -0700	[thread overview]
Message-ID: <54374E09.1020907@redhat.com> (raw)
In-Reply-To: <20141009.201248.1210454965155680255.davem@davemloft.net>

On 10/09/2014 05:12 PM, David Miller wrote:
> So, we have a bit of a problem, this is on sparc64:
>
> [423475.740836] Kernel unaligned access at TPC[81d330] __skb_flow_get_ports+0x70/0xe0
> [423475.755756] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.17.0+ #2
> [423475.767854] Call Trace:
> [423475.772877]  [0000000000433288] kernel_unaligned_trap+0x368/0x5c0
> [423475.785203]  [000000000042a824] sun4v_do_mna+0x84/0xa0
> [423475.795624]  [0000000000406cd0] sun4v_mna+0x5c/0x68
> [423475.805521]  [000000000081d330] __skb_flow_get_ports+0x70/0xe0
> [423475.817323]  [000000000081d6ac] __skb_flow_dissect+0x1ac/0x460
> [423475.829128]  [0000000000843c98] eth_get_headlen+0x38/0xa0
> [423475.840083]  [0000000010064d54] igb_poll+0x8d4/0xf60 [igb]
> [423475.851184]  [00000000008243c8] net_rx_action+0xa8/0x1c0
>
> The chip DMA's to the beginning of a frag page and (unless timestamps
> are enabled) that's where the ethernet header begins.
>
> So any larger than 16-bit access to the IP and later headers will be
> unaligned.
>
> We have various ways we can deal with this based upon the capabilities
> of the chips involved.  Can we configure the IGB to put 2 "don't care"
> bytes at the beginning of the packet?

The problem is the igb part expects to be able to use 2K buffers which 
means it will always try to use the full half of a page.  I had 
forgotten that the function this replaced had worked with unaligned 
accesses as all of the fields I was pulling were only 16b in width.  I 
think I assumed that this function was already setup to handle that.

Actually the fix should be pretty simple.  Just do what we already 
appear to be doing for the iph_to_flow_copy_addrs.  We can use memcpy to 
copy the 4 bytes for the port data instead of doing the direct assignment.

I'll try to submit a patch, just need to see if I have a tree setup as 
it has been a couple weeks.

Thanks,

Alex

  reply	other threads:[~2014-10-10  3:10 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-10  0:12 eth_get_headlen() and unaligned accesses David Miller
2014-10-10  3:10 ` Alexander Duyck [this message]
2014-10-10  4:43   ` David Miller
2014-10-10 10:59     ` David Laight
2014-10-10  4:03 ` [PATCH] flow-dissector: Fix alignment issue in __skb_flow_get_ports alexander.duyck
2014-10-10  4:47   ` David Miller
2014-10-10 14:42     ` Alexander Duyck
2014-10-10 14:57       ` David Laight
2014-10-10 15:14         ` Alexander Duyck
2014-10-10 15:29           ` Eric Dumazet
2014-10-10 16:50             ` Alexander Duyck
2014-10-10 17:58               ` David Miller
2014-10-10 18:02                 ` Alexander Duyck
2014-10-10 18:14                   ` David Miller
2014-10-10 18:15                   ` David Miller
2014-10-10 18:22                     ` David Miller
2014-10-10 18:53                       ` Alexander Duyck
2014-10-10 19:32                         ` David Miller
2014-10-13  8:32                 ` David Laight
2014-10-10 15:33         ` Eric Dumazet
2014-10-10 16:30           ` David Laight
2014-10-10 16:41           ` David Miller
2014-10-10 14:59 ` [PATCH v2] " alexander.duyck
2014-10-10 15:36   ` Eric Dumazet
2014-10-10 17:55     ` David Miller
2014-10-10 18:41 ` eth_get_headlen() and unaligned accesses Tom Herbert

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=54374E09.1020907@redhat.com \
    --to=alexander.h.duyck@redhat.com \
    --cc=davem@davemloft.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).