[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201207121007.GD20489@zn.tnic>
Date: Mon, 7 Dec 2020 13:10:07 +0100
From: Borislav Petkov <bp@...en8.de>
To: Ashish Kalra <Ashish.Kalra@....com>
Cc: konrad.wilk@...cle.com, hch@....de, tglx@...utronix.de,
mingo@...hat.com, hpa@...or.com, x86@...nel.org, luto@...nel.org,
peterz@...radead.org, dave.hansen@...ux-intel.com,
iommu@...ts.linux-foundation.org, linux-kernel@...r.kernel.org,
brijesh.singh@....com, Thomas.Lendacky@....com, Jon.Grimm@....com,
rientjes@...gle.com
Subject: Re: [PATCH v7] swiotlb: Adjust SWIOTBL bounce buffer size for SEV
guests.
On Thu, Dec 03, 2020 at 03:25:59AM +0000, Ashish Kalra wrote:
> diff --git a/arch/x86/mm/mem_encrypt.c b/arch/x86/mm/mem_encrypt.c
> index 1bcfbcd2bfd7..46549bd3d840 100644
> --- a/arch/x86/mm/mem_encrypt.c
> +++ b/arch/x86/mm/mem_encrypt.c
> @@ -485,7 +485,38 @@ static void print_mem_encrypt_feature_info(void)
> pr_cont("\n");
> }
Any text about why 6% was chosen? A rule of thumb or so? Measurements?
> +#define SEV_ADJUST_SWIOTLB_SIZE_PERCENT 6
> +
> /* Architecture __weak replacement functions */
> +unsigned long __init arch_swiotlb_adjust(unsigned long iotlb_default_size)
> +{
> + unsigned long size = iotlb_default_size;
> +
> + /*
> + * For SEV, all DMA has to occur via shared/unencrypted pages.
> + * SEV uses SWOTLB to make this happen without changing device
> + * drivers. However, depending on the workload being run, the
> + * default 64MB of SWIOTLB may not be enough and`SWIOTLB may
> + * run out of buffers for DMA, resulting in I/O errors and/or
> + * performance degradation especially with high I/O workloads.
> + * Adjust the default size of SWIOTLB for SEV guests using
> + * a percentage of guest memory for SWIOTLB buffers.
> + * Also as the SWIOTLB bounce buffer memory is allocated
> + * from low memory, ensure that the adjusted size is within
> + * the limits of low available memory.
> + *
> + */
> + if (sev_active()) {
> + phys_addr_t total_mem = memblock_phys_mem_size();
Please integrate scripts/checkpatch.pl into your patch creation
workflow. Some of the warnings/errors *actually* make sense:
WARNING: Missing a blank line after declarations
#95: FILE: arch/x86/mm/mem_encrypt.c:511:
+ phys_addr_t total_mem = memblock_phys_mem_size();
+ size = total_mem * SEV_ADJUST_SWIOTLB_SIZE_PERCENT / 100;
But no need to resend now - just a hint for the future.
Konrad, ack?
On a 2G guest here, it says:
[ 0.018373] SWIOTLB bounce buffer size adjusted to 122MB for SEV
so it makes sense to me.
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists