public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@web.de>
To: "Roedel, Joerg" <Joerg.Roedel@amd.com>
Cc: kvm <kvm@vger.kernel.org>, Sheng Yang <sheng@linux.intel.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: Crash on kvm_iommu_map_pages
Date: Mon, 01 Nov 2010 15:22:15 +0100	[thread overview]
Message-ID: <4CCECD17.3080303@web.de> (raw)
In-Reply-To: <20101101135322.GG20959@amd.com>

[-- Attachment #1: Type: text/plain, Size: 1869 bytes --]

Am 01.11.2010 14:53, Roedel, Joerg wrote:
> On Mon, Nov 01, 2010 at 09:25:00AM -0400, Jan Kiszka wrote:
>> Am 01.11.2010 14:21, Roedel, Joerg wrote:
>>> The registers rax and rbx contain non-canonical addresses (if
>>> interpreted as pointers). The instruction where this happens is a mov so
>>> I guess that the #GP is because of an non-canonical address.
>>> Can you find out the code-line where this happens and the exact
>>> assembler instruction? (haven't managed to decode the registers used).
>>
>> In pfn_to_dma_pte, line 710:
>>
>>                 if (!dma_pte_present(pte)) {
>> ffffffff8121de8c:       f6 03 03                testb  $0x3,(%rbx)
>> ffffffff8121de8f:       0f 85 d8 00 00 00       jne    ffffffff8121df6d <pfn_to_dma_pte+0x154>
>>
>> The first instruction raises the fault.
> 
> Ok, so it seems that my understanding of the Code: field in the
> crash-message was wrong :)
> Anyway, the testb uses rbx as an address which has a non-canonical
> value. This means the the address of 'pte' is invalid. Since rax also
> contains a wrong address the 'parent' variable probably already contains
> the wrong address. Does the attached patch help?
> 
> diff --git a/include/linux/dma_remapping.h b/include/linux/dma_remapping.h
> index 5619f85..ca46f24 100644
> --- a/include/linux/dma_remapping.h
> +++ b/include/linux/dma_remapping.h
> @@ -6,7 +6,7 @@
>   */
>  #define VTD_PAGE_SHIFT		(12)
>  #define VTD_PAGE_SIZE		(1UL << VTD_PAGE_SHIFT)
> -#define VTD_PAGE_MASK		(((u64)-1) << VTD_PAGE_SHIFT)
> +#define VTD_PAGE_MASK		((((u64)-1) << VTD_PAGE_SHIFT) & ((1ULL << 52) - 1))
>  #define VTD_PAGE_ALIGN(addr)	(((addr) + VTD_PAGE_SIZE - 1) & VTD_PAGE_MASK)
>  
>  #define DMA_PTE_READ (1)
> 

Crashes during early boot while initializing dmar. If you need the
trace, I could set up some debug console.

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 259 bytes --]

  reply	other threads:[~2010-11-01 14:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4CCEB7CF.8030207@web.de>
2010-11-01 12:57 ` Crash on kvm_iommu_map_pages Jan Kiszka
2010-11-01 13:21   ` Roedel, Joerg
2010-11-01 13:25     ` Jan Kiszka
2010-11-01 13:53       ` Roedel, Joerg
2010-11-01 14:22         ` Jan Kiszka [this message]
2010-11-01 14:35           ` Joerg Roedel
2010-11-01 15:29             ` Jan Kiszka
2010-11-01 16:37               ` Jan Kiszka

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=4CCECD17.3080303@web.de \
    --to=jan.kiszka@web.de \
    --cc=Joerg.Roedel@amd.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sheng@linux.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