All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Jan Beulich <jbeulich@novell.com>
Cc: Andi Kleen <ak@suse.de>,
	Glauber de Oliveira Costa <glommer@gmail.com>,
	Jeremy Fitzhardinge <jeremy@goop.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 0 of 4] x86: some more patches
Date: Wed, 16 Jan 2008 16:47:10 +0100	[thread overview]
Message-ID: <20080116154710.GA28946@elte.hu> (raw)
In-Reply-To: <478E3411.76E4.0078.0@novell.com>


* Jan Beulich <jbeulich@novell.com> wrote:

> > Yes, but if you cast to long the result will be 32bit again. Or do 
> > you rely on it being always used in 64bit signed context with sign 
> > extension? While that might work it would seem rather fragile to me, 
> > just asking for similar future bugs.
> 
> Even if conversion is to 64-bit unsigned, the value (being signed) 
> will be sign-extended first (to preserve its value modulo 2**<target 
> type width>).

yes. It would be nice if Andi could test my fix instead of arguing why 
he thinks it's unlikely to work ;-)

(i've got the cleanup patch below as well ontop of today's x86.git which 
includes the first fix, but it's an RFC as it has wider impact and might 
break stuff.)

	Ingo

--------------->
Subject: x86: PAGE_MASK cleanup
From: Ingo Molnar <mingo@elte.hu>

Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 include/asm-x86/page.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: linux-x86.q/include/asm-x86/page.h
===================================================================
--- linux-x86.q.orig/include/asm-x86/page.h
+++ linux-x86.q/include/asm-x86/page.h
@@ -6,12 +6,12 @@
 /* PAGE_SHIFT determines the page size */
 #define PAGE_SHIFT	12
 #define PAGE_SIZE	(_AC(1,UL) << PAGE_SHIFT)
-#define PAGE_MASK	(~(PAGE_SIZE-1))
+#define PAGE_MASK	(_AT(phys_addr_t, ~(PAGE_SIZE-1)))
 
 #ifdef __KERNEL__
 
 #define PHYSICAL_PAGE_MASK	(PAGE_MASK & __PHYSICAL_MASK)
-#define PTE_MASK		(_AT(long, PHYSICAL_PAGE_MASK))
+#define PTE_MASK		PHYSICAL_PAGE_MASK
 
 #define LARGE_PAGE_SIZE		(_AC(1,UL) << PMD_SHIFT)
 #define LARGE_PAGE_MASK		(~(LARGE_PAGE_SIZE-1))

  reply	other threads:[~2008-01-16 15:47 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-15 22:17 [PATCH 0 of 4] x86: some more patches Jeremy Fitzhardinge
2008-01-15 22:17 ` [PATCH 1 of 4] x86: refactor mmu ops in paravirt.h Jeremy Fitzhardinge
2008-01-15 22:17 ` [PATCH 2 of 4] x86: fix warning Jeremy Fitzhardinge
2008-01-15 22:17 ` [PATCH 3 of 4] x86: clean up pte_modify Jeremy Fitzhardinge
2008-01-16  0:43   ` Andi Kleen
2008-01-15 22:17 ` [PATCH 4 of 4] x86: mask NX from pte_pfn Jeremy Fitzhardinge
2008-01-18 13:52   ` Hugh Dickins
2008-01-18 14:01     ` Ingo Molnar
2008-01-18 15:55     ` Jeremy Fitzhardinge
2008-01-15 22:35 ` [PATCH 0 of 4] x86: some more patches Ingo Molnar
2008-01-15 23:28   ` Jeremy Fitzhardinge
2008-01-16  0:44     ` Andi Kleen
2008-01-16  7:25       ` Ingo Molnar
2008-01-16 14:22     ` Ingo Molnar
2008-01-16 14:44       ` Andi Kleen
2008-01-16 14:54         ` Ingo Molnar
2008-01-16 15:18           ` Ingo Molnar
2008-01-16 15:26           ` Andi Kleen
2008-01-16 15:42             ` Jan Beulich
2008-01-16 15:47               ` Ingo Molnar [this message]
2008-01-16 16:06                 ` Ingo Molnar
2008-01-16 17:05                 ` Jeremy Fitzhardinge
2008-01-16 17:12                   ` Andi Kleen
2008-01-16 17:40                 ` Andi Kleen
2008-01-16 20:22                   ` Ingo Molnar
2008-01-16 20:59                     ` Andi Kleen
2008-01-16 21:06                       ` Ingo Molnar
2008-01-16 21:35                         ` Andi Kleen

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=20080116154710.GA28946@elte.hu \
    --to=mingo@elte.hu \
    --cc=ak@suse.de \
    --cc=glommer@gmail.com \
    --cc=jbeulich@novell.com \
    --cc=jeremy@goop.org \
    --cc=linux-kernel@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 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.