public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <ak@suse.de>
To: "Huang, Ying" <ying.huang@intel.com>
Cc: akpm@linux-foundation.org, Yinghai Lu <yhlu.kernel@gmail.com>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	Randy Dunlap <randy.dunlap@oracle.com>,
	Chandramouli Narayanan <mouli@linux.intel.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/5] x86_64 EFI support -v3: EFI boot support
Date: Tue, 31 Jul 2007 13:35:40 +0200	[thread overview]
Message-ID: <200707311335.40235.ak@suse.de> (raw)
In-Reply-To: <1185851576.23149.27.camel@caritas-dev.intel.com>


>  static unsigned long dma_reserve __initdata;
> +/* Flag indicating EFI runtime executable code area */
> +static int efi_runtime_code_area;

We don't normally use globals to modify function behaviour.

>  
>  DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
>  
> @@ -199,7 +202,7 @@
>  static __meminit void unmap_low_page(void *adr)
>  { 
>  
> -	if (after_bootmem)
> +	if (after_bootmem || efi_runtime_code_area)
>  		return;
>  
>  	early_iounmap(adr, PAGE_SIZE);
> @@ -259,16 +262,21 @@
>  		pmd_t *pmd = pmd_page + pmd_index(address);
>  
>  		if (address >= end) {
> -			if (!after_bootmem)
> +			if (!after_bootmem && !efi_runtime_code_area)


This one seems also weird. Are you sure this doesn't remove _NX from
more than the intended area? 

>  				for (; i < PTRS_PER_PMD; i++, pmd++)
>  					set_pmd(pmd, __pmd(0));
>  			break;
>  		}
>  
> -		if (pmd_val(*pmd))
> +		if (pmd_val(*pmd) && !efi_runtime_code_area)
>  			continue;
>  
> -		entry = _PAGE_NX|_PAGE_PSE|_KERNPG_TABLE|_PAGE_GLOBAL|address;
> +		if (efi_runtime_code_area) {
> +			entry = pmd_val(*pmd);
> +			entry &= ~_PAGE_NX;
> +		} else
> +			entry = _PAGE_NX | _PAGE_PSE | _KERNPG_TABLE | \
> +				_PAGE_GLOBAL | address;

This doesn't look correct. PSE/KERNPG/GLOBAL/address surely need to be set
for EFI areas too.

The changes to this file are quite messy.
Perhaps it would be better if you just use change_page_attr() afterwards.
This would make it using 4K pages instead of 2MB, but that wouldn't be a catastrophe.

What exactly are you trying to do here? Just remove _NX for some areas?

-Andi


  reply	other threads:[~2007-07-31 11:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-31  3:12 [PATCH 2/5] x86_64 EFI support -v3: EFI boot support Huang, Ying
2007-07-31 11:35 ` Andi Kleen [this message]
2007-08-01  8:59   ` Huang, Ying
2007-08-01 12:56     ` 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=200707311335.40235.ak@suse.de \
    --to=ak@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=ebiederm@xmission.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mouli@linux.intel.com \
    --cc=randy.dunlap@oracle.com \
    --cc=yhlu.kernel@gmail.com \
    --cc=ying.huang@intel.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