public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Harvey Harrison <harvey.harrison@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>, "H. Peter Anvin" <hpa@zytor.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH] x86: Reduce ifdef sections in fault.c
Date: Mon, 28 Jan 2008 21:40:11 -0800	[thread overview]
Message-ID: <479EBC3B.4090303@goop.org> (raw)
In-Reply-To: <1201578604.19875.59.camel@brick>

Harvey Harrison wrote:
> Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
>   

x86.git has my patch which makes the pgd_list the same for 32-bit and 
64-bit, which means the code which traverses that list can be common now.

    J
> ---
>  arch/x86/mm/fault.c |   31 +++++++++----------------------
>  1 files changed, 9 insertions(+), 22 deletions(-)
>
> diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
> index e28cc52..2737493 100644
> --- a/arch/x86/mm/fault.c
> +++ b/arch/x86/mm/fault.c
> @@ -508,6 +508,10 @@ static int vmalloc_fault(unsigned long address)
>  	pmd_t *pmd, *pmd_ref;
>  	pte_t *pte, *pte_ref;
>  
> +	/* Make sure we are in vmalloc area */
> +	if (!(address >= VMALLOC_START && address < VMALLOC_END))
> +		return -1;
> +
>  	/* Copy kernel mappings over when needed. This can also
>  	   happen within a race in page table update. In the later
>  	   case just flush. */
> @@ -603,6 +607,9 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code)
>  	 */
>  #ifdef CONFIG_X86_32
>  	if (unlikely(address >= TASK_SIZE)) {
> +#else
> +	if (unlikely(address >= TASK_SIZE64)) {
> +#endif
>  		if (!(error_code & (PF_RSVD|PF_USER|PF_PROT)) &&
>  		    vmalloc_fault(address) >= 0)
>  			return;
> @@ -618,6 +625,8 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code)
>  		goto bad_area_nosemaphore;
>  	}
>  
> +
> +#ifdef CONFIG_X86_32
>  	/* It's safe to allow irq's after cr2 has been saved and the vmalloc
>  	   fault has been handled. */
>  	if (regs->flags & (X86_EFLAGS_IF|VM_MASK))
> @@ -630,28 +639,6 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code)
>  	if (in_atomic() || !mm)
>  		goto bad_area_nosemaphore;
>  #else /* CONFIG_X86_64 */
> -	if (unlikely(address >= TASK_SIZE64)) {
> -		/*
> -		 * Don't check for the module range here: its PML4
> -		 * is always initialized because it's shared with the main
> -		 * kernel text. Only vmalloc may need PML4 syncups.
> -		 */
> -		if (!(error_code & (PF_RSVD|PF_USER|PF_PROT)) &&
> -		      ((address >= VMALLOC_START && address < VMALLOC_END))) {
> -			if (vmalloc_fault(address) >= 0)
> -				return;
> -		}
> -
> -		/* Can handle a stale RO->RW TLB */
> -		if (spurious_fault(address, error_code))
> -			return;
> -
> -		/*
> -		 * Don't take the mm semaphore here. If we fixup a prefetch
> -		 * fault we could otherwise deadlock.
> -		 */
> -		goto bad_area_nosemaphore;
> -	}
>  	if (likely(regs->flags & X86_EFLAGS_IF))
>  		local_irq_enable();
>  
>   


  reply	other threads:[~2008-01-29  5:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-29  3:50 [PATCH] x86: Reduce ifdef sections in fault.c Harvey Harrison
2008-01-29  5:40 ` Jeremy Fitzhardinge [this message]
2008-01-31 15:05 ` Ingo Molnar

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=479EBC3B.4090303@goop.org \
    --to=jeremy@goop.org \
    --cc=harvey.harrison@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    /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