From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web10.34920.1661505109022960094 for ; Fri, 26 Aug 2022 02:11:49 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=P3MzKFyh; spf=pass (domain: redhat.com, ip: 170.10.133.124, mailfrom: kraxel@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661505108; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=x9OexkNEw/kluFAtOJHtC1CoP8tPPTLjmyPy3L7R4mo=; b=P3MzKFyhByEfJdBhoTCLbhnvS76vsC8cUYJnlIc6ljpvCstXlxcaBhNYJ0zdbY4isN9nXz peCZqwRk1WRIg3Edvhq0f7KTQ34k9k6t4lQfbgkqfcn6C3dS/d2gH/jKJEF5TPwJTnxj72 /ruByNbeBTJQo0ltBapdXl94KmxKqd4= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-414-69nlc1B2M0WXY0N0UJEqHw-1; Fri, 26 Aug 2022 05:11:46 -0400 X-MC-Unique: 69nlc1B2M0WXY0N0UJEqHw-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 664103C0F389; Fri, 26 Aug 2022 09:11:46 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.195.82]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 13458492CA2; Fri, 26 Aug 2022 09:11:46 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 5709E1800627; Fri, 26 Aug 2022 11:11:44 +0200 (CEST) Date: Fri, 26 Aug 2022 11:11:44 +0200 From: "Gerd Hoffmann" To: "Xu, Min M" Cc: "devel@edk2.groups.io" , "Aktas, Erdem" , James Bottomley , "Yao, Jiewen" , Tom Lendacky Subject: Re: [edk2-devel] [PATCH V3 2/2] OvmfPkg: Update CcProbeLib to DxeCcProbeLib Message-ID: <20220826091144.2jtqnt6q6cnhrkuc@sirius.home.kraxel.org> References: <20220826052325.aiwch3qrbrnvj4mq@sirius.home.kraxel.org> MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Aug 26, 2022 at 08:21:49AM +0000, Xu, Min M wrote: > On August 26, 2022 1:23 PM, Gerd Hoffmann wrote: > > Hi, > > > > > In DxeCcProbeLib we cache the GuestType in Ovmf work area in first-call. > > > After that the Guest type is returned with the cached value. So that > > > we don't need to worry about the access to Ovmf work area after > > > ExitBootService. > > > > This only works in case the first call is early enough. > > Better use a CONSTRUCTOR instead. > > > Thanks for reminder. > There is another situation that the first call of DxeCcProbeLib is earlier than its CONSTRUCTOR. > For example, in MdeModulePkg/Core/Dxe/DxeMain, BaseDebugLibSerialPortConstructor is called before DxeCcProbeLibConstructor. While CcProbe () is called in BaseDebugLibSerialPortConstructor. > So I would like to read the Cc guest type in both CONSTRUCTOR and CcProbe. Makes sense (and please add a comment explaining this corner case). take care, Gerd