From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) by mx.groups.io with SMTP id smtpd.web10.2508.1666840696845283864 for ; Wed, 26 Oct 2022 20:18:18 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@ozlabs-ru.20210112.gappssmtp.com header.s=20210112 header.b=gwwCZE81; spf=pass (domain: ozlabs.ru, ip: 209.85.210.177, mailfrom: aik@ozlabs.ru) Received: by mail-pf1-f177.google.com with SMTP id v28so7122pfi.12 for ; Wed, 26 Oct 2022 20:18:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ozlabs-ru.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=a0pi7RZj7/SQkDjTlVKagjqAbWmxR03eHlJdQ0Lj+ms=; b=gwwCZE81W+qgVHlD6Dhp26zYRow/0aREI+5cvFVbaMQb6eumB/gmClAzK1gQI3TAtn 5GWDUvGze958GHMzZXrCxyVrqOTbmIdx3akc87ZQ2VR5cv+Bc7fvAD+u2H4Cukf1vyTn Ty0Ot06kyPZXezOUaVAvBsS8p28k4x07hyAYhiPbXEQMm4sQZnSRZianT916wyT3eAgk drWU4rzV403dpAypojqwWtcqNsmn0yYQFem0RQgzUr46eY08SEJJflq+Rxtlmxr1SqN6 o8j5yo9V/TOD74MbbUdtaZZU59acEnPBNje+qfqWEPjSBlpQ+yj55tE7cVeua5fgETO/ fCag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=a0pi7RZj7/SQkDjTlVKagjqAbWmxR03eHlJdQ0Lj+ms=; b=dcVI7VaW6HcbAkqK5HN/KsHZIGAAkNOeZGdgaN9V11Cf7f+eIbkm1JLtK9S2ibQl2z eD8A7EIm1O0D7LRCQV1dxEHNTILwdWdg/7sUafpt+hEJ9V0pV95t8eqx0X/RPNNNgNY5 eE19n0rcBmcC7i1T9JTeBnWMI1uKKG1pZW8jg96MgRsX8Jwsdl2ZjDOYE8ki9ENMrD03 79uOUE0+BdQRoZMxlYzjeR07oncEqc1RAEjsKdJNseooCmSSxeDAHw8CjGahNKaENtHR oDsCNEzHV5FNVfVQOa6s2zKIJsAUZeqsZMX0xc/ssoemXU9jfgPkFfMtpDEj4GRXyihj tF3A== X-Gm-Message-State: ACrzQf0WUcAKU2ke8cZbEO+882T84Wuo7ZdM2pCaNekrqVrnFrmu2MgC AEzMvuuknUX5UJWTJMLICm+0JQ== X-Google-Smtp-Source: AMsMyM7HpV43bKlswkeFX7IRJ3bAKzyI0HH9pvukv6N5ZeFT4FtTO2bCFTHQOzpcmHC9tZfff3oCkw== X-Received: by 2002:a05:6a00:1993:b0:56c:7b8:ea37 with SMTP id d19-20020a056a00199300b0056c07b8ea37mr14552621pfl.20.1666840695722; Wed, 26 Oct 2022 20:18:15 -0700 (PDT) Return-Path: Received: from [192.168.10.153] (ppp121-45-204-168.cbr-trn-nor-bras38.tpg.internode.on.net. [121.45.204.168]) by smtp.gmail.com with ESMTPSA id u10-20020a170902bf4a00b001754064ac31sm29370pls.280.2022.10.26.20.18.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 26 Oct 2022 20:18:15 -0700 (PDT) Message-ID: Date: Thu, 27 Oct 2022 14:18:07 +1100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:107.0) Gecko/20100101 Thunderbird/107.0 Subject: Re: [edk2-devel] [PATCH v7 0/7] Add safe unaccepted memory behavior From: "Alexey Kardashevskiy" To: Dionna Amalie Glaze Cc: devel@edk2.groups.io References: <20221005203329.469866-1-dionnaglaze@google.com> <15176.1666600440031530451@groups.io> <7cf0c864-0942-4a14-5a68-a9e0448a8fa0@ozlabs.ru> <9666e5ed-2a55-e931-dd00-132f5e19e578@ozlabs.ru> In-Reply-To: <9666e5ed-2a55-e931-dd00-132f5e19e578@ozlabs.ru> Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 26/10/2022 13:49, Alexey Kardashevskiy wrote: > > > On 26/10/2022 12:35, Alexey Kardashevskiy wrote: >> >> >> On 26/10/2022 12:07, Dionna Amalie Glaze wrote: >>> On Tue, Oct 25, 2022 at 5:23 PM Alexey Kardashevskiy >>> wrote: >>>> >>>> Hi Dionna, >>>> >>>> Thanks for updating the tree, builds nicely now! However the VM's >>>> kernel >>>> does not boot - the guest kernel reports >>>> >>>> EFI stub: ERROR: exit_boot() failed! >>>> >>>> and hangs. I am not quite sure how it is supposed to work (still >>>> learning) but "Accepting all memory" happens twice (should it?) and the >>>> actual reason for the CoreExitBootService() failure is that MapKey != >>>> mMemoryMapKey in CoreTerminateMemoryMap(), these are 0x7AD7 vs 0x7AD9 >>>> orĀ  0x7AE1 vs 0x7AE3 (the diff is always 2). btw it still fails in CoreTerminateMemoryMap() with the current upstream kernel which is not aware of the lazy memory acceptance, is this something known? Thanks, >>>> >>> >>> "Accepting all memory" may happen twice, but it's idempotent. The >>> debug_info log happening twice might be confusing, so I can change >>> that if you'd like. >> >> Nah, it is fine as long as the thing boots. >> >> >>> The first accept will remove all unaccepted memory regions from the >>> address space map. >>> CoreExitBootService should fail the first time since the first accept >>> will change the memory map. >>> That failure means that the caller should GetMemoryMap again and try >>> CoreExitBootService again. >> >> Ah, ok. >> >>>> How do you test it exactly, is there any command line change needed in >>>> addition to enabling SNP? >>>> >>>> My guest kernel uses >>>> https://patchew.org/linux/cover.1664298261.git.thomas.lendacky@amd.com/ >>>> with the TDX prerequisite. Thanks, >>>> >>> >>> It's a few name changes behind, but this branch of Linux is what I've >>> been using: >>> >>> https://github.com/deeglaze/amdese-linux/tree/v12unacceptedv7v5-enableum >> >> This does not build though due to unresolved rebase conflict, the fix >> is kinda trivial but I do not get those "Accepting all memory" anymore >> so I wonder what else is missing. > > AH right, stupid me, getting rid of accepting all memory is the purpose > of these patches. Never mind :) Thanks, > >> >>> >>> Specific enablement patch here >>> https://github.com/AMDESE/linux/commit/5a708081d58d773e767b11735ee1fd17ef5e5f61 >>> >>> I incorporate Kirill's patch set v7 for basic unaccepted memory >>> support, Tom Lendacky's v5 patch set for SEV-SNP support of unaccepted >>> memory, and I have a single patch that calls the protocol. >>> This branch doesn't have Kirill's TDX patches. >>> I've run it with a regular SEV-SNP enabled guest kernel too. At this >>> point all the tests have used kernel injection rather than having the >>> kernels all baked into the image. >> >> I am trying with "-m 2G" and "-m 8G" and see no difference - >> "Accepting all memory" is not appearing with this kernel. What do I >> miss? Thanks, >> >> > -- Alexey