From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 462A9941116 for ; Tue, 16 Jan 2024 06:07:13 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=bm643sYW9JWDq+zkwpZYiA1nsvtOskZwMPhSbC5QDpI=; c=relaxed/simple; d=groups.io; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:In-Reply-To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1705385232; v=1; b=hnjpzVeeG12neyDzPFi9+cLIBUpApvz/JMlXjXIiqcKibolJw7nted/Jd/QIGs0uMGWpimoI 6JyOUR7C1y1uJJZUxA6svBvyiKShjaJqpBcOIUZQcXqQQH55kEeB3YqSR53VwiLfyWTdJDdsanF ZqJ0STJkfrv3XG/T0lzbLjAY= X-Received: by 127.0.0.2 with SMTP id 4Wb1YY7687511xhsrI56VEtW; Mon, 15 Jan 2024 22:07:12 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web10.91990.1705345231803658731 for ; Mon, 15 Jan 2024 11:00:31 -0800 X-Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-689-gsj0qyE7N-iRWx7chseppA-1; Mon, 15 Jan 2024 14:00:27 -0500 X-MC-Unique: gsj0qyE7N-iRWx7chseppA-1 X-Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4F639185A7A9; Mon, 15 Jan 2024 19:00:27 +0000 (UTC) X-Received: from [10.39.193.170] (unknown [10.39.193.170]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7599A2026D6F; Mon, 15 Jan 2024 19:00:26 +0000 (UTC) Message-ID: <20d8728f-daaa-51ed-18ad-3087695d21f1@redhat.com> Date: Mon, 15 Jan 2024 20:00:25 +0100 MIME-Version: 1.0 Subject: Re: [edk2-devel] Memory Attribute for depex section To: Ard Biesheuvel , Nhi Pham Cc: "Andrew (EFI) Fish" , edk2-devel-groups-io , "ardb+tianocore@kernel.org" References: <44ca139f-4d78-4322-b5b6-8e9788bb7486@os.amperecomputing.com> <2ad16043-754e-3bb9-3a4a-702d9a50bf63@redhat.com> <45b95719-f1fc-dbc6-a4cc-a022d691844c@redhat.com> <8d745268-263c-c99a-67c6-fe0fb6cd4b8e@redhat.com> <0e0b2e56-30dd-4f5f-9708-98690246efda@os.amperecomputing.com> From: "Laszlo Ersek" In-Reply-To: X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,lersek@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: MK7AavWenHlqL6sNXJa8q7lex7686176AA= Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=hnjpzVee; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=redhat.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io On 1/15/24 15:04, Ard Biesheuvel wrote: > On Mon, 15 Jan 2024 at 14:07, Nhi Pham wrote: >> >> On 1/12/2024 4:45 PM, Laszlo Ersek wrote: >>> (Independently: I think that's a valid thing to do for *SMM* drivers, >>> because the entry point functions of those drivers are permitted to use >>> both SMM and DXE/UEFI protocols. But whether the same is valid for the >>> *standalone* MM drivers -- that looks questionable. Standalone MM >>> drivers should not depend on UEFI/DXE protocols ever, IIUC.) >>> >>>> 3) The issue is patching the grammar in place, why can’t we just make a >>>> copy for the dispatcher grammer, and operate on the copy. Maybe via a >>>> copy on 1st update strategy? >>> >>> Yes, copying the depex to the heap, and patching it there, was Nhi's #1 >>> fix proposal. I think that could be made work. But I'm not sure if the >>> perf savings are worth the additional complexity. The heap allocation >>> (where the writeable depex would exist) would have to be permanently >>> associated with the loaded PE image -- because the dispatcher might need >>> to reevaluate the depex across multiple rounds of dispatching. So that's >>> a new field in some image-related structure, it also needs to be freed >>> upon unload (?), what if the memory allocation fails during depex eval >>> (just consider the depex to eval to FALSE?), etc. Doable, but hairy; not >>> sure if the perf is worth that effort. >>> >> >> Thanks so much, Laszlo for your valuable insights. >> >> The approach #1 works for me. I will do further check for your concerns >> above. >> >> I'm trying your suggested patch and investigating the performance being >> discussed here. >> > > Not sure what approach #1 means, (copying the depex to the heap, and maintaining it there, so that it can be patched) > but I'd prefer to just remove this > optimization from standalone MM, given that not only a) it shouldn't > have to deal with a large number of protocol GUIDs, but also b) the > driver dispatch is much more straight-forward. (Typically, StMM > drivers can be dispatched in the order they appear in the firmware > volume, in which case each DEPEX is evaluated only once anyway) Sounds like a promising basis for removing the optimization indeed! Laszlo -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#113844): https://edk2.groups.io/g/devel/message/113844 Mute This Topic: https://groups.io/mt/103594587/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/1913456212/xyzzy [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-