All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Vrabel <david.vrabel@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Keir Fraser <keir@xen.org>,
	Ian Campbell <ian.campbell@citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Tim Deegan <tim@xen.org>,
	Jennifer Herbert <jennifer.herbert@citrix.com>,
	xen-devel@lists.xenproject.org
Subject: Re: [PATCHv4 1/5] x86: provide add_sized()
Date: Wed, 13 May 2015 10:35:05 +0100	[thread overview]
Message-ID: <55531AC9.7050603@citrix.com> (raw)
In-Reply-To: <5553343F0200007800079E6D@mail.emea.novell.com>

On 13/05/15 10:23, Jan Beulich wrote:
>>>> On 11.05.15 at 16:37, <david.vrabel@citrix.com> wrote:
>> @@ -53,6 +67,19 @@ void __bad_atomic_size(void);
>>      }                                                     \
>>  })
>>  
>> +#define add_sized(p, x) ({                                \
>> +    typeof(*(p)) __x = (x);                               \
>> +    unsigned long x_ = (unsigned long)__x;                \
> 
> So is there a particular reason you kept this double type conversion?
> As said earlier, I can see why write_atomic() wants it, but I don't see
> the need here.

I kept it in case typeof (*p) wasn't a numeric type (like a struct { u32
a; }) and needed the cast to unsigned long, although in hindsight I'm
not sure this really makes any sense.

David

>> +    switch ( sizeof(*(p)) )                               \
>> +    {                                                     \
>> +    case 1: add_u8_sized((uint8_t *)(p), x_); break;      \
>> +    case 2: add_u16_sized((uint16_t *)(p), x_); break;    \
>> +    case 4: add_u32_sized((uint32_t *)(p), x_); break;    \
>> +    case 8: add_u64_sized((uint64_t *)(p), x_); break;    \
>> +    default: __bad_atomic_size(); break;                  \
>> +    }                                                     \
>> +})
> 
> 

  reply	other threads:[~2015-05-13  9:35 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-11 14:37 [PATCHv5 0/5] Use ticket locks for spinlocks David Vrabel
2015-05-11 14:37 ` [PATCHv4 1/5] x86: provide add_sized() David Vrabel
2015-05-13  9:23   ` Jan Beulich
2015-05-13  9:35     ` David Vrabel [this message]
2015-05-13  9:48       ` Jan Beulich
2015-05-11 14:37 ` [PATCHv4 2/5] arm: " David Vrabel
2015-05-11 14:45   ` David Vrabel
2015-05-13  9:26     ` Jan Beulich
2015-05-11 14:37 ` [PATCHv4 3/5] xen: use ticket locks for spin locks David Vrabel
2015-05-13  9:31   ` Jan Beulich
2015-05-14 10:36   ` Tim Deegan
2015-05-14 20:05     ` Jan Beulich
2015-05-14 20:51       ` Jan Beulich
2015-05-14 20:55       ` Tim Deegan
2015-05-14 21:01         ` Jan Beulich
2015-05-11 14:37 ` [PATCHv4 4/5] x86, arm: remove asm/spinlock.h from all architectures David Vrabel
2015-05-11 14:37 ` [PATCHv4 5/5] x86: reduce struct hvm_domain size David Vrabel
2015-05-14 11:24   ` Tim Deegan
2015-05-14 12:08     ` David Vrabel

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=55531AC9.7050603@citrix.com \
    --to=david.vrabel@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=jennifer.herbert@citrix.com \
    --cc=keir@xen.org \
    --cc=tim@xen.org \
    --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.