All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Vrabel <david.vrabel@citrix.com>
To: Vladimir Murzin <murzin.v@gmail.com>
Cc: xen-devel@lists.xenproject.org, boris.ostrovsky@oracle.com,
	Ian.Campbell@citrix.com, JBeulich@suse.com,
	david.vrabel@citrix.com
Subject: Re: [PATCH v2] xen: fix alignment for bitops
Date: Thu, 17 Apr 2014 11:22:27 +0100	[thread overview]
Message-ID: <534FAB63.60709@citrix.com> (raw)
In-Reply-To: <1397634938-5470-1-git-send-email-murzin.v@gmail.com>

On 16/04/14 08:55, Vladimir Murzin wrote:
> Bitops operations like set/clear/change mandate world aligned pointer, mainly
> because architectures specific implementation.
> 
> Looks that DEFINE_PER_CPU does required alignment for cpu_control_block;
> however, local copy used for bitops might not be world aligned.
> 
> For arm64 it ends up with unaligned access trap...

Thanks.  Does this version work for you?

David

8<----------------------
xen/events/fifo: fix alignment for bitops on local ready word

Bitops operations like set_bit(), clear_bit(), and test_bit() require
word aligned pointers, because of architectures specific
implementations.

Looks that DEFINE_PER_CPU does required alignment for
cpu_control_block; however, local copy of the ready word might not be
word aligned.

For arm64 it ends up with unaligned access trap at:

    if (head == 0)
        clear_bit(priority, BM(ready));

Use unsigned long for "ready" to make sure it is word aligned.

Signed-off-by: Vladimir Murzin <murzin.v@gmail.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com
---
 drivers/xen/events/events_fifo.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/xen/events/events_fifo.c b/drivers/xen/events/events_fifo.c
index 96109a9..475d967 100644
--- a/drivers/xen/events/events_fifo.c
+++ b/drivers/xen/events/events_fifo.c
@@ -243,7 +243,7 @@ static void handle_irq_for_port(unsigned port)
 
 static void consume_one_event(unsigned cpu,
 			      struct evtchn_fifo_control_block *control_block,
-			      unsigned priority, uint32_t *ready)
+			      unsigned priority, unsigned long *ready)
 {
 	struct evtchn_fifo_queue *q = &per_cpu(cpu_queue, cpu);
 	uint32_t head;
@@ -273,7 +273,7 @@ static void consume_one_event(unsigned cpu,
 	 * copy of the ready word.
 	 */
 	if (head == 0)
-		clear_bit(priority, BM(ready));
+		clear_bit(priority, ready);
 
 	if (sync_test_bit(EVTCHN_FIFO_PENDING, BM(word))
 	    && !sync_test_bit(EVTCHN_FIFO_MASKED, BM(word)))
@@ -285,7 +285,7 @@ static void consume_one_event(unsigned cpu,
 static void evtchn_fifo_handle_events(unsigned cpu)
 {
 	struct evtchn_fifo_control_block *control_block;
-	uint32_t ready;
+	unsigned long ready;
 	unsigned q;
 
 	control_block = per_cpu(cpu_control_block, cpu);

  parent reply	other threads:[~2014-04-17 10:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-16  7:55 [PATCH v2] xen: fix alignment for bitops Vladimir Murzin
2014-04-17  7:42 ` Vladimir Murzin
2014-04-17 10:22 ` David Vrabel [this message]
2014-04-21 10:28   ` Pranavkumar Sawargaonkar
2014-04-21 16:27     ` Vladimir Murzin
2014-04-24  7:38       ` Vladimir Murzin
2014-04-25  5:46         ` Pranavkumar Sawargaonkar
2014-04-25 11:29           ` Pranavkumar Sawargaonkar
2014-04-21 16:00   ` Vladimir Murzin

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=534FAB63.60709@citrix.com \
    --to=david.vrabel@citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=murzin.v@gmail.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.