public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Greg Ungerer <gerg@uclinux.org>
Cc: One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>,
	Linux Kernel Development <linux-kernel@vger.kernel.org>,
	Linux/m68k <linux-m68k@vger.kernel.org>
Subject: Re: rcu alignment warning tripping on m68k
Date: Fri, 6 Jun 2014 11:46:05 -0700	[thread overview]
Message-ID: <20140606184605.GT4581@linux.vnet.ibm.com> (raw)
In-Reply-To: <5387DF05.1020103@uclinux.org>

On Fri, May 30, 2014 at 11:29:41AM +1000, Greg Ungerer wrote:
> On 29/05/14 23:11, One Thousand Gnomes wrote:
> > On Thu, 29 May 2014 12:08:32 +1000
> > Greg Ungerer <gerg@uclinux.org> wrote:
> > 
> >> Hi All,
> >>
> >> Inside kernel/rcy/tree.c in __call_rcu() it does an alignment check on
> >> the head pointer passed in. This trips on m68k systems, because they only
> >> need alignment of 32bit quantities to 16bit boundaries.
> > 
> > __alignof perhaps ?
> 
> That might do. Change then becomes something like:
> 
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -2467,7 +2467,7 @@ __call_rcu(struct rcu_head *head, void (*func)(struct rcu_
>         unsigned long flags;
>         struct rcu_data *rdp;
> 
> -       WARN_ON_ONCE((unsigned long)head & 0x3); /* Misaligned rcu_head! */
> +       WARN_ON_ONCE((unsigned long)head & (__alignof__(head) - 1)); /* Misaligned rcu_head! */

Hmmm...  The purpose of the check is to reserve the low-order bits to
allow RCU to classify callbacks as being time-critical or not.  RCU
can probably live with a single bit, but if there is some architecture
out there that simply refuses to do alignment, I need to know about it.

(See "git show 0bb7b59d6e2b8" for more info.)

So how about this instead?

 -       WARN_ON_ONCE((unsigned long)head & 0x1); /* Misaligned rcu_head! */

(Trying to remember if I have seen Linux kernel code that uses both
the lower bits...)

							Thanx, Paul

>         if (debug_rcu_head_queue(head)) {
>                 /* Probable double call_rcu(), so leak the callback. */
>                 ACCESS_ONCE(head->func) = rcu_leak_callback;
> 
> Thanks
> Greg
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 


  reply	other threads:[~2014-06-06 18:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-29  2:08 rcu alignment warning tripping on m68k Greg Ungerer
2014-05-29 13:11 ` One Thousand Gnomes
2014-05-30  1:29   ` Greg Ungerer
2014-06-06 18:46     ` Paul E. McKenney [this message]
2014-06-07 13:17       ` Mikael Pettersson
2014-06-09 15:24         ` Paul E. McKenney
2014-06-10  6:22       ` Greg Ungerer

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=20140606184605.GT4581@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=gerg@uclinux.org \
    --cc=gnomes@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@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