LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: "Huang, Ying" <ying.huang@intel.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Ingo Molnar <mingo@elte.hu>, Andi Kleen <andi@firstfloor.org>,
	tglx@linutronix.de, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Fix left over EFI cache mapping problems
Date: Fri, 15 Feb 2008 14:24:40 +0800	[thread overview]
Message-ID: <1203056680.30010.21.camel@caritas-dev.intel.com> (raw)
In-Reply-To: <alpine.LFD.1.00.0802142139260.4255@woody.linux-foundation.org>

On Thu, 2008-02-14 at 21:44 -0800, Linus Torvalds wrote:
> 
> On Fri, 15 Feb 2008, Huang, Ying wrote:
> > 
> > I think the patch following may be better, because it is possible that
> > the EFI_PAGE_SHIFT and PAGE_SHIFT are different.
> 
> If this is a problem in practice, we'd be better off having a helper 
> function to do it, to avoid overflows. Right now, doing
> 
> > +		unsigned long num_pages;
> > +		num_pages = (md->num_pages << EFI_PAGE_SHIFT) >> PAGE_SHIFT;
> 
> overflows at 4GB on x86-32. And maybe you never have areas that big, and 
> people are moving over to 64-bit anyway, it still sounds like a bug 
> waiting to happen.
> 
> So *if* we care (I doubt we do, since EFI_PAGE_SHIFT at least right now 
> matches PAGE_SHIFT on x86), you'd probably want to do something like
> 
>   static inline unsigned long efi_pages_to_native_pages(unsigned long efi_pages)
>   {
>   #if EFI_PAGE_SHIFT > PAGE_SHIFT
> 	return efi_pages << (EFI_PAGE_SHIFT - PAGE_SHIFT);
>   #else
> 	return efi_pages >> (PAGE_SHIFT - EFI_PAGE_SHIFT);
>   #endif
>   }
> 
> or whatever.
> 
> Otherwise, trying to avoid a bug with different page sizes is actually 
> more likely to *introduce* one rather than fix one..

Yes, I will fix this.

Best Regards,
Huang Ying


  reply	other threads:[~2008-02-15  6:23 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-14 13:13 Andi Kleen
2008-02-14 16:12 ` Ingo Molnar
2008-02-14 17:16   ` Andi Kleen
2008-02-14 18:38     ` Ingo Molnar
2008-02-14 21:42       ` Andi Kleen
2008-02-14 22:08         ` Arjan van de Ven
2008-02-14 23:01           ` Andi Kleen
2008-02-15  2:52       ` Huang, Ying
2008-02-15  8:55         ` Andi Kleen
2008-02-15  9:16           ` Huang, Ying
2008-02-15  4:48   ` Huang, Ying
2008-02-15  5:44     ` Linus Torvalds
2008-02-15  6:24       ` Huang, Ying [this message]
2008-02-15  7:30       ` Ingo Molnar
2008-02-15  7:08     ` Ingo Molnar
2008-02-15  7:32       ` Huang, Ying
2008-02-18  1:53       ` Huang, Ying
2008-02-18 11:26         ` Andi Kleen
2008-02-18 14:05           ` Ingo Molnar
2008-02-15  8:48     ` Andi Kleen
2008-02-15  9:21       ` Huang, Ying
2008-02-15  9:43         ` 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=1203056680.30010.21.camel@caritas-dev.intel.com \
    --to=ying.huang@intel.com \
    --cc=andi@firstfloor.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --subject='Re: [PATCH] Fix left over EFI cache mapping problems' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).