public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: "H. Peter Anvin" <hpa@linux.intel.com>,
	stable@kernel.org, Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Avi Kivity <avi@redhat.com>, Brian Gerst <brgerst@gmail.com>,
	Glauber Costa <glommer@redhat.com>, Greg KH <gregkh@suse.de>,
	Ingo Molnar <mingo@elte.hu>, Jeff Dike <jdike@addtoit.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	Pekka Enberg <penberg@cs.helsinki.fi>,
	Peter Palfrader <peter@palfrader.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Zachary Amsden <zamsden@redhat.com>
Subject: Re: [GIT PULL] x86/asm for 2.6.36
Date: Fri, 06 Aug 2010 10:45:07 -0700	[thread overview]
Message-ID: <4C5C4A23.6070006@zytor.com> (raw)
In-Reply-To: <AANLkTimZF5U-AmD6200gnTuNzX5nUqVqEo_NmiH3rz5n@mail.gmail.com>

On 08/06/2010 10:17 AM, Linus Torvalds wrote:
> On Thu, Aug 5, 2010 at 1:37 PM, H. Peter Anvin <hpa@linux.intel.com> wrote:
>>
>>  git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git x86-asm-for-linus
>>
>> H. Peter Anvin (7):
>>      x86, asm: Clean up and simplify set_64bit()
> 
> Hmm. This seems to cause compiler warnings for me on x86-64:
> 
>   drivers/pci/intr_remapping.c: In function ‘modify_irte’:
>   drivers/pci/intr_remapping.c:314: warning: passing argument 1 of
> ‘set_64bit’ from incompatible pointer type
>   /home/torvalds/v2.6/linux/arch/x86/include/asm/cmpxchg_64.h:6: note:
> expected ‘volatile u64 *’ but argument is of type ‘long unsigned int
> *’
> 
> and I'm not clear on the reason for that function prototype change.
> 
>                           Linus

On 64 bits the intent was to be consistent with the tightened-up 32-bit
code.  Perhaps that was a mistake, but it seems a lot more consistent to
me to have "u64" be the type

On the 32-bit side, it's not so much a function prototype change as the
previous version of the code actually explicitly cast it to an array of
unsigned ints... it has the advantage that it can accept any type, but
the disadvantage that is can accept *ANY* type.  The problem of course
is the above, since gcc will issue warnings for u64 (unsigned long long)
version the otherwise-identical "unsigned long".

It's worth noting that in this particular case the code itself looks
like this:

	set_64bit((unsigned long *)&irte->low, irte_modified->low);
	set_64bit((unsigned long *)&irte->high, irte_modified->high);

... where the existing cast is there because irte->low and irte->high
are types __u64.  In other words, with the "more logical" u64 prototype
the casts should just get removed.

On the other hand I should have seen this sooner, obviously.

	-hpa

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.


  reply	other threads:[~2010-08-06 17:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-05 20:37 [GIT PULL] x86/asm for 2.6.36 H. Peter Anvin
2010-08-06 17:17 ` Linus Torvalds
2010-08-06 17:45   ` H. Peter Anvin [this message]
2010-08-06 17:56     ` Linus Torvalds
2010-08-06 18:03     ` H. Peter Anvin

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=4C5C4A23.6070006@zytor.com \
    --to=hpa@zytor.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=avi@redhat.com \
    --cc=brgerst@gmail.com \
    --cc=glommer@redhat.com \
    --cc=gregkh@suse.de \
    --cc=hpa@linux.intel.com \
    --cc=jdike@addtoit.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mtosatti@redhat.com \
    --cc=penberg@cs.helsinki.fi \
    --cc=peter@palfrader.org \
    --cc=stable@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=zamsden@redhat.com \
    /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