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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE724C3DA4A for ; Wed, 14 Aug 2024 23:36:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 733DE6B0088; Wed, 14 Aug 2024 19:36:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6BCD26B0089; Wed, 14 Aug 2024 19:36:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 55D2F6B008A; Wed, 14 Aug 2024 19:36:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 34F8C6B0088 for ; Wed, 14 Aug 2024 19:36:17 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id DE64D160BDD for ; Wed, 14 Aug 2024 23:36:16 +0000 (UTC) X-FDA: 82452461952.08.FC9C832 Received: from out-174.mta0.migadu.com (out-174.mta0.migadu.com [91.218.175.174]) by imf28.hostedemail.com (Postfix) with ESMTP id A1EDEC001A for ; Wed, 14 Aug 2024 23:36:13 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b="WBBRj/2l"; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf28.hostedemail.com: domain of oliver.upton@linux.dev designates 91.218.175.174 as permitted sender) smtp.mailfrom=oliver.upton@linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1723678561; a=rsa-sha256; cv=none; b=Lxu+JFMxCuKaEKjpnFPuMBPtJcyV554TE8AV4yBFF01OJ/FFkTJNlRmDFXbX2rNmJi5BHk OQtP3XQH6vpwwOkjVsje73/1lbmVJsCm3gWQG8SRy8umWOoNF615X4IBTMqMG5llqgucBB cBLtG3LVXHto6nG6eSRLOd863vh5nyk= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b="WBBRj/2l"; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf28.hostedemail.com: domain of oliver.upton@linux.dev designates 91.218.175.174 as permitted sender) smtp.mailfrom=oliver.upton@linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1723678561; h=from:from:sender: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:dkim-signature; bh=x2WFD3PneXB3Rd+FYibt8Nz/Vwl/XrkmHsW23VAaN+4=; b=svalAUX8L++aa2v/JAlDz1lmyWmQkEWmdf2DMFHZgbkBpKdiwnVCwK2cWL2OiPtSD+PzU5 JiqychrkvhrEp+cGTsqdFPPAYrsWw7SBN6l+oyNxGpa6RtfBJ882IoIhMEzLO+1XIctbp7 GdIN4AvSseHNzOw4vdSPAf4IHYEzGOk= Date: Wed, 14 Aug 2024 16:36:03 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1723678572; 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: in-reply-to:in-reply-to:references:references; bh=x2WFD3PneXB3Rd+FYibt8Nz/Vwl/XrkmHsW23VAaN+4=; b=WBBRj/2lYUKohCoueMwI9fFFjIrOaFNP9VWxDVtNBkYmY4amkDR6AEL+BMkcd18ojnFBF7 VGhYD+72w9C8RKDhRrRdFJ+hrPBIhRpr6XXBDQxPvU9oS3mzQSFGFUH/9bYqy0aGATnBIt x2vc8/ecLpBix79HoBhmWqz44F1VGQo= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: Jason Gunthorpe Cc: Sean Christopherson , Peter Xu , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Oscar Salvador , Axel Rasmussen , linux-arm-kernel@lists.infradead.org, x86@kernel.org, Will Deacon , Gavin Shan , Paolo Bonzini , Zi Yan , Andrew Morton , Catalin Marinas , Ingo Molnar , Alistair Popple , Borislav Petkov , David Hildenbrand , Thomas Gleixner , kvm@vger.kernel.org, Dave Hansen , Alex Williamson , Yan Zhao , Marc Zyngier Subject: Re: [PATCH 00/19] mm: Support huge pfnmaps Message-ID: References: <20240809160909.1023470-1-peterx@redhat.com> <20240814123715.GB2032816@nvidia.com> <20240814144307.GP2032816@nvidia.com> <20240814221031.GA2032816@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240814221031.GA2032816@nvidia.com> X-Migadu-Flow: FLOW_OUT X-Rspam-User: X-Rspamd-Queue-Id: A1EDEC001A X-Rspamd-Server: rspam01 X-Stat-Signature: 6ctg6fkt8otp7qsgmw7ba67yo7xnr38n X-HE-Tag: 1723678573-422252 X-HE-Meta: U2FsdGVkX19IxqX21fF1e7oor1M4J9EmU+2EypWMXhURNxlgx579oQlOm1XNVP5/DXCtoDFCioaIIQTR0ABP6fEZt8vUTJmSGdohepS5MfKcmOEJmWh3mnZL/sv/In5h6hyS03T7EW7+CjM/CRA4PcyccV26821I6qYMvA2XyInPyzYQ+AeotXEBA8zesyuBv7+hTE+7fc8jzaMemUTWN5QnlZ/N6ZmUAEcKw+sU8Odg3XFaAHIxD5h79dRKXiMTMWeDr7ZkUZQVFtMILGLzfbEVUjEuMukPw6mn6FngZUFfFn6c31/THU6E7PBQcg5nf2HQ4UcsEhUxjqlOHnpWdQfwhdZZUShF51GIXEh6wCHMkIBo/21bCq7yKNBSdkzvTx6+UAr9BJmodhQ6YYNQII5qvfbWQ5+ovN9ckNvvwG67Y0iBxjE87bol61ZgIRuBoO7z3eWpWluTjjzYolQVSU+pDaWV8sz6JPbRBQzKRJ33D8AktRiM361538L/r+zbfLB6Aqqi4oqYon3ZKm5EYpseex+nD1GGNoxtG1YByaRN1oFNBkW2/el+XotkFskhitndJJRP2A3ZXAWnERIyTbG0Re1BwrOUQQQbSPQ1yZZEVJqvjJVhO+Q4EPrXZkPk5uHN5g+IYbhVrVvNJ3WCpUrdiPsmC3fbUFSGfrJ8Bzv5MwZE4Z4UOEV5YAYCbRWgZXzXkbmSSwVzJ2cTFY9Zy85i/QWL87brOUpSiHlx+s1EibE+sZe7hDBnUySLgJ6qopbmag5Quqrom6Mr1WWG+qHpr+SOC6MMrtf8g4Zvmv3MK90rkzVaXPW3/dzCFG7Kd1Si5sQ2gMPrnE4nPl39CyYgYbJUo7QmFfJ8Rk1bIMiRcnAJuZDqQlaQjWJ/u2mjMyRLf3+YF/QcYzzJwIA9vWGnAa1doXVodVM/ex1vcz6JMbmuUTIRXINWuQD7qGL0ZGTcAM3Y2Lh5mQPBjv+ JvSIgOUO ybD3e+u/RGKWAVjvY/ze8VxvDYPaTjjjnF/ZwD5c21fpPQhA1HKwc813Iihx0MnU8ROC6B5JlH+uHRssj0MJ6n1zfBw8Lzskb3Lj5bTyn7FpyvCpxwMHV4KU8I4fP3MAE9oP3 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Wed, Aug 14, 2024 at 07:10:31PM -0300, Jason Gunthorpe wrote: [...] > > Nope. KVM ARM does (see get_vma_page_shift()) but I strongly suspect that's only > > a win in very select use cases, and is overall a non-trivial loss. > > Ah that ARM behavior was probably what was being mentioned then! So > take my original remark as applying to this :) > > > > I don't quite understand your safety argument, if the VMA has 1G of > > > contiguous physical memory described with 4K it is definitely safe for > > > KVM to reassemble that same memory and represent it as 1G. > > > > That would require taking mmap_lock to get the VMA, which would be a net negative, > > especially for workloads that are latency sensitive. > > You can aggregate if the read and aggregating logic are protected by > mmu notifiers, I think. A invalidation would still have enough > information to clear the aggregate shadow entry. If you get a sequence > number collision then you'd throw away the aggregation. > > But yes, I also think it would be slow to have aggregation logic in > KVM. Doing in the main mmu is much better. +1. For KVM/arm64 I'm quite hesitant to change the behavior to PTE mappings in this situation (i.e. dump get_vma_page_shift()), as I'm quite certain that'll have a performance regression on someone's workload. But once we can derive huge PFNMAP from the primary MMU then we should just normalize on that. -- Thanks, Oliver