mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dave Hansen <dave.hansen@intel.com>
To: Borislav Petkov <bp@suse.de>
Cc: Matt Fleming <matt.fleming@intel.com>,
	the arch/x86 maintainers <x86@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: BUG() at boot in __phys_addr with DEBUG_VIRTUAL
Date: Wed, 12 Nov 2014 07:20:53 -0800	[thread overview]
Message-ID: <54637AD5.6060300@intel.com> (raw)
In-Reply-To: <20141112151106.GB17793@pd.tnic>

On 11/12/2014 07:11 AM, Borislav Petkov wrote:
>> > [    1.161406] __phys_addr() x: 0x000078009d3c6000
>> > [    1.166567] __phys_addr() origx: 0x000000009d3c6000
>> > [    1.171832] __phys_addr() y: 0x000000011d3c6000
>> > [    1.176999] __phys_addr() __START_KERNEL_map: 0xffffffff80000000
>> > [    1.183841] __phys_addr() PAGE_OFFSET: 0xffff880000000000
>> > [    1.189993] __phys_addr() x valid: 0
>> > 
>> > So it looks like the root cause is a physical address getting pass in in
>> > the first place instead of a virtual.
> I'd say that's on purpose as we're mapping kernel text 1:1 in the EFI
> page table.

__pa and friends do their calculations *against* PAGE_OFFSET to do the
virt<->phys translation.  If that's not what a caller wants, then
they're calling the wrong function.

The path that we're actually hitting this from is:

> __split_large_page(struct cpa_data *cpa, pte_t *kpte, unsigned long
...
>         if (pfn_range_is_mapped(PFN_DOWN(__pa(address)),
>                                 PFN_DOWN(__pa(address)) + 1))
>                 split_page_count(level);

So perhaps efi_map_region() is handing an address from the EFI identity
map down in here.  __pa() gets called on it, but that fails since __pa()
only works on the *KERNEL* identity map.

I think we might actually need to walk the page tables in there.  Even
the pfn_range_is_mapped() code looks to be dealing with the kernel
identity map.

  reply	other threads:[~2014-11-12 15:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-11 23:19 Dave Hansen
2014-11-11 23:47 ` Borislav Petkov
2014-11-12  9:24 ` Matt Fleming
2014-11-12 14:57   ` Dave Hansen
2014-11-12 15:11     ` Borislav Petkov
2014-11-12 15:20       ` Dave Hansen [this message]
2014-11-12 17:25         ` Borislav Petkov
2014-11-13 10:36           ` Matt Fleming
2014-12-09 10:35             ` Borislav Petkov
2014-11-13 13:08         ` Matt Fleming
2015-01-27 21:37 ` Matt Fleming

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=54637AD5.6060300@intel.com \
    --to=dave.hansen@intel.com \
    --cc=bp@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt.fleming@intel.com \
    --cc=x86@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome