x86/iommu: account for necessary allocations when calculating Dom0's initial allocation size
PATCH 1/1 x86/iommu: account for necessary allocations when calculating Dom0's initial allocation size
As of c/s 21812:e382656e4dcc, IOMMU related allocations for Dom0 happen only after it got all of its memory allocated, and hence the reserve (mainly for setting up its swiotlb) may get exhausted without accounting for the necessary allocations up front.
While not precise, the estimate has been found to be within a couple of pages for the systems it got tested on.
For the calculation to be reasonably correct, this depends on the patch titled "x86/iommu: don't map RAM holes above 4G" sent out yesterday.
xen/arch/x86/domain_build.c +9 -0
@@ -191,6 +191,15 @@ static unsigned long __init compute_dom0if (is_pv_32on64_domain (d) ) avail -= opt_dom0_max_vcpus -1 ; +/* Reserve memory for iommu_dom0_init() (rough estimate). */ +if ( iommu_enabled ) + { +unsigned int s; + +for ( s =9 ; s <BITS_PER_LONG ; s +=9 ) + avail -= max_pdx >> s; + } +/* * If domain 0 allocation isn't specified, reserve 1/16th of available * memory for things like DMA buffers. This reservation is clamped to
As of c/s 21812:e382656e4dcc, IOMMU related allocations for Dom0 happen only after it got all of its memory allocated, and hence the reserve (mainly for setting up its swiotlb) may get exhausted without accounting for the necessary allocations up front.
While not precise, the estimate has been found to be within a couple of pages for the systems it got tested on.
For the calculation to be reasonably correct, this depends on the patch titled "x86/iommu: don't map RAM holes above 4G" sent out yesterday.
xen/arch/x86/domain_build.c +9 -0
@@ -191,6 +191,15 @@ static unsigned long __init compute_dom0if (is_pv_32on64_domain (d) ) avail -= opt_dom0_max_vcpus -1 ; +/* Reserve memory for iommu_dom0_init() (rough estimate). */ +if ( iommu_enabled ) + { +unsigned int s; + +for ( s =9 ; s <BITS_PER_LONG ; s +=9 ) + avail -= max_pdx >> s; + } +/* * If domain 0 allocation isn't specified, reserve 1/16th of available * memory for things like DMA buffers. This reservation is clamped to
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Thank Jan. I'm not really sure about putting your earlier patch into 4.0.2, so can I put only this patch in for 4.0.2, replacing max_pdx with max_page?
-- Keir
Quoted 39 lines · Jan Beulich
As of c/s 21812:e382656e4dcc, IOMMU related allocations for Dom0 happen only after it got all of its memory allocated, and hence the reserve (mainly for setting up its swiotlb) may get exhausted without accounting for the necessary allocations up front.
While not precise, the estimate has been found to be within a couple of pages for the systems it got tested on.
For the calculation to be reasonably correct, this depends on the patch titled "x86/iommu: don't map RAM holes above 4G" sent out yesterday.
Signed-off-by Jan Beulich <[email protected]>xen/arch/x86/domain_build.c +9
-0@@ -191,6 +191,15 @@ static unsigned long __init compute_dom0if (is_pv_32on64_domain (d) ) avail -= opt_dom0_max_vcpus -1 ; +/* Reserve memory for iommu_dom0_init() (rough estimate). */ +if ( iommu_enabled ) + { +unsigned int s; + +for ( s =9 ; s <BITS_PER_LONG ; s +=9 ) + avail -= max_pdx >> s; + } +/* * If domain 0 allocation isn't specified, reserve 1/16th of available * memory for things like DMA buffers. This reservation is clamped to _______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 3 lines
Quoted 1 line
Quoted 1 line · Keir Fraser
Thank Jan. I'm not really sure about putting your earlier patch into 4.0.2, so can I put only this patch in for 4.0.2, replacing
max_pdxwithmax_page?
Yes, that would be the correct equivalent without that other patch.
But it is clear that without the other one a system may not even boot if the holes are large enough - but that's the case in plain 4.0.0 too, i.e. not a regression.
Jan
Quoted 41 lines · Jan Beulich
Quoted 40 lines
As of c/s 21812:e382656e4dcc, IOMMU related allocations for Dom0 happen only after it got all of its memory allocated, and hence the reserve (mainly for setting up its swiotlb) may get exhausted without accounting for the necessary allocations up front.
While not precise, the estimate has been found to be within a couple of pages for the systems it got tested on.
For the calculation to be reasonably correct, this depends on the patch titled "x86/iommu: don't map RAM holes above 4G" sent out yesterday.
Signed-off-by Jan Beulich <[email protected]>xen/arch/x86/domain_build.c +9
-0@@ -191,6 +191,15 @@ static unsigned long __init compute_dom0if (is_pv_32on64_domain (d) ) avail -= opt_dom0_max_vcpus -1 ; +/* Reserve memory for iommu_dom0_init() (rough estimate). */ +if ( iommu_enabled ) + { +unsigned int s; + +for ( s =9 ; s <BITS_PER_LONG ; s +=9 ) + avail -= max_pdx >> s; + } +/* * If domain 0 allocation isn't specified, reserve 1/16th of available * memory for things like DMA buffers. This reservation is clamped to _______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel