From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=tXMNUGav; spf=pass (domain: linaro.org, ip: 209.85.166.196, mailfrom: ard.biesheuvel@linaro.org) Received: from mail-it1-f196.google.com (mail-it1-f196.google.com [209.85.166.196]) by groups.io with SMTP; Fri, 19 Apr 2019 10:54:11 -0700 Received: by mail-it1-f196.google.com with SMTP id f22so9327522ita.3 for ; Fri, 19 Apr 2019 10:54:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=FaPUOuTKcLLYejGsLy5VyZChqZ3UK/jprrwoNGkqJow=; b=tXMNUGavGd42csCP4WiSCtXdVryCZHWDms9/iaC9QcXbggciGk6YcVGb7lVj6UNYMV 6ry+gaxqEfUd0XXJN6ubeElgqeiAu4+ME0tKsaZAr1hN9GBJYUjgbxRBtJJeqY7MBOBJ zmmY03t3MRenYsMC8pfFTQyqxF2qYkjB5jgID0jbj2vAalSU25EYmRTqahLoIAiptBVj DLR16EZlOqTTzkQ1lTQoYnPVQ7ZgEuWNLRbuvGFfII2hg8fMGKAO9uRYUonoDBEcnfJh UlWGWu1qOiRObSGMQpzeFZ+yHSHf21UP82jiO/MQb6HjZ9kzXv5dnB7QyHAZVrSPQZUv Azsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=FaPUOuTKcLLYejGsLy5VyZChqZ3UK/jprrwoNGkqJow=; b=NzG2pByRWH6UYmTGBteg/Y8uFh9rcME9uy8Zy1ehnQDZ21L59VWHrVK2vk3WoDWiUz /TdhfpKMPbLLl3GRcQiDjj5top62XQA7BWnGpbsD0gZsp9FMf46Jh1fRUeq1mw8p7qPi u7dQXO25h2XH1ZYJoPM5/+q5bWKicYV29lrXhEj2bclKhIruhtaIMlF3C6kSCJiM+RY4 nPzfxnfRdLX4I2hWkSQVxQpBYS/fXB0f8QaQCMpzJMWAoCYGRr2llvK8UI0ZYU7++shd +CKr0iEab1n9YMhyyaH50R9+CXY14C/TX1NzNsm9sLpV5mFTTDW5bF/ZXgz5kJOROK7j cALw== X-Gm-Message-State: APjAAAXKNjFe4331vGPRPzfxiYuTt8u/dUalQDBBp13XfpsA+jekxtUr HBh5cUSHdowtVtKDN6tMI4cyuyuB1G4I9dedG2jG0JIqvr6MS9FU X-Google-Smtp-Source: APXvYqzpOGKSiSYW/E95r4Q50gUgbL+/JcRS9kzhZ/CnGRJPxJftIgw42HijfrZQBV5rn8lpD+JkIYnlpm8q9Mb//Dc= X-Received: by 2002:a24:59c1:: with SMTP id p184mr4160807itb.158.1555696450181; Fri, 19 Apr 2019 10:54:10 -0700 (PDT) MIME-Version: 1.0 References: <20190419141319.11084-1-ard.biesheuvel@linaro.org> In-Reply-To: From: "Ard Biesheuvel" Date: Fri, 19 Apr 2019 19:53:58 +0200 Message-ID: Subject: Re: [edk2-devel] [PATCH resend] MdeModulePkg/EsrtDxe: allocate ESRT table from RtServicesData memory To: edk2-devel-groups-io , "Kinney, Michael D" Cc: "ming.huang@linaro.org" , "Wu, Hao A" , "Wang, Jian J" Content-Type: text/plain; charset="UTF-8" On Fri, 19 Apr 2019 at 19:42, Ard Biesheuvel wrote: > > On Fri, 19 Apr 2019 at 19:36, Michael D Kinney > wrote: > > > > Hi Ard, > > > > The UEFI Specification Section 23.3 says: > > > > "The ESRT shall be stored in memory of type EfiBootServicesData." > > > > If an RT driver needs ESRT info after ExitBootServices(), then the > > RT driver should collect that information before ExitBootServices(). > > > > But that means that before EBS(), we will have to make a copy of the > ESRT into runtime services data, and we will end up using twice as > much memory - one copy in boot services data for the OS, and one copy > in runtime services data for the firmware itself. I understand the > reasoning behind preferring boot over runtime, so that the OS is not > burdened with it if it does not care. But it this case, the RT > services data will be allocated regardless, and so we end up using > less memory if we expose that same copy to the OS. > Actually, DxeCapsuleLibVirtualAddressChangeEvent() in DxeCapsuleLibFmp updates the ESRT pointer to virtual, so this code is clearly based on the assumption that the ESRT resides in memory that is covered by a runtime VA mapping. Could we instead clarify the UEFI spec to something like "The ESRT shall be stored in memory of type EfiBootServicesData unless the runtime services implementations themselves need to access it at OS runtime, in which case it may be stored in EfiRuntimeServicesData."