From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3588CC6379D for ; Tue, 24 Nov 2020 09:38:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A6C772073C for ; Tue, 24 Nov 2020 09:38:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alien8.de header.i=@alien8.de header.b="E6jhhwVo" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731533AbgKXJiq (ORCPT ); Tue, 24 Nov 2020 04:38:46 -0500 Received: from mail.skyhub.de ([5.9.137.197]:43162 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731507AbgKXJin (ORCPT ); Tue, 24 Nov 2020 04:38:43 -0500 Received: from zn.tnic (p200300ec2f0e360052021be21853ebf1.dip0.t-ipconnect.de [IPv6:2003:ec:2f0e:3600:5202:1be2:1853:ebf1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id CE42E1EC0529; Tue, 24 Nov 2020 10:38:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1606210721; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=mIxQeGPd5ay/UcAwPgNBuQ42UymVxYGQUjrVO6RwKWQ=; b=E6jhhwVoW/NqalShXB4DbazzDfcgmyJayc5KYXVkeB8CMqqMLHVxBSIrgilA2M0GYiHEnx WVDJpaWLhKXqdS8GYi2v8gYrAvW6YHGCa3G5texvNNLmu77ZCuHqarUkTAPB90Hiy1cQoI rY4yXG5THYW6gbbgiFs/MdYplMmcCj8= Date: Tue, 24 Nov 2020 10:38:37 +0100 From: Borislav Petkov To: "Kalra, Ashish" Cc: Konrad Rzeszutek Wilk , "hch@lst.de" , "tglx@linutronix.de" , "mingo@redhat.com" , "hpa@zytor.com" , "x86@kernel.org" , "luto@kernel.org" , "peterz@infradead.org" , "dave.hansen@linux-intel.com" , "iommu@lists.linux-foundation.org" , "linux-kernel@vger.kernel.org" , "Singh, Brijesh" , "Lendacky, Thomas" , "Grimm, Jon" , "rientjes@google.com" Subject: Re: [PATCH v6] swiotlb: Adjust SWIOTBL bounce buffer size for SEV guests. Message-ID: <20201124093837.GD4009@zn.tnic> References: <20201119214205.11062-1-Ashish.Kalra@amd.com> <20201123170647.GE15044@zn.tnic> <20201123175632.GA21539@char.us.oracle.com> <20201123225631.GA16055@ashkalra_ubuntu_server> <20201124090431.GC4009@zn.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 24, 2020 at 09:25:06AM +0000, Kalra, Ashish wrote: > But what will be the criteria to figure out this percentage? > > As I mentioned earlier, this can be made as complicated as possible by > adding all kind of heuristics but without any predictable performance > gain. > > Or it can be kept simple by using a static percentage value. Yes, static percentage number based on the guest memory. X% of the guest memory is used for SWIOTLB. Since you use sev_active(), it means the size computation is done in the guest so that SWIOTLB size is per-guest. Yes? If so, you can simply take, say, 5% of the guest memory's size and use that for SWIOTLB buffers. Or 6 or X or whatever. Makes sense? -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette