x86 / iommu: set up a scratch page in the quarantine domain
PATCH v2 1/1 x86 / iommu: set up a scratch page in the quarantine domain
This patch introduces a new iommu_op to facilitate a per-implementation quarantine set up, and then further code for x86 implementations (amd and vtd) to set up a read-only scratch page to serve as the source for DMA reads whilst a device is assigned to dom_io. DMA writes will continue to fault as before.
The reason for doing this is that some hardware may continue to re-try DMA (despite FLR) in the event of an error, or even BME being cleared, and will fail to deal with DMA read faults gracefully. Having a scratch page mapped will allow pending DMA reads to complete and thus such buggy hardware will eventually be quiesced.
NOTE: These modifications are restricted to x86 implementations only as
the buggy h/w I am aware of is only used with Xen in an x86 environment. ARM may require similar code but, since I am not aware of the need, this patch does not modify any ARM implementation.
---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: Kevin Tian <[email protected]>
Cc: Wei Liu <[email protected]>
Cc: "Roger Pau Monné" <[email protected]>
v2:
- Addressed comments from Jan
There is still the open question of whether use of a scratch page ought to be gated on something, either are run-time or compile-time.
--- xen/drivers/passthrough/amd/iommu_map.c | 62 ++++++++++++++++ xen/drivers/passthrough/amd/pci_amd_iommu.c | 14 ++-- xen/drivers/passthrough/iommu.c | 20 +++++- xen/drivers/passthrough/vtd/iommu.c | 72 +++++++++++++++---- xen/include/asm-x86/hvm/svm/amd-iommu-proto.h | 3 + xen/include/xen/iommu.h | 1 + 6 files changed, 148 insertions(+), 24 deletions(-)
xen/drivers/passthrough/amd/iommu_map.c +62 -0
@@ -560,6 +560,68 @@ int amd_iommu_reserve_domain_unity_map(struct domain *domain,return rt; } +int __init amd_iommu_quarantine_init (struct domain *d) +{ +struct domain_iommu *hd =dom_iommu (d); +unsigned long max_gfn = +PFN_DOWN ((1ul <<DEFAULT_DOMAIN_ADDRESS_WIDTH ) -1 ); +unsigned int level =amd_iommu_get_paging_mode (max_gfn); +struct amd_iommu_pte *table; + +if ( hd->arch.root_table ) + { +ASSERT_UNREACHABLE (); +return 0 ; + } + +spin_lock (&hd->arch.mapping_lock); + + hd->arch.root_table =alloc_amd_iommu_pgtable (); +if ( !hd->arch.root_table ) + goto out; + + table =__map_domain_page (hd->arch.root_table); +while ( level ) + { +struct page_info *pg; +unsigned int i; + +/* +* The pgtable allocator is fine for the leaf page, as well as +* page table pages, and the resulting allocations are always +* zeroed. +*/ + pg =alloc_amd_iommu_pgtable (); +if ( !pg ) +break ; + +for ( i =0 ; i <PTE_PER_TABLE_SIZE ; i++ ) + { +struct amd_iommu_pte *pde = &table[i]; + +/* +* PDEs are essentially a subset of PTEs, so this function +* is fine to use even at the leaf. +*/ +set_iommu_pde_present (pde,mfn_x (page_to_mfn (pg)), level -1 , + false, true); + } + +unmap_domain_page (table); + table =__map_domain_page (pg); + level--; + } +unmap_domain_page (table); + + out: +spin_unlock (&hd->arch.mapping_lock); + +amd_iommu_flush_all_pages (d); + +/* Pages leaked in failure case */ +return level ? -ENOMEM :0 ; +} +/* * Local variables: * mode: C
xen/drivers/passthrough/amd/pci_amd_iommu.c +4 -10
@@ -95,10 +95,6 @@ static void amd_iommu_setup_domain_device(u8 bus = pdev->bus;const struct domain_iommu *hd =dom_iommu (domain); -/* dom_io is used as a sentinel for quarantined devices */ -if ( domain == dom_io ) -return ; -BUG_ON ( !hd->arch.root_table || !hd->arch.paging_mode || !iommu->dev_table.buffer );
@@ -235,7 +231,7 @@ static int __must_check allocate_domain_resources(struct domain_iommu *hd)return rc; } -static int get_paging_mode (unsigned long entries) +int amd_iommu_get_paging_mode (unsigned long entries) {int level =1 ;
@@ -257,7 +253,8 @@ static int amd_iommu_domain_init(struct domain *d)/* For pv and dom0, stick with get_paging_mode(max_page) * For HVM dom0, use 2 level page table at first */ - hd->arch.paging_mode =is_hvm_domain (d) ?2 :get_paging_mode (max_page); + hd->arch.paging_mode =is_hvm_domain (d) ? +2 :amd_iommu_get_paging_mode (max_page);return 0 ; }
@@ -290,10 +287,6 @@ static void amd_iommu_disable_domain_device(const struct domain *domain,int req_id;u8 bus = pdev->bus; -/* dom_io is used as a sentinel for quarantined devices */ -if ( domain == dom_io ) -return ; -BUG_ON ( iommu->dev_table.buffer ==NULL ); req_id =get_dma_requestor_id (iommu->seg,PCI_BDF2 (bus, devfn)); table = iommu->dev_table.buffer;
@@ -632,6 +625,7 @@ static void amd_dump_p2m_table(struct domain *d) static const struct iommu_ops __initconstrel _iommu_ops = { .init = amd_iommu_domain_init, .hwdom_init = amd_iommu_hwdom_init, + .quarantine_init = amd_iommu_quarantine_init, .add_device = amd_iommu_add_device, .remove_device = amd_iommu_remove_device, .assign_device = amd_iommu_assign_device,
xen/drivers/passthrough/iommu.c +18 -2
@@ -440,6 +440,23 @@ int iommu_iotlb_flush_all(struct domain *d, unsigned int flush_flags)return rc; } +static int __init iommu_quarantine_init (void ) +{ +const struct domain_iommu *hd =dom_iommu (dom_io); +int rc; + + dom_io->options |= XEN_DOMCTL_CDF_iommu; + + rc =iommu_domain_init (dom_io,0 ); +if ( rc ) +return rc; + +if ( !hd->platform_ops->quarantine_init ) +return 0 ; + +return hd->platform_ops->quarantine_init (dom_io); +} +int __init iommu_setup (void ) {int rc = -ENODEV ;
@@ -473,8 +490,7 @@ int __init iommu_setup(void) }else { - dom_io->options |= XEN_DOMCTL_CDF_iommu; -if (iommu_domain_init (dom_io,0 ) ) +if (iommu_quarantine_init () )panic ("Could not set up quarantine\n" ); printk(" - Dom0 mode: %s\n",
xen/drivers/passthrough/vtd/iommu.c +60 -12
99 lines not on this page · raw message
xen/include/asm-x86/hvm/svm/amd-iommu-proto.h +3 -0
@@ -54,6 +54,9 @@ int amd_iommu_init_late(void);int amd_iommu_update_ivrs_mapping_acpi (void );int iov_adjust_irq_affinities (void ); +int amd_iommu_get_paging_mode (unsigned long entries); +int amd_iommu_quarantine_init (struct domain *d); +/* mapping functions */ int __must_check amd_iommu_map_page(struct domain *d, dfn_t dfn, mfn_t mfn, unsigned int flags,
xen/include/xen/iommu.h +1 -0
@@ -211,6 +211,7 @@ typedef int iommu_grdm_t(xen_pfn_t start, xen_ulong_t nr, u32 id, void *ctxt);struct iommu_ops {int (*init)(struct domain *d);void (*hwdom_init)(struct domain *d); +int (*quarantine_init)(struct domain *d);int (*add_device)(u8 devfn,device_t *dev);int (*enable_device)(device_t *dev);int (*remove_device)(u8 devfn,device_t *dev);
Signature · 7 lines
2.20.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 12 lines · Paul Durrant
This patch introduces a new
iommu_opto facilitate a per-implementation quarantine set up, and then further code for x86 implementations (amd and vtd) to set up a read-only scratch page to serve as the source for DMA reads whilst a device is assigned todom_io. DMA writes will continue to fault as before.The reason for doing this is that some hardware may continue to re-try DMA (despite FLR) in the event of an error, or even BME being cleared, and will fail to deal with DMA read faults gracefully. Having a scratch page mapped will allow pending DMA reads to complete and thus such buggy hardware will eventually be quiesced.
Quoted 6 lines
NOTE: These modifications are restricted to x86 implementations only as
the buggy h/w I am aware of is only used with Xen in an x86 environment. ARM may require similar code but, since I am not aware of the need, this patch does not modify any ARM implementation.Signed-off-by Paul Durrant <[email protected]>
Quoted 2 lines
There is still the open question of whether use of a scratch page ought to be gated on something, either are run-time or compile-time.
I have no clear opinion either way here. The workaround seems low overhead enough that there may not be a need to have an admin (or build time) control for this.
As to 4.13: The quarantining as a whole is pretty fresh. While it has been backported to security maintained trees, I'd still consider it a new feature in 4.13, and hence this workaround at least eligible for consideration.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 25 lines · Jan Beulich
Quoted 12 lines · Paul Durrant
This patch introduces a new
iommu_opto facilitate a per-implementation quarantine set up, and then further code for x86 implementations (amd and vtd) to set up a read-only scratch page to serve as the source for DMA reads whilst a device is assigned todom_io. DMA writes will continue to fault as before.The reason for doing this is that some hardware may continue to re-try DMA (despite FLR) in the event of an error, or even BME being cleared, and will fail to deal with DMA read faults gracefully. Having a scratch page mapped will allow pending DMA reads to complete and thus such buggy hardware will eventually be quiesced.
Quoted 6 lines
NOTE: These modifications are restricted to x86 implementations only as
the buggy h/w I am aware of is only used with Xen in an x86 environment. ARM may require similar code but, since I am not aware of the need, this patch does not modify any ARM implementation.Signed-off-by Paul Durrant <[email protected]>Reviewed-by Jan Beulich <[email protected]>Quoted 2 lines
There is still the open question of whether use of a scratch page ought to be gated on something, either are run-time or compile-time.
Quoted 8 lines
I have no clear opinion either way here. The workaround seems low overhead enough that there may not be a need to have an admin (or build time) control for this.
As to 4.13: The quarantining as a whole is pretty fresh. While it has been backported to security maintained trees, I'd still consider it a new feature in 4.13, and hence this workaround at least eligible for consideration.
I agree.
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 30 lines · Jürgen Groß
Quoted 29 lines · Jan Beulich
Quoted 12 lines · Paul Durrant
This patch introduces a new
iommu_opto facilitate a per-implementation quarantine set up, and then further code for x86 implementations (amd and vtd) to set up a read-only scratch page to serve as the source for DMA reads whilst a device is assigned todom_io. DMA writes will continue to fault as before.The reason for doing this is that some hardware may continue to re-try DMA (despite FLR) in the event of an error, or even BME being cleared, and will fail to deal with DMA read faults gracefully. Having a scratch page mapped will allow pending DMA reads to complete and thus such buggy hardware will eventually be quiesced.
Quoted 6 lines
NOTE: These modifications are restricted to x86 implementations only as
the buggy h/w I am aware of is only used with Xen in an x86 environment. ARM may require similar code but, since I am not aware of the need, this patch does not modify any ARM implementation.Signed-off-by Paul Durrant <[email protected]>Reviewed-by Jan Beulich <[email protected]>Quoted 2 lines
There is still the open question of whether use of a scratch page ought to be gated on something, either are run-time or compile-time.
I have no clear opinion either way here. The workaround seems low overhead enough that there may not be a need to have an admin (or build time) control for this.
Quoted 8 lines
Quoted 4 lines
As to 4.13: The quarantining as a whole is pretty fresh. While it has been backported to security maintained trees, I'd still consider it a new feature in 4.13, and hence this workaround at least eligible for consideration.
I agree.
Release-acked-by Juergen Gross <[email protected]>
I notice this has been committed meanwhile. I had specifically not done so due to the still missing VT-d ack, seeing that this wasn't an entirely "trivial" change.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 42 lines
From: Jan Beulich <[email protected]>
Sent: Tuesday, December 3, 2019 5:36 PMQuoted 3 lines · Jürgen Groß
Quoted 2 lines · Jan Beulich
Quoted 1 line · Paul Durrant
This patch introduces a new
iommu_opto facilitate a per-implementation
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
quarantine set up, and then further code for x86 implementations (amd and vtd) to set up a read-only scratch page to serve as the source for DMA reads whilst a device is assigned to
dom_io. DMA writes will continue to fault as before.The reason for doing this is that some hardware may continue to re-try DMA (despite FLR) in the event of an error, or even BME being cleared,
and
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
will fail to deal with DMA read faults gracefully. Having a scratch page mapped will allow pending DMA reads to complete and thus such buggy hardware will eventually be quiesced.
NOTE: These modifications are restricted to x86 implementations only as
the buggy h/w I am aware of is only used with Xen in an x86 environment. ARM may require similar code but, since I am not aware of the need, this patch does not modify any ARMimplementation.
Quoted 17 lines
Quoted 16 lines
Quoted 2 lines
Signed-off-by Paul Durrant <[email protected]>Reviewed-by Jan Beulich <[email protected]>Quoted 2 lines
There is still the open question of whether use of a scratch page ought to be gated on something, either are run-time or compile-time.
I have no clear opinion either way here. The workaround seems low overhead enough that there may not be a need to have an admin (or build time) control for this.
As to 4.13: The quarantining as a whole is pretty fresh. While it has been backported to security maintained trees, I'd still consider it a new feature in 4.13, and hence this workaround at least eligible for consideration.
Quoted 8 lines
Quoted 3 lines
I agree.
Release-acked-by Juergen Gross <[email protected]>I notice this has been committed meanwhile. I had specifically not done so due to the still missing VT-d ack, seeing that this wasn't an entirely "trivial" change.
While the quarantine idea sounds good overall, I'm still not convinced to have it the only way in place just for handling some known-buggy device. It kills the possibility of identifying a new buggy device and then deciding not to use it in the first space... I thought about whether it will get better when future IOMMU implements A/D bit - by checking access bit being set then we'll know some buggy device exists, but, the scratch page is shared by all devices then we cannot rely on this feature to find out the actual buggy one.
Thanks
Kevin
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 51 lines · Kevin
Quoted 42 lines
From: Jan Beulich <[email protected]>
Sent: Tuesday, December 3, 2019 5:36 PMQuoted 3 lines · Jürgen Groß
Quoted 2 lines · Jan Beulich
Quoted 1 line · Paul Durrant
This patch introduces a new
iommu_opto facilitate a per-implementation
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
quarantine set up, and then further code for x86 implementations (amd and vtd) to set up a read-only scratch page to serve as the source for DMA reads whilst a device is assigned to
dom_io. DMA writes will continue to fault as before.The reason for doing this is that some hardware may continue to re-try DMA (despite FLR) in the event of an error, or even BME being cleared,
and
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
will fail to deal with DMA read faults gracefully. Having a scratch page mapped will allow pending DMA reads to complete and thus such buggy hardware will eventually be quiesced.
NOTE: These modifications are restricted to x86 implementations only as
the buggy h/w I am aware of is only used with Xen in an x86 environment. ARM may require similar code but, since I am not aware of the need, this patch does not modify any ARMimplementation.
Quoted 17 lines
Quoted 16 lines
Quoted 2 lines
Signed-off-by Paul Durrant <[email protected]>Reviewed-by Jan Beulich <[email protected]>Quoted 2 lines
There is still the open question of whether use of a scratch page ought to be gated on something, either are run-time or compile-time.
I have no clear opinion either way here. The workaround seems low overhead enough that there may not be a need to have an admin (or build time) control for this.
As to 4.13: The quarantining as a whole is pretty fresh. While it has been backported to security maintained trees, I'd still consider it a new feature in 4.13, and hence this workaround at least eligible for consideration.
Quoted 8 lines
Quoted 3 lines
I agree.
Release-acked-by Juergen Gross <[email protected]>I notice this has been committed meanwhile. I had specifically not done so due to the still missing VT-d ack, seeing that this wasn't an entirely "trivial" change.
Quoted 8 lines
While the quarantine idea sounds good overall, I'm still not convinced to have it the only way in place just for handling some known-buggy device. It kills the possibility of identifying a new buggy device and then deciding not to use it in the first space... I thought about whether it will get better when future IOMMU implements A/D bit - by checking access bit being set then we'll know some buggy device exists, but, the scratch page is shared by all devices then we cannot rely on this feature to find out the actual buggy one.
Thinking about it - yes, I think I agree. This (as with so many workarounds) would better be an off-by-default one. The main issue I understand this would have is that buggy systems then might hang without even having managed to get a log message out - Paul?
Jürgen - would you be amenable to an almost last minute refinement here (would then also need to still be backported to 4.12.2, or the original backport reverted, to avoid giving the impression of a regression)?
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 66 lines · Jan Beulich
Quoted 51 lines · Kevin
Quoted 42 lines
From: Jan Beulich <[email protected]>
Sent: Tuesday, December 3, 2019 5:36 PMQuoted 3 lines · Jürgen Groß
Quoted 2 lines · Jan Beulich
Quoted 1 line · Paul Durrant
This patch introduces a new
iommu_opto facilitate a per-implementation
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
quarantine set up, and then further code for x86 implementations (amd and vtd) to set up a read-only scratch page to serve as the source for DMA reads whilst a device is assigned to
dom_io. DMA writes will continue to fault as before.The reason for doing this is that some hardware may continue to re-try DMA (despite FLR) in the event of an error, or even BME being cleared,
and
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
will fail to deal with DMA read faults gracefully. Having a scratch page mapped will allow pending DMA reads to complete and thus such buggy hardware will eventually be quiesced.
NOTE: These modifications are restricted to x86 implementations only as
the buggy h/w I am aware of is only used with Xen in an x86 environment. ARM may require similar code but, since I am not aware of the need, this patch does not modify any ARMimplementation.
Quoted 17 lines
Quoted 16 lines
Quoted 2 lines
Signed-off-by Paul Durrant <[email protected]>Reviewed-by Jan Beulich <[email protected]>Quoted 2 lines
There is still the open question of whether use of a scratch page ought to be gated on something, either are run-time or compile-time.
I have no clear opinion either way here. The workaround seems low overhead enough that there may not be a need to have an admin (or build time) control for this.
As to 4.13: The quarantining as a whole is pretty fresh. While it has been backported to security maintained trees, I'd still consider it a new feature in 4.13, and hence this workaround at least eligible for consideration.
Quoted 8 lines
Quoted 3 lines
I agree.
Release-acked-by Juergen Gross <[email protected]>I notice this has been committed meanwhile. I had specifically not done so due to the still missing VT-d ack, seeing that this wasn't an entirely "trivial" change.
Quoted 8 lines
While the quarantine idea sounds good overall, I'm still not convinced to have it the only way in place just for handling some known-buggy device. It kills the possibility of identifying a new buggy device and then deciding not to use it in the first space... I thought about whether it will get better when future IOMMU implements A/D bit - by checking access bit being set then we'll know some buggy device exists, but, the scratch page is shared by all devices then we cannot rely on this feature to find out the actual buggy one.
Thinking about it - yes, I think I agree. This (as with so many workarounds) would better be an off-by-default one. The main issue I understand this would have is that buggy systems then might hang without even having managed to get a log message out - Paul?
Quoted 4 lines
Jürgen - would you be amenable to an almost last minute refinement here (would then also need to still be backported to 4.12.2, or the original backport reverted, to avoid giving the impression of a regression)?
So what is your suggestion here? To have a boot option (defaulting to off) for enabling the scratch page?
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 73 lines
-----Original Message-----
From: Jürgen Groß <[email protected]>
Sent: 10 December 2019 08:12
To: Jan Beulich <[email protected]>; Tian, Kevin <[email protected]>; Durrant, Paul <[email protected]>
Cc: Andrew Cooper <[email protected]>; xen- [email protected]; Roger Pau Monné <[email protected]>; Wei Liu <[email protected]>
Subject: Re: [PATCH v2] x86 / iommu: set up a scratch page in the quarantine domainQuoted 11 lines · Jan Beulich
Quoted 10 lines · Kevin
Quoted 10 lines
From: Jan Beulich <[email protected]>
Sent: Tuesday, December 3, 2019 5:36 PMQuoted 3 lines · Jürgen Groß
Quoted 2 lines · Jan Beulich
Quoted 1 line · Paul Durrant
This patch introduces a new
iommu_opto facilitate a per-implementation
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
quarantine set up, and then further code for x86 implementations (amd and vtd) to set up a read-only scratch page to serve as the
source
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
for DMA reads whilst a device is assigned to
dom_io. DMA writeswill
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
continue to fault as before.
The reason for doing this is that some hardware may continue to re-
try
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
DMA (despite FLR) in the event of an error, or even BME being
cleared,
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
and
Quoted 1 line
Quoted 1 line
Quoted 1 line
will fail to deal with DMA read faults gracefully. Having a scratch
page
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
mapped will allow pending DMA reads to complete and thus such buggy hardware will eventually be quiesced.
NOTE: These modifications are restricted to x86 implementations
only as
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
the buggy h/w I am aware of is only used with Xen in an x86 environment. ARM may require similar code but, since I am
not
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
aware of the need, this patch does not modify any ARM
implementation.
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
Signed-off-by Paul Durrant <[email protected]>Reviewed-by Jan Beulich <[email protected]>Quoted 1 line
There is still the open question of whether use of a scratch page
ought
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 1 line
to be gated on something, either are run-time or compile-time.
I have no clear opinion either way here. The workaround seems low overhead enough that there may not be a need to have an admin (or build time) control for this.
As to 4.13: The quarantining as a whole is pretty fresh. While it has been backported to security maintained trees, I'd still consider it a new feature in 4.13, and hence this workaround at least
eligible
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 5 lines
Quoted 1 line
for consideration.
I agree.
Release-acked-by Juergen Gross <[email protected]>I notice this has been committed meanwhile. I had specifically not done so due to the still missing VT-d ack, seeing that this wasn't an entirely "trivial" change.
Quoted 15 lines
Quoted 3 lines
Quoted 3 lines
While the quarantine idea sounds good overall, I'm still not convinced to have it the only way in place just for handling some known-buggy device. It kills the possibility of identifying a new buggy device and
then
Quoted 11 lines
Quoted 5 lines
deciding not to use it in the first space... I thought about whether it will get better when future IOMMU implements A/D bit - by checking access bit being set then we'll know some buggy device exists, but, the scratch page is shared by all devices then we cannot rely on this feature to find out the actual buggy one.
Thinking about it - yes, I think I agree. This (as with so many workarounds) would better be an off-by-default one. The main issue I understand this would have is that buggy systems then might hang without even having managed to get a log message out - Paul?
Yes, that's the concern. Some systems will wedge hard on the first fault with no logging. I have no objection to a command line parameter but IMO it ought to default on, at least in non-debug mode.
Paul
Quoted 10 lines
Quoted 4 lines
Jürgen - would you be amenable to an almost last minute refinement here (would then also need to still be backported to 4.12.2, or the original backport reverted, to avoid giving the impression of a regression)?
So what is your suggestion here? To have a boot option (defaulting to off) for enabling the scratch page?
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 16 lines · Jürgen Groß
Quoted 15 lines · Jan Beulich
Quoted 8 lines · Kevin
While the quarantine idea sounds good overall, I'm still not convinced to have it the only way in place just for handling some known-buggy device. It kills the possibility of identifying a new buggy device and then deciding not to use it in the first space... I thought about whether it will get better when future IOMMU implements A/D bit - by checking access bit being set then we'll know some buggy device exists, but, the scratch page is shared by all devices then we cannot rely on this feature to find out the actual buggy one.
Thinking about it - yes, I think I agree. This (as with so many workarounds) would better be an off-by-default one. The main issue I understand this would have is that buggy systems then might hang without even having managed to get a log message out - Paul?
Quoted 7 lines
Quoted 4 lines
Jürgen - would you be amenable to an almost last minute refinement here (would then also need to still be backported to 4.12.2, or the original backport reverted, to avoid giving the impression of a regression)?
So what is your suggestion here? To have a boot option (defaulting to off) for enabling the scratch page?
Yes (and despite having seen Paul's reply).
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 22 lines · Jan Beulich
Quoted 21 lines · Jürgen Groß
Quoted 19 lines · Jan Beulich
Quoted 8 lines · Kevin
While the quarantine idea sounds good overall, I'm still not convinced to have it the only way in place just for handling some known-buggy device. It kills the possibility of identifying a new buggy device and then deciding not to use it in the first space... I thought about whether it will get better when future IOMMU implements A/D bit - by checking access bit being set then we'll know some buggy device exists, but, the scratch page is shared by all devices then we cannot rely on this feature to find out the actual buggy one.
Thinking about it - yes, I think I agree. This (as with so many workarounds) would better be an off-by-default one. The main issue I understand this would have is that buggy systems then might hang without even having managed to get a log message out - Paul?
Jürgen - would you be amenable to an almost last minute refinement here (would then also need to still be backported to 4.12.2, or the original backport reverted, to avoid giving the impression of a regression)?
Quoted 4 lines
Quoted 2 lines
So what is your suggestion here? To have a boot option (defaulting to off) for enabling the scratch page?
Yes (and despite having seen Paul's reply).
I'd release ack such a patch in case you come to an agreement regarding the default soon.
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 37 lines
-----Original Message-----
From: Jürgen Groß <[email protected]>
Sent: 10 December 2019 09:07
To: Jan Beulich <[email protected]>
Cc: Tian, Kevin <[email protected]>; Durrant, Paul <[email protected]>; Andrew Cooper <[email protected]>; xen- [email protected]; Roger Pau Monné <[email protected]>; Wei Liu <[email protected]>
Subject: Re: [PATCH v2] x86 / iommu: set up a scratch page in the quarantine domainQuoted 4 lines · Jan Beulich
Quoted 3 lines · Jürgen Groß
Quoted 2 lines · Jan Beulich
Quoted 1 line · Kevin
While the quarantine idea sounds good overall, I'm still not
convinced
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
to have it the only way in place just for handling some known-buggy device. It kills the possibility of identifying a new buggy device
and then
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
deciding not to use it in the first space... I thought about whether
it
Quoted 15 lines
Quoted 15 lines
Quoted 14 lines
Quoted 4 lines
will get better when future IOMMU implements A/D bit - by checking access bit being set then we'll know some buggy device exists, but, the scratch page is shared by all devices then we cannot rely on this feature to find out the actual buggy one.
Thinking about it - yes, I think I agree. This (as with so many workarounds) would better be an off-by-default one. The main issue I understand this would have is that buggy systems then might hang without even having managed to get a log message out - Paul?
Jürgen - would you be amenable to an almost last minute refinement here (would then also need to still be backported to 4.12.2, or the original backport reverted, to avoid giving the impression of a regression)?
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
So what is your suggestion here? To have a boot option (defaulting to off) for enabling the scratch page?
Yes (and despite having seen Paul's reply).
I'd release ack such a patch in case you come to an agreement regarding the default soon.
Ok. The default is not that crucial. Perhaps it's just me who thinks defaults should be chosen on the basis of being most likely to result in a working system.
Paul
Quoted 2 lines
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 42 lines · Paul
Quoted 42 lines
-----Original Message-----
From: Jürgen Groß <[email protected]>
Sent: 10 December 2019 09:07
To: Jan Beulich <[email protected]>
Cc: Tian, Kevin <[email protected]>; Durrant, Paul <[email protected]>; Andrew Cooper <[email protected]>; xen- [email protected]; Roger Pau Monné <[email protected]>; Wei Liu <[email protected]>
Subject: Re: [PATCH v2] x86 / iommu: set up a scratch page in the quarantine domainQuoted 4 lines · Jan Beulich
Quoted 3 lines · Jürgen Groß
Quoted 2 lines · Jan Beulich
Quoted 1 line · Kevin
While the quarantine idea sounds good overall, I'm still not
convinced
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
to have it the only way in place just for handling some known-buggy device. It kills the possibility of identifying a new buggy device
and then
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
deciding not to use it in the first space... I thought about whether
it
Quoted 19 lines
Quoted 10 lines
Quoted 10 lines
Quoted 4 lines
will get better when future IOMMU implements A/D bit - by checking access bit being set then we'll know some buggy device exists, but, the scratch page is shared by all devices then we cannot rely on this feature to find out the actual buggy one.
Thinking about it - yes, I think I agree. This (as with so many workarounds) would better be an off-by-default one. The main issue I understand this would have is that buggy systems then might hang without even having managed to get a log message out - Paul?
Quoted 7 lines
Quoted 4 lines
Jürgen - would you be amenable to an almost last minute refinement here (would then also need to still be backported to 4.12.2, or the original backport reverted, to avoid giving the impression of a regression)?
So what is your suggestion here? To have a boot option (defaulting to off) for enabling the scratch page?
Yes (and despite having seen Paul's reply).
Quoted 7 lines
Quoted 3 lines
I'd release ack such a patch in case you come to an agreement regarding the default soon.
Ok. The default is not that crucial. Perhaps it's just me who thinks defaults should be chosen on the basis of being most likely to result in a working system.
If it wasn't for quirky hardware (or firmware to cover the general case, in particular to avoid getting quoted on this wrt my position on EFI workarounds), I'd agree. But personally I think Kevin's point takes priority here: Admins should at least be aware of running quirky hardware, and hence I'd prefer the default to be logging of faults rather than their silencing. Documentation of the new (sub-)option may give suitable hints, and we may even go as far as providing a Kconfig option for the default to be chosen at build time.
Main question now is - who's going to make a patch? Will you? Should I?
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 72 lines
-----Original Message-----
From: Jan Beulich <[email protected]>
Sent: 10 December 2019 09:45
To: Durrant, Paul <[email protected]>
Cc: Jürgen Groß <[email protected]>; Tian, Kevin <[email protected]>; Andrew Cooper <[email protected]>; [email protected]; Roger Pau Monné <[email protected]>; Wei Liu <[email protected]>
Subject: Re: [PATCH v2] x86 / iommu: set up a scratch page in the quarantine domainQuoted 13 lines · Paul
Quoted 13 lines
-----Original Message-----
From: Jürgen Groß <[email protected]>
Sent: 10 December 2019 09:07
To: Jan Beulich <[email protected]>
Cc: Tian, Kevin <[email protected]>; Durrant, Paul <[email protected]>; Andrew Cooper <[email protected]>; xen- [email protected]; Roger Pau Monné <[email protected]>; Wei Liu <[email protected]>
Subject: Re: [PATCH v2] x86 / iommu: set up a scratch page in the quarantine domainQuoted 1 line · Jan Beulich
On 10.12.2019 09:12, Jürgen Groß wrote:
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines · Jan Beulich
Quoted 2 lines · Kevin
Quoted 1 line
While the quarantine idea sounds good overall, I'm still not
convinced
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
to have it the only way in place just for handling some known-buggy device. It kills the possibility of identifying a new buggy device
and then
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
deciding not to use it in the first space... I thought about
whether
Quoted 4 lines
Quoted 4 lines
it
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
will get better when future IOMMU implements A/D bit - by checking access bit being set then we'll know some buggy device exists, but, the scratch page is shared by all devices then we cannot rely on
this
Quoted 17 lines
Quoted 17 lines
Quoted 16 lines
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
feature to find out the actual buggy one.
Thinking about it - yes, I think I agree. This (as with so many workarounds) would better be an off-by-default one. The main issue I understand this would have is that buggy systems then might hang without even having managed to get a log message out - Paul?
Quoted 7 lines
Quoted 4 lines
Jürgen - would you be amenable to an almost last minute refinement here (would then also need to still be backported to 4.12.2, or the original backport reverted, to avoid giving the impression of a regression)?
So what is your suggestion here? To have a boot option (defaulting to off) for enabling the scratch page?
Yes (and despite having seen Paul's reply).
Quoted 7 lines
Quoted 3 lines
I'd release ack such a patch in case you come to an agreement regarding the default soon.
Ok. The default is not that crucial. Perhaps it's just me who thinks defaults should be chosen on the basis of being most likely to result in a working system.
If it wasn't for quirky hardware (or firmware to cover the general case, in particular to avoid getting quoted on this wrt my position on EFI workarounds), I'd agree. But personally I think Kevin's point takes priority here: Admins should at least be aware of running quirky hardware, and hence I'd prefer the default to be logging of faults rather than their silencing. Documentation of the new (sub-)option may give suitable hints, and we may even go as far as providing a
Kconfigoption for the default to be chosen at build time.
Quoted 2 lines
Main question now is - who's going to make a patch? Will you? Should I?
I'm happy to do it, but it would probably be more expedient if you did.
Paul
Quoted 1 line
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel