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 32F41C5478C for ; Tue, 27 Feb 2024 17:07:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A9D036B0093; Tue, 27 Feb 2024 12:07:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A4DBC6B00B6; Tue, 27 Feb 2024 12:07:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8EDC66B00C2; Tue, 27 Feb 2024 12:07:56 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 7AAC36B0093 for ; Tue, 27 Feb 2024 12:07:56 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 491281A09A0 for ; Tue, 27 Feb 2024 17:07:56 +0000 (UTC) X-FDA: 81838216152.20.4091F8A Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) by imf21.hostedemail.com (Postfix) with ESMTP id 2B07E1C0029 for ; Tue, 27 Feb 2024 17:07:52 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=UVUPSu3y; spf=pass (imf21.hostedemail.com: domain of jiangshanlai@gmail.com designates 209.85.216.48 as permitted sender) smtp.mailfrom=jiangshanlai@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1709053673; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=99jfUjuSInpmxbhq4i5jzlqwDHbrA15fgcjI2V7Oals=; b=hHTGhd0dGSpioppElzfoW7okZnK9uycOKPvsY+KaVnbWM6uC2kcGDiuIMCf7Gf+YpFctom eS5jgiTS382gUFfkxGyVj3M6ZmeWROth62Ifkd6VXcFCh5Bh5e8dcQWkscTXMfs4d16R6Y UW+Nev7aDPikr+cQ2kWoC+EY1j4vOQo= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709053673; a=rsa-sha256; cv=none; b=nv6oikI/FFh487p7Y74iVMe+F9How3qGKUl4acjuv2xDhmgeW73G5KAPF0IjPb/BdMd2Zt KDWeJiR1t0+SngjO4L3Qk3rdUJUDzOKDaG3Ce7yrzz587JbZo7vLdGRZotynJuM836Viz+ nlWuAEwO5U6WXnMTiteYtTceK89W6hM= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=UVUPSu3y; spf=pass (imf21.hostedemail.com: domain of jiangshanlai@gmail.com designates 209.85.216.48 as permitted sender) smtp.mailfrom=jiangshanlai@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-pj1-f48.google.com with SMTP id 98e67ed59e1d1-299ea1f1989so2535873a91.0 for ; Tue, 27 Feb 2024 09:07:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709053672; x=1709658472; darn=kvack.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=99jfUjuSInpmxbhq4i5jzlqwDHbrA15fgcjI2V7Oals=; b=UVUPSu3yo3ljtUvyvAqX4w2zbFds21IcbkfEXVQ0NVyTaSCGY+M9dTIpkqsiNRd7ZJ xRh+Fd9r8NBvkTKEllWoKDpRsaL02KnPLPctpz2p7QRZ0TqbWXeuWE1IZFNA9Jwfdzxf wgfawrD/hOY/LMPe4vKWp5yObcKJrIcZrV9V3oPthBCOtL7wD1s3BMo8tDxF436la2f0 czgYD2+UehB8Dny3luozWv7VVqAg+pmzz65fkXvu1wKEJlR1MXbVMyfAcOs5bM6atPuR kmaVzdBaei/aV4AT0mJmiUS/frfoI3Y37UtHXZu0brwzQMbLXN4go+5wM2lrl9kMn8l1 A0wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709053672; x=1709658472; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=99jfUjuSInpmxbhq4i5jzlqwDHbrA15fgcjI2V7Oals=; b=UYyL/oldBc12lzW2lZs3Ds5q0jlwF9XVjkUFGWxP0eMuDoPR0tXVhfHaUnGf5Y/S/p yLdUyR0Uq2bmDeXXnvTHUk5TNf8mcEv8FPFvFXGINIUB9TelcGn9cqOVSF8xVBE2PBJ5 z8ltr8Tecvzjf9rZlta/f1S1xfjjZ4W5T7vlj0PJZUs7ISwZoYyTlKjnYQSWUKhXnqGR d8S102/YGGkXmgk56wwgwFDKB0HQztgIwuK8MGBiwIpBR/vcWySNxwdyIaJslR+zES9N UroFBm7YryLjj6Sgj5tSMFWPc1vah0ICmosVS6Z2viQD1iMguK0MedjEJQYzvnhdXZ+8 Md1A== X-Forwarded-Encrypted: i=1; AJvYcCXAxuovxlhdnAPcWE3DDbNHHpjvLyOjQQ7r68FgzTshJR0pVCMGJOPMV4FqL8pmBl8lHxIuZl2Z6MxFoLuNQW4whP8= X-Gm-Message-State: AOJu0YzbDOjM1r7H4cKhL9p5wY2b9oCbB+UhwkfctOEqLdDGWBDwd09H +ptZwwSoYX+qwk3hHryCmxXm7Al8HGTk6tMSLBcbPKV0uz3QL8BkCUedLjZKl2jY6yfYKCPPwy1 JWlTDsJXSXcrBUx+eF7lED1CZ4Dg= X-Google-Smtp-Source: AGHT+IHTBLSoZTfa3M5/2UvGsTYIpeCfQhJ06lMLp5v4/09xfG85K0T6kpDQRVpfBDGQ03DtwlARkFL1clgMtD/yIFY= X-Received: by 2002:a17:90b:8d8:b0:299:3e54:83fe with SMTP id ds24-20020a17090b08d800b002993e5483femr8471960pjb.36.1709053671772; Tue, 27 Feb 2024 09:07:51 -0800 (PST) MIME-Version: 1.0 References: <20240226143630.33643-1-jiangshanlai@gmail.com> <20240226143630.33643-16-jiangshanlai@gmail.com> In-Reply-To: From: Lai Jiangshan Date: Wed, 28 Feb 2024 01:07:40 +0800 Message-ID: Subject: Re: [RFC PATCH 15/73] mm/vmalloc: Add a helper to reserve a contiguous and aligned kernel virtual area To: Christoph Hellwig Cc: linux-kernel@vger.kernel.org, Hou Wenlong , Lai Jiangshan , Linus Torvalds , Peter Zijlstra , Sean Christopherson , Thomas Gleixner , Borislav Petkov , Ingo Molnar , kvm@vger.kernel.org, Paolo Bonzini , x86@kernel.org, Kees Cook , Juergen Gross , Andrew Morton , Uladzislau Rezki , Lorenzo Stoakes , linux-mm@kvack.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Stat-Signature: 3dbaot7wjz57xnmk67yat8oawgrcq41m X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 2B07E1C0029 X-Rspam-User: X-HE-Tag: 1709053672-373227 X-HE-Meta: U2FsdGVkX1/VcE9qid0culftxVW+mxHHx7ifpOotJFGmR7R9T8Fv6F39m8+aJ06BguhvcF0slt7zXFbGyWj/bBoa0lYpO7En6SLC6ZVkEbAS80AEJAUo4tP0D0onoWpLLp9K7EapCLkTjtDuwRg+KdhgBpm5nYVaWA8iwcbLzZujANaJhmB4UrSjSZ1ApWYlGjLW5RlnHYLoag7+T+cuxnXUTAcFZjvZdUO3PoI6pFq4SD3ywLVnq5a1gdlqa/QnJ3oYwugDWiQwRNC+kOPStCscBHy+3fm/Sf0Vst9hm36lPPjmAihOlFwm/yTcS9gL/WK7+jV4HaPqu69yu8C4Dk8cfBOwMaay/KOtdbGCBVtWRW1Z4peHyse3bKPFkZkgrK9VAtFDNHMQzqvKJPAFc/PVDs05gOVDp1RLe+ydjzU/sO3bk24zsk6NViRGehRVqGv1IIPvWdORG6NgMgtxj3zwXd1fMUtfz8Vurd+FiNguXlQT7SULKD51JOIYFCQGgHP9M7tAvLh8bkEsRukZ2TDs6CYoTo7zX5Y6wsRZJpFx4qCQBTbBnM4ziGPSFb9r+4R3+tXk8xDVFisemOJbY7PDjjmUAYy9Anub410kqCMd/CvdeUpOTU9CXYHo5SAcW3QNiQuXRJBPPokJs4Bm+vSIdY7Cl85fLaM0Qe4kKAS3H7wIxlZ9QHhqrUskxSWEsDXxYzjVxh7OxUVWdiAOYmIDFQo1gVKXP4yEjggvnXhnLq1ooI/Qo9TwkKgiDwqHIzDS1GeMPXM+A1JwkB6P8FlWXQItM1/3PuG0ZcmdKuKfQEBSmw63FY0oCtfC2LhvxMyKSOAv8bzDNw4xAFA6+8FocADjVmo1R+CZwFltfS0LbjOe7LS9kQspTDkCuKS8xayiA2fDU24YWGEJeArQC7uEVSv0/F1ijOGIAOopTCPap3NU2fjqHtBbw2HrLyw0uz1zMpD//C/VPEveUS1 NVpj5qCu 1fG8N++5vyXxaQg7SPwVWs34znbh0tpy9oeII 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: Hello On Tue, Feb 27, 2024 at 10:56=E2=80=AFPM Christoph Hellwig wrote: > > On Mon, Feb 26, 2024 at 10:35:32PM +0800, Lai Jiangshan wrote: > > From: Hou Wenlong > > > > PVM needs to reserve a contiguous and aligned kernel virtual area for > > Who is "PVM", and why does it need aligned virtual memory space? PVM stands for Pagetable-based Virtual Machine. It is a new pure software-implemented virtualization solution. The details are in the cover letter: https://lore.kernel.org/lkml/20240226143630.33643-1-jiangshanlai@gmail.com/ I'm sorry for not CC'ing you on the cover letter (I haven't made/found a pr= oper script to generate all cc-recipients for the cover letter.) nor elaborating the reason in the changelog. One of the core designs in PVM is the "Exclusive address space separation", with which in the higher half of the address spaces (where the most signifi= cant bits in the addresses are 1s), the address ranges that a PVM guest is allowed are exclusive from the host kernel. So PVM hypervisor has to use get_vm_area_align() to reserve a huge range (normally 16T) with the alignment 512G (PGDIR_SIZE) for all the guests to accommodate the whole guest kernel space. The reserved range cannot be used by the host. The rationale of this core design is also in the cover letter. Thanks Lai > > > +extern struct vm_struct *get_vm_area_align(unsigned long size, unsigne= d long align, > > No need for the extern here. >