From: "Li, Zhen-Hua" <zhen-hual@hp.com>
To: "dwmw2@infradead.org" <dwmw2@infradead.org>,
"indou.takao@jp.fujitsu.com" <indou.takao@jp.fujitsu.com>,
"bhe@redhat.com" <bhe@redhat.com>,
"joro@8bytes.org" <joro@8bytes.org>,
"vgoyal@redhat.com" <vgoyal@redhat.com>,
"dyoung@redhat.com" <dyoung@redhat.com>
Cc: "iommu@lists.linux-foundation.org"
<iommu@lists.linux-foundation.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
"kexec@lists.infradead.org" <kexec@lists.infradead.org>,
"alex.williamson@redhat.com" <alex.williamson@redhat.com>,
"ddutile@redhat.com" <ddutile@redhat.com>,
"ishii.hironobu@jp.fujitsu.com" <ishii.hironobu@jp.fujitsu.com>,
"bhelgaas@google.com" <bhelgaas@google.com>,
"Hatch, Douglas B (HPS Linux PM)" <doug.hatch@hp.com>,
"Hoemann, Jerry" <jerry.hoemann@hp.com>,
"Vaden, Tom (HP Server OS Architecture)" <tom.vaden@hp.com>,
"Zhang, Li (Zoe@HPservers-Core-OE-PSC)" <li.zhang6@hp.com>,
"Mitchell, Lisa (MCLinux in Fort Collins)" <lisa.mitchell@hp.com>,
"billsumnerlinux@gmail.com" <billsumnerlinux@gmail.com>,
"Wright, Randy (HP Servers Linux)" <rwright@hp.com>
Subject: Re: [PATCH v11 0/10] iommu/vt-d: Fix intel vt-d faults in kdump kernel
Date: Tue, 12 May 2015 09:34:14 +0000 [thread overview]
Message-ID: <51EBDCCF-6DE5-4541-BD67-224C9D684084@hp.com> (raw)
In-Reply-To: <1431337974-545-1-git-send-email-zhen-hual@hp.com>
To fix the dmar fault in running v10 with latest upstream version, added a flush in the new function iommu_context_addr.
Thanks
Zhenhua
>
> This patchset is an update of Bill Sumner's patchset, implements a fix for:
> If a kernel boots with intel_iommu=on on a system that supports intel vt-d,
> when a panic happens, the kdump kernel will boot with these faults:
>
> dmar: DRHD: handling fault status reg 102
> dmar: DMAR:[DMA Read] Request device [01:00.0] fault addr fff80000
> DMAR:[fault reason 01] Present bit in root entry is clear
>
> dmar: DRHD: handling fault status reg 2
> dmar: INTR-REMAP: Request device [[61:00.0] fault index 42
> INTR-REMAP:[fault reason 34] Present field in the IRTE entry is clear
>
> On some system, the interrupt remapping fault will also happen even if the
> intel_iommu is not set to on, because the interrupt remapping will be enabled
> when x2apic is needed by the system.
>
> The cause of the DMA fault is described in Bill's original version, and the
> INTR-Remap fault is caused by a similar reason. In short, the initialization
> of vt-d drivers causes the in-flight DMA and interrupt requests get wrong
> response.
>
> To fix this problem, we modifies the behaviors of the intel vt-d in the
> crashdump kernel:
>
> For DMA Remapping:
> 1. To accept the vt-d hardware in an active state,
> 2. Do not disable and re-enable the translation, keep it enabled.
> 3. Use the old root entry table, do not rewrite the RTA register.
> 4. Malloc and use new context entry table, copy data from the old ones that
> used by the old kernel.
> 5. Keep using the old page tables before driver is loaded.
> 6. After device driver is loaded, when it issues the first dma_map command,
> free the dmar_domain structure for this device, and generate a new one, so
> that the device can be assigned a new and empty page table.
> 7. When a new context entry table is generated, we also save its address to
> the old root entry table.
>
> For Interrupt Remapping:
> 1. To accept the vt-d hardware in an active state,
> 2. Do not disable and re-enable the interrupt remapping, keep it enabled.
> 3. Use the old interrupt remapping table, do not rewrite the IRTA register.
> 4. When ioapic entry is setup, the interrupt remapping table is changed, and
> the updated data will be stored to the old interrupt remapping table.
>
> Advantages of this approach:
> 1. All manipulation of the IO-device is done by the Linux device-driver
> for that device.
> 2. This approach behaves in a manner very similar to operation without an
> active iommu.
> 3. Any activity between the IO-device and its RMRR areas is handled by the
> device-driver in the same manner as during a non-kdump boot.
> 4. If an IO-device has no driver in the kdump kernel, it is simply left alone.
> This supports the practice of creating a special kdump kernel without
> drivers for any devices that are not required for taking a crashdump.
> 5. Minimal code-changes among the existing mainline intel vt-d code.
>
> Summary of changes in this patch set:
> 1. Added some useful function for root entry table in code intel-iommu.c
> 2. Added new members to struct root_entry and struct irte;
> 3. Functions to load old root entry table to iommu->root_entry from the memory
> of old kernel.
> 4. Functions to malloc new context entry table and copy the data from the old
> ones to the malloced new ones.
> 5. Functions to enable support for DMA remapping in kdump kernel.
> 6. Functions to load old irte data from the old kernel to the kdump kernel.
> 7. Some code changes that support other behaviours that have been listed.
> 8. In the new functions, use physical address as "unsigned long" type, not
> pointers.
>
> Original version by Bill Sumner:
> https://lkml.org/lkml/2014/1/10/518
> https://lkml.org/lkml/2014/4/15/716
> https://lkml.org/lkml/2014/4/24/836
>
> Zhenhua's updates:
> https://lkml.org/lkml/2014/10/21/134
> https://lkml.org/lkml/2014/12/15/121
> https://lkml.org/lkml/2014/12/22/53
> https://lkml.org/lkml/2015/1/6/1166
> https://lkml.org/lkml/2015/1/12/35
> https://lkml.org/lkml/2015/3/19/33
> https://lkml.org/lkml/2015/4/10/135
>
> Changelog[v11]:
> 1. Fix some conflicts with the latest upstream kernel.
> Add flush in iommu_context_addr
>
> Changelog[v10]:
> 1. Do not use CONFIG_CRASH_DUMP and is_kdump_kernel().
> Use one flag which stores the te and ir status in last kernel:
> iommu->pre_enabled_trans
> iommu->pre_enabled_ir
>
> Changelog[v9]:
> 1. Add new function iommu_attach_domain_with_id.
> 2. Do not copy old page tables, keep using the old ones.
> 3. Remove functions:
> intel_iommu_did_to_domain_values_entry
> intel_iommu_get_dids_from_old_kernel
> device_to_domain_id
> copy_page_addr
> copy_page_table
> copy_context_entry
> copy_context_entry_table
> 4. Add new function device_to_existing_context_entry.
>
> Changelog[v8]:
> 1. Add a missing __iommu_flush_cache in function copy_page_table.
>
> Changelog[v7]:
> 1. Use __iommu_flush_cache to flush the data to hardware.
>
> Changelog[v6]:
> 1. Use "unsigned long" as type of physical address.
> 2. Use new function unmap_device_dma to unmap the old dma.
> 3. Some small incorrect bits order for aw shift.
>
> Changelog[v5]:
> 1. Do not disable and re-enable traslation and interrupt remapping.
> 2. Use old root entry table.
> 3. Use old interrupt remapping table.
> 4. New functions to copy data from old kernel, and save to old kernel mem.
> 5. New functions to save updated root entry table and irte table.
> 6. Use intel_unmap to unmap the old dma;
> 7. Allocate new pages while driver is being loaded.
>
> Changelog[v4]:
> 1. Cut off the patches that move some defines and functions to new files.
> 2. Reduce the numbers of patches to five, make it more easier to read.
> 3. Changed the name of functions, make them consistent with current context
> get/set functions.
> 4. Add change to function __iommu_attach_domain.
>
> Changelog[v3]:
> 1. Commented-out "#define DEBUG 1" to eliminate debug messages.
> 2. Updated the comments about changes in each version.
> 3. Fixed: one-line added to Copy-Translations patch to initialize the iovad
> struct as recommended by Baoquan He [bhe@redhat.com]
> init_iova_domain(&domain->iovad, DMA_32BIT_PFN);
>
> Changelog[v2]:
> The following series implements a fix for:
> A kdump problem about DMA that has been discussed for a long time. That is,
> when a kernel panics and boots into the kdump kernel, DMA started by the
> panicked kernel is not stopped before the kdump kernel is booted and the
> kdump kernel disables the IOMMU while this DMA continues. This causes the
> IOMMU to stop translating the DMA addresses as IOVAs and begin to treat
> them as physical memory addresses -- which causes the DMA to either:
> (1) generate DMAR errors or
> (2) generate PCI SERR errors or
> (3) transfer data to or from incorrect areas of memory. Often this
> causes the dump to fail.
>
> Changelog[v1]:
> The original version.
>
> Changed in this version:
> 1. Do not disable and re-enable traslation and interrupt remapping.
> 2. Use old root entry table.
> 3. Use old interrupt remapping table.
> 4. Use "unsigned long" as physical address.
> 5. Use intel_unmap to unmap the old dma;
>
> Baoquan He <bhe@redhat.com> helps testing this patchset.
> Takao Indoh <indou.takao@jp.fujitsu.com> gives valuable suggestions.
>
> Li, Zhen-Hua (10):
> iommu/vt-d: New function to attach domain with id
> iommu/vt-d: Items required for kdump
> iommu/vt-d: Function to get existing context entry
> iommu/vt-d: functions to copy data from old mem
> iommu/vt-d: Add functions to load and save old re
> iommu/vt-d: datatypes and functions used for kdump
> iommu/vt-d: enable kdump support in iommu module
> iommu/vt-d: assign new page table for dma_map
> iommu/vt-d: Copy functions for irte
> iommu/vt-d: Use old irte in kdump kernel
>
> drivers/iommu/intel-iommu.c | 536 ++++++++++++++++++++++++++++++++++--
> drivers/iommu/intel_irq_remapping.c | 96 ++++++-
> include/linux/intel-iommu.h | 16 ++
> 3 files changed, 623 insertions(+), 25 deletions(-)
>
> --
> 2.0.0-rc0
>
next prev parent reply other threads:[~2015-05-12 9:35 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-11 9:52 [PATCH v11 0/10] iommu/vt-d: Fix intel vt-d faults in kdump kernel Li, Zhen-Hua
2015-05-11 9:52 ` [PATCH v11 01/10] iommu/vt-d: New function to attach domain with id Li, Zhen-Hua
2015-05-11 9:52 ` [PATCH v11 02/10] iommu/vt-d: Items required for kdump Li, Zhen-Hua
2015-05-12 8:17 ` Dave Young
2015-05-13 1:45 ` Li, ZhenHua
2015-05-13 6:31 ` Alexander Duyck
2015-05-13 8:42 ` Dave Young
2015-05-11 9:52 ` [PATCH v11 03/10] iommu/vt-d: Function to get existing context entry Li, Zhen-Hua
2015-05-11 9:52 ` [PATCH v11 04/10] iommu/vt-d: functions to copy data from old mem Li, Zhen-Hua
2015-05-12 8:29 ` Dave Young
2015-05-13 9:00 ` Baoquan He
2015-05-13 9:13 ` Li, ZhenHua
2015-05-13 9:21 ` Baoquan He
2015-06-08 14:15 ` David Woodhouse
2015-06-08 15:21 ` Joerg Roedel
2015-06-08 15:44 ` David Woodhouse
2015-05-11 9:52 ` [PATCH v11 05/10] iommu/vt-d: Add functions to load and save old re Li, Zhen-Hua
2015-05-12 8:37 ` Dave Young
2015-05-13 1:47 ` Li, ZhenHua
2015-05-13 8:49 ` Dave Young
2015-05-11 9:52 ` [PATCH v11 06/10] iommu/vt-d: datatypes and functions used for kdump Li, Zhen-Hua
2015-05-12 8:48 ` Dave Young
2015-05-13 8:56 ` Baoquan He
2015-05-13 8:58 ` Li, ZhenHua
2015-05-13 9:10 ` Baoquan He
2015-05-11 9:52 ` [PATCH v11 07/10] iommu/vt-d: enable kdump support in iommu module Li, Zhen-Hua
2015-05-12 8:52 ` Dave Young
2015-05-13 2:10 ` Baoquan He
2015-05-13 2:28 ` Li, ZhenHua
2015-05-13 2:36 ` Baoquan He
2015-05-11 9:52 ` [PATCH v11 08/10] iommu/vt-d: assign new page table for dma_map Li, Zhen-Hua
2015-05-20 23:52 ` Baoquan He
2015-05-21 1:27 ` Li, ZhenHua
2015-05-21 6:54 ` Baoquan He
2015-05-21 8:40 ` Li, ZhenHua
2015-05-21 10:11 ` Baoquan He
2015-05-11 9:52 ` [PATCH v11 09/10] iommu/vt-d: Copy functions for irte Li, Zhen-Hua
2015-05-12 9:00 ` Dave Young
2015-05-11 9:52 ` [PATCH v11 10/10] iommu/vt-d: Use old irte in kdump kernel Li, Zhen-Hua
2015-05-12 6:18 ` [PATCH v11 0/10] iommu/vt-d: Fix intel vt-d faults " Baoquan He
2015-05-12 9:04 ` Dave Young
2015-05-12 9:34 ` Li, Zhen-Hua [this message]
2015-05-13 1:54 ` Li, ZhenHua
2015-05-18 10:05 ` Li, ZhenHua
2015-05-19 1:13 ` Dave Young
2015-05-19 7:43 ` Li, ZhenHua
2015-05-29 16:21 ` Joerg Roedel
2015-05-30 11:23 ` Li, Zhen-Hua
2015-06-08 14:26 ` David Woodhouse
2015-06-08 15:29 ` Joerg Roedel
2015-06-08 15:50 ` David Woodhouse
2015-06-08 16:13 ` Joerg Roedel
2015-06-09 12:55 ` David Woodhouse
2015-06-10 9:21 ` Joerg Roedel
2015-06-10 9:32 ` Li, ZhenHua
2015-06-10 14:10 ` David Woodhouse
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=51EBDCCF-6DE5-4541-BD67-224C9D684084@hp.com \
--to=zhen-hual@hp.com \
--cc=alex.williamson@redhat.com \
--cc=bhe@redhat.com \
--cc=bhelgaas@google.com \
--cc=billsumnerlinux@gmail.com \
--cc=ddutile@redhat.com \
--cc=doug.hatch@hp.com \
--cc=dwmw2@infradead.org \
--cc=dyoung@redhat.com \
--cc=indou.takao@jp.fujitsu.com \
--cc=iommu@lists.linux-foundation.org \
--cc=ishii.hironobu@jp.fujitsu.com \
--cc=jerry.hoemann@hp.com \
--cc=joro@8bytes.org \
--cc=kexec@lists.infradead.org \
--cc=li.zhang6@hp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lisa.mitchell@hp.com \
--cc=rwright@hp.com \
--cc=tom.vaden@hp.com \
--cc=vgoyal@redhat.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;
as well as URLs for NNTP newsgroup(s).