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: Ian Campbell <ian.campbell@citrix.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will.deacon@arm.com>,
	xen-devel@lists.xenproject.org, boris.ostrovsky@oracle.com
Subject: Re: [PATCH] xen: fix alignment for bitops
Date: Tue, 15 Apr 2014 14:18:22 +0100	[thread overview]
Message-ID: <534D319E.9030804@citrix.com> (raw)
In-Reply-To: <CABV+yWsedyFNiFx8MK58wVV_7m9a=8upGfhaF1HBmjUfMZkCPA@mail.gmail.com>

On 15/04/14 14:13, Vladimir Murzin wrote:
> On Tue, Apr 15, 2014 at 2:05 PM, Vladimir Murzin <murzin.v@gmail.com> wrote:
>> On Tue, Apr 15, 2014 at 11:17 AM, David Vrabel <david.vrabel@citrix.com> wrote:
>>> On 14/04/14 21:43, 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.
>>>>
>>>> Instruct compiler to keep local copy of "ready" world aligned.
>>> [...]
>>>> --- a/drivers/xen/events/events_fifo.c
>>>> +++ b/drivers/xen/events/events_fifo.c
>>>> @@ -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;
>>>> +     uint32_t __aligned(sizeof(long)) ready;
>>>
>>> This doesn't look sufficient to me.  The event words within the event
>>> array are 32-bit sized/aligned and sync_set_bit() and sync_clear_bit()
>>> etc. are done on these words.
>>>
>>> I think arm64 is going to have to provide sync_clear_bit(),
>>> sync_set_bit(), sync_test_bit() and sync_test_and_set_bit() that work
>>> with 32-bit sized and aligned words.
>>
>> Looks reasonable. If I understand correctly these sync_* functions are
>> used by Xen only (or at least was introduced because of Xen).
>> I might take rework them for arm64 to operate on 32-bit
>> size/alignment. Does this sounds reasonable?
>> ... and what to do with this patch?
>>
> 
> I think it could be dropped if clear_bit(priority, BM(ready)) is
> replaced with sync_ equivalent.

ready can be unsigned long as Ian suggested.

David

      reply	other threads:[~2014-04-15 13:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-14 20:43 [PATCH] xen: fix alignment for bitops Vladimir Murzin
2014-04-15  7:35 ` Jan Beulich
2014-04-15  8:29   ` Vladimir Murzin
2014-04-15  8:49     ` Jan Beulich
2014-04-15  9:15       ` Ian Campbell
2014-04-15  9:30         ` Vladimir Murzin
2014-04-15  9:37           ` Ian Campbell
2014-04-15  9:34         ` Jan Beulich
2014-04-15 10:17 ` David Vrabel
2014-04-15 13:05   ` Vladimir Murzin
2014-04-15 13:13     ` Vladimir Murzin
2014-04-15 13:18       ` David Vrabel [this message]

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=534D319E.9030804@citrix.com \
    --to=david.vrabel@citrix.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=catalin.marinas@arm.com \
    --cc=ian.campbell@citrix.com \
    --cc=murzin.v@gmail.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=will.deacon@arm.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.