Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp805968pxb; Tue, 12 Apr 2022 13:59:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy5DYBhRBRI9SQuLMez2cT6tIaA7sRH/G3uqPG2DxnG07DHgokOMJmhGVNsobQWYASrXgP/ X-Received: by 2002:a17:902:760a:b0:14f:4a29:1f64 with SMTP id k10-20020a170902760a00b0014f4a291f64mr22314511pll.90.1649797169270; Tue, 12 Apr 2022 13:59:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1649797169; cv=pass; d=google.com; s=arc-20160816; b=xLwc517f2WZaU5V4ogl8uzhx20Cch72IMjzYU8f39Ed/sgyCS3d17lLiVWTEfJVxKP OfoOWOnb63ypw7sfuTYZxFL82tHyZ0s1mRdr7gWZ7k6/d153l8PRxqGU9x8oytNpElRF DUzRrsZoM03DXu/8glE2rOKI4P5rYFLR4JvHB4svuEefmCXCgDonVBUgx7I6iVt2a3sm 4Hg1p48FJAAWnVjiVR/9ZwsAZQkBZFwC463uQhhtDKLTrE0LlFFtPVmvkT4jONzKDFud htgi7jRhzhGsNjTaI67MEqvogQ2SbeV/hGUujNV6keqvsu8rkPeudolTwEyvlzDRXjms B4/w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=oz3Ab3ZvOzc82UVaAfCiGzhOGxr5z7MSw3fYf5ItRmU=; b=pNTO8sQ1fdgVMG0qxbjIJke4UNW3kfVX1WaSRPjwH+a+Ciqsu+sNLKeFuKHvdI6n2t wTR3oWXygwOW2fwAH8/yPTQ9s/1bFJNM5cMy3sXxybNF9DHXoZHQv6xNqXL1iMjm9srR OTgeKVO2O9hJaB31e3OU7ilGN6eWMHRjbDz5QggTUSuILsEy6P2Weg2IrnmQIm0DKt93 yBHGrwtap8SsSadpDESzTcMQjba+L01q6L0ljm3M9q4LJhf9FVUY/R2ObYuvNBoJrePF vQrLCqeH7RKrVkOUcc6+FGrKtdlp9RLNMklQL9VT7VAZvCsH7E0aOK//bcNvtHLNXhna 9Bzg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=lXr17CNW; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id z17-20020a630a51000000b0039d21972dd1si3603771pgk.119.2022.04.12.13.59.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 13:59:29 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=lXr17CNW; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EAEA2CFBB9; Tue, 12 Apr 2022 13:22:09 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349292AbiDKS5y (ORCPT + 99 others); Mon, 11 Apr 2022 14:57:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349330AbiDKS5o (ORCPT ); Mon, 11 Apr 2022 14:57:44 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2081.outbound.protection.outlook.com [40.107.243.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CB8619C0D; Mon, 11 Apr 2022 11:55:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WDSvZGPgYZNM9yv0u5QCBUma4G33eW5fO92Sd4v6Gfe6lYAFrP/4vTnc7+XAw/bzLtiLZ1jzXew+x8kNz2H5v98hbeYYwHx16C2A22dPF4eyqzxxevU+ZLFg69YdtUxNWzoSCEwrH2UCFbs/JLANMvDj5F5d2sR+M3Z4FD6it7G/4gy51zDvvbLrF8C6h9v9ZfwCfa12aKmzfprG7XrSDgdzizXibL5Rs0EDfW7Y1nCVuCIB+8SPEXkw899T+kcWFk7TQD8LTYpYtmllGQVCartpHads3xtzLwLhIFaUBiGeX6je4O//oUkRGG1v+wFQZGNlRZqcNAfdPLkUjI6G2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=oz3Ab3ZvOzc82UVaAfCiGzhOGxr5z7MSw3fYf5ItRmU=; b=XDizi/IrSvI6lxCioQ1MCcYYuDaYxgBNkzP3obK7U+Fnp0VUK5GWVQzS99lnffk3/hR4vM4jSNLgND+ZbobrnoGLC3BDDY+IUHXlOmqPq5iItgUsO5n64VZXjHySCGbTIf8fhrCfatGhNBEhxNl/cU82G6coYHasRWYRsYot4nseLP26jrWcWnjVvukAVDYTmHWdPybnn/8KntPxfcGhcgr1iXs/2c08lDqE/qCv/LLxTkRl6Q+ekC6+LWmdZabc9/2OV4Um70zQnfgqOxavkcmvnHqo36rqy+JxwTGacKV0seA+2c9NPCN+9yjjmfF6u5ajT5JV/nk43sqa5gqyKQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oz3Ab3ZvOzc82UVaAfCiGzhOGxr5z7MSw3fYf5ItRmU=; b=lXr17CNWLRPasEDfahSzlwxMp/4BKOtDyFn2yqf8JPUTAbwPds4WwNYQB8qBAjR4FWHMFkFIhjcKSEhoz0S2xyuuqJobH6o+s3WmIyLQPPfkSkBqC4Jl87kdLbRz8B0W/xJhTkMZYtN/e86NV2GH+mh2To2fGWmytVq7ItV25yE= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from DM4PR12MB5229.namprd12.prod.outlook.com (2603:10b6:5:398::12) by MN2PR12MB4271.namprd12.prod.outlook.com (2603:10b6:208:1d7::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5144.29; Mon, 11 Apr 2022 18:55:25 +0000 Received: from DM4PR12MB5229.namprd12.prod.outlook.com ([fe80::1092:2d0b:9aa4:30]) by DM4PR12MB5229.namprd12.prod.outlook.com ([fe80::1092:2d0b:9aa4:30%5]) with mapi id 15.20.5144.029; Mon, 11 Apr 2022 18:55:25 +0000 Message-ID: Date: Mon, 11 Apr 2022 13:55:20 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCHv4 1/8] mm: Add support for unaccepted memory Content-Language: en-US To: Dave Hansen , Borislav Petkov Cc: "Kirill A. Shutemov" , "Kirill A. Shutemov" , Andy Lutomirski , Sean Christopherson , Andrew Morton , Joerg Roedel , Ard Biesheuvel , Andi Kleen , Kuppuswamy Sathyanarayanan , David Rientjes , Vlastimil Babka , Thomas Gleixner , Peter Zijlstra , Paolo Bonzini , Ingo Molnar , Varad Gautam , Dario Faggioli , Brijesh Singh , Mike Rapoport , David Hildenbrand , x86@kernel.org, linux-mm@kvack.org, linux-coco@lists.linux.dev, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, Mike Rapoport References: <20220405234343.74045-1-kirill.shutemov@linux.intel.com> <20220405234343.74045-2-kirill.shutemov@linux.intel.com> <93a7cfdf-02e6-6880-c563-76b01c9f41f5@intel.com> <20220409175210.xik3ue3shpagskvi@box.shutemov.name> From: Tom Lendacky In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: MN2PR19CA0032.namprd19.prod.outlook.com (2603:10b6:208:178::45) To DM4PR12MB5229.namprd12.prod.outlook.com (2603:10b6:5:398::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2e60ab51-3eb8-4557-1811-08da1becd605 X-MS-TrafficTypeDiagnostic: MN2PR12MB4271:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8JzhQk6FIwJV08TejMPuL6xEibSWYUOFEvYncujv3SYEgGLXU9ZvLW1MpJPWnE+Hm/Ub2GP7F47NWFGMLwDgyDIgB2v/jRcXyiYGboOubfdkN93D8pU0PkQkczSyjK6eqWzSo6dkRQ84q8iZH9l6lDpQSJdeR8k/NS7BKXrF2iK8ZRrgFqHv1BRE3C4Ei+BeQagWytxP+qu18ih2FlUsFd2/jH/T0MOFcotHxImGNznbHkgQ/0wNZ0pwvcdG4mo0Z+Z9MQuCdR1iMJwDZq1S2YPXW094eXUHDFDuXCSIbOcFccr0SF58TI5UicnCq7cdW8czaqwjtDoKWTBU+UrndEd1YWyx8KW+ONav21xrdgc8vOr2gQfXBD6IOJxIAXLfMK9lzbEFky7a1C0gnx0l5DeMeR+h+sabOJjzmvNaBLmiAgbYQgV7WgPhFgXXdNhxwl+0URnbEr/sjcvz2gawNawdWmK+TduL1/gdyFSiVaiO8U8eaC8uqt0cQFvu7Q3CloSfk0SQJBVRpTQruCCdJip1l29htcui4S0UkpUuUf15qv5T9nkHbK8ia+nOeP2ekrYOnlKnkSDDRa0hTrBs2KNFDZh4jKjqSzd1oOhYhCrMveWcPlrcfs+W+o0aBwO1WjMRdejGoV2xMNhIxr9wWEUR1wL4KTtSVsktaoyY/Iwg7y2Q9jtcMcv4Y6iOxD1S+X4XO90v/T0EiEQgv5PjYQE3rqVH5y4BZ6fX50z10bLCk1KGqzpRqiZbwrp9RfyN X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR12MB5229.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(8936002)(66556008)(66476007)(66946007)(8676002)(38100700002)(7416002)(186003)(86362001)(31696002)(5660300002)(2906002)(83380400001)(6666004)(6506007)(6512007)(53546011)(26005)(4326008)(2616005)(6486002)(316002)(110136005)(54906003)(36756003)(508600001)(31686004)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?RjJZaDhMUXdpeTNieUlYTUt4VkJtM1pXcG4rb1ovZnJ1UkIvNGY2eHNLVm5s?= =?utf-8?B?RVdZbzkreE1kbktqT1RuVmUzSWxnR3dleU5GMElpRUlhNTJRdHZqSjZFa2hK?= =?utf-8?B?YzJWVUJOSkJyam9ob2l5UXR6QU5razBDeTdwMWh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khhMDNscXBveGZRVDc3QmtKc2VyTWlzNUZoN24waG5waHlLWkREbCtm?= =?utf-8?B?NDVpcHpnVXZQeDBRb1djdFFNYTFuc2ZkVlloL2hZRXdNZjZDc09SME1ZMWVL?= =?utf-8?B?ZWswcGFoSko2czdoUTZXb0krS0xoSk1IemxhNi91Z2RFUGVrcTBJUWhFZm9O?= =?utf-8?B?OGVqVDdSUnJSOW5yN0VLcDF2SEp1cGxBb1o0VGlQd2RBUTAvNCs2MHo5L1ds?= =?utf-8?B?Y0tjc2lYREsyKzVPNXJpTmQ0ZXRVR2phOU9DSW9ma2xZRlhCb2xLWENVSFNk?= =?utf-8?B?dFhudEY5NHhIZ1JTSUREbUpKWUpLUmQ3bkxlQTR6SGlwWGFrV1VZaFg3dzMr?= =?utf-8?B?T1RxN09BKzI2SnFkR2xvbmN2RElBZVM0TzZGY2owMUYydFRPdWU2UT09?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2e60ab51-3eb8-4557-1811-08da1becd605 X-MS-Exchange-CrossTenant-AuthSource: DM4PR12MB5229.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Apr 2022 18:55:25.1216 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: mtTUfUagcansPbCRXDxWyIdVCVhSOHCYLWEAHAKwkwQcrtlIXvFyciqCzc+SPpUlgOlhbFOYbNKoodkcdrmIMQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4271 X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/11/22 11:27, Dave Hansen wrote: > On 4/11/22 08:55, Borislav Petkov wrote: >> On Sun, Apr 10, 2022 at 11:41:57PM -0700, Dave Hansen wrote: >>> Let's just call out the possible (probable?) need for new ABI here. >>> Maybe it will cue folks who care to speak up. >> Err, why would you teach the user to go poke at some arbitrary sysfs >> nodes when the accepting code can simply issue a printk from time to >> time >> >> "Guest unnaccepted memory progress: XX%. This slows down operations at the moment." > > I guess that's not a horrible place to start. It's also not *horribly* > different from how guests work today. If hosts lazily allocate RAM, > they'll see largely the same kind of behavior. > > What ends up determining how much memory is pre-accepted versus being > done from the guest? Is that just a normal part of setting up a TDX > guest, like from the qemu cmdline? Or, is there some convention with > the virtual firmware? With SNP, some memory will be accepted as part of the LAUNCH_UPDATE sequences that the hypervisor performs, but that is not all of the guest memory. Once the guest is started, the (initial implementation of) OVMF SNP support will accept (PVALIDATE) all of the remaining guest memory. When the kernel boots, there isn't any unaccepted memory. Once support is available in the kernel for unaccepted memory, then OVMF could be updated to only accept a limited amount of memory and pass the information about the unaccepted memory to the kernel through the EFI memory map. The approaches would have to be measured to see which ends up being the best one. The GHCB specification allows for lots of memory to be accepted in a single VMGEXIT (world switch) vs performing a VMGEXIT for each 2MB of memory being accepted. Thanks, Tom