Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp2051507rbb; Tue, 27 Feb 2024 09:08:05 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWkEwX9HIVhT1hp9vjwzDgKhb1Jo4FSLoKrhM60GE1iilTKmL+LQJqye2a3Wj7qwRAkRNLdMEhNr0H7fN+DvIMD/MNzYVyrIxvOAf+Aaw== X-Google-Smtp-Source: AGHT+IFGiJsbSD45vZ+VwW+vG/SNdyP8shlSPdoGWa4mn4BSrJ5n0rLMOBBMUSIzHsRfyruXzx+I X-Received: by 2002:a17:906:ae92:b0:a41:3492:5fed with SMTP id md18-20020a170906ae9200b00a4134925fedmr7058764ejb.61.1709053685039; Tue, 27 Feb 2024 09:08:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709053685; cv=pass; d=google.com; s=arc-20160816; b=HfHzRIsdwPiWz1NadI254H3q21Ra3ao88xmUVOSw+vqJsxT5icDxJ+TIb4Y65tJyPg gzz/WJe08tRprFcY0MG3JrfE/OQuJOwoUvChZ9WF3KXcXYNxhB6pPcjJ6/O9fT1QCImr Mjw01M5nq404OQVhrNVgUjq7OHh6z77mKzgYZMiBHMklg9UKacl15RaIyPEUOcfr8lNU MIbM9aSpbTLSkyfJS2BCr9tzBsQ61iql/0prM2QV9izOtHko8ASqSYA4SKa62dwctJt9 +e7LbLmMTbW3g3wF/QCf/oyTMRC2kfYWBiObWrINaFSBsfeQZt155iMZOdbK+8U3z658 +LFg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=99jfUjuSInpmxbhq4i5jzlqwDHbrA15fgcjI2V7Oals=; fh=HzAOLtJxzMekMRYySZhWFxulMbgCR2HPzI0VIA4/KEQ=; b=TlI7LAjOzoH6RLhP+ks9DI8K5mAcQNy68cawcWjX8Tiqz4PMavquyNP/dcKfdMAlXw Rgkb4HhY2UsB8ZWkyi7xVIsKg+mJJEz/DEfQpH5eZ0GMw+Ygh4XxuWTsgUVoNB4OsAG6 xom7yv//mjUqPhiuW6VUVRtwIMWbsOUell/YlvCvD1AUZpS87c2j3nI3RXvfxKYvlWbA fPHJJjuI7OCbD2YYoO/tLYhMHxIh/9PB32tcnk06tmLZN80iT2IuDfCVc+STbhuHAa8g ZrPcKk9nMS7JhA5srmhreSsPYsDIU/YFjoVsDV+6b7UrTI7g02wyhX2LPfz6wD+aKlii EZZQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=jbKvmj1z; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-83675-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83675-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a12-20020a170906190c00b00a43052c0644si864726eje.373.2024.02.27.09.08.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 09:08:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-83675-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=jbKvmj1z; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-83675-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83675-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id C71AF1F27C04 for ; Tue, 27 Feb 2024 17:08:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ADE1D487A5; Tue, 27 Feb 2024 17:07:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jbKvmj1z" Received: from mail-pg1-f180.google.com (mail-pg1-f180.google.com [209.85.215.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 841FD2032D; Tue, 27 Feb 2024 17:07:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709053673; cv=none; b=BPgxJ12Pwc2ozZcFOh41YKfklaP91zZbE4tU4xywCp3pvjZz1lFCJ93xAv1VyVyFy59ZEUOLtZYhtRfktQ7+jq//SqXBzFEGBLh70a+NsTAZVknPlA4nFJuSMADErKKZhCUWKLx6dA6dwJOeiqdO72nybuRBFP6VRn15liCE964= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709053673; c=relaxed/simple; bh=ZeJc8F1uJuWbjXK4VVGQdxZ+8idBvr+K++iQcOg5o38=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=Q4pBYH+z0fvlA6l3nznE/12nU/2Kjju8EfF7bdR751jv0V71VMf0/dK4oCGv3Jm/5pePSTZOjzaTMjh6G+htd4C+bdOqmvyCjr3F8wGdrAOrJYLYVJcjihAVbIfGfmotDYvg2xwTdyFRspUOCTOyAGQdPFoiSaVsg9aSsFHzv8g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=jbKvmj1z; arc=none smtp.client-ip=209.85.215.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pg1-f180.google.com with SMTP id 41be03b00d2f7-5dbd519bde6so3707427a12.1; 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=vger.kernel.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=jbKvmj1zc9qWpdruJudh/hR+hxG3T9Bn4wnJi5RoUW4LWDrg+zZe3VIfvoCHx72TM6 lzwe/jJqkppP7fOBoXuIFKNYyHWfzLxEusLGFSodTPM8UDFh4A3IZXw1IFwijZ+Xub3S yp+WpwUccC0e7XAOgGAtEqf/gRd3Eb2LhAtYnQF79z3hTEIpLF1uauoY4yqxYIggrlTI 87JgK01u9N+n9emYQQdyQLZAu5Tzx/5laG7nOREaS4hFFAN1P3wsuNt61kjf2VuTMOh2 baQc9y9zaPryCxdmKR8kNpo0Ar3gOhyV2bVl/5kRIjSWkJ0WB4q5Id8dk6+8LV5XgNxB Dl2w== 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=P/UE8tUrqz8ltYFQFRdVTUKvSzcUD0/QvSXh82hqwp4uJA+qpyRH0JkFz/uTYmxNWb XPXbZSUoGLYdpSFxQv7XdrHMNQw40qjG/Di4uGSRYgMVqskWJa6Mm8GJoHShn+qTJVtq dZu24JbAOCQKQuaRHkHMkUYeKhLv1Gnr3WhWDDW7e6u/kHw+CdruoBF1t4v5YR9S/XjF bdq/+IzelOXOpihwqSD0Y4BNj8lDZn0VW9GlPg8Uty/KmNxY32w4a9T3CTjzvabz7B3O /SvRVv1UaLgPmtwPVH+BPkeRt70o1mVvtPdnxvW0fGze3W8iFdNQiZ6Q62PfV54yGFKx rlmw== X-Forwarded-Encrypted: i=1; AJvYcCVxYddWJDt3H2/qSLI2DDqF22A+rAWDMEyXmZ3pqFXjg/P+h7WgXFrfBpR4K/RS4hkg+jskgs3Jg3rNHOEKmF2Q04A9 X-Gm-Message-State: AOJu0YyzIRFlEH62VCPlrjqEgAM7zRnpjCl3bipcAOest1p0etXE2La1 AO6uvY8yIIw5WZOjOKId3raRLY3JYgFlOfl+TZww1CTlu4Cwe9TfJW/z34EoCtJp3lcZuyhEpbq EFJVz/Q9q+7IWjQolH6Bo7aGjlUs= 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) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 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. >