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 1ADB7D80860 for ; Thu, 29 Feb 2024 20:11:36 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=cy1A4y13033gKvzYYWAvkMaXzveVdwQ/LZ7FBwM5US0=; c=relaxed/simple; d=groups.io; h=Message-ID:Date:MIME-Version:User-Agent:Subject:To:Cc:References:From:Autocrypt: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=1709237495; v=1; b=RAL50PDi0HA0w3BVg0zZIfE+FAMIS33xJDuNN3lXxLy9gv9RoKQrgNx0Ln0iyXzB2FMcN6Nn dJ0O3IcOj+inO8RG9rOI/BIA59+ynAE+QIRvaUCKlxd/hLVzwXXp54gdihN5uvsZOE6dt3Mt9oY c74oJJnzO8jkCYGSakgIpXEA= X-Received: by 127.0.0.2 with SMTP id 5e9lYY7687511xXNRdq5ae70; Thu, 29 Feb 2024 12:11:35 -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.5313.1709237495160018785 for ; Thu, 29 Feb 2024 12:11:35 -0800 X-Received: from mail-lf1-f70.google.com (mail-lf1-f70.google.com [209.85.167.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-47-VvM09qOmOJql9sF68vLKGg-1; Thu, 29 Feb 2024 15:11:32 -0500 X-MC-Unique: VvM09qOmOJql9sF68vLKGg-1 X-Received: by mail-lf1-f70.google.com with SMTP id 2adb3069b0e04-513136edf3bso1027151e87.0 for ; Thu, 29 Feb 2024 12:11:32 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCXj/h+UEyiIJGFD7Q3vLdJpyFdfK8oP3jUANRVdX911vr3ezme3JVICcEE1OBuaYutNo83WOvVIOZinwR6kUjPX4AtlbQ== X-Gm-Message-State: eRYa3M8JnKr0uZHXd5zWDzxvx7686176AA= X-Received: by 2002:ac2:4d10:0:b0:513:2347:4b57 with SMTP id r16-20020ac24d10000000b0051323474b57mr2257318lfi.66.1709237491118; Thu, 29 Feb 2024 12:11:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IErQOVBJ0JNy03TCufn9vLmDImyasACFt4xJ+VX5ARe+miB13pfcC6PGW5MUZCbOOuQzk/e6w== X-Received: by 2002:ac2:4d10:0:b0:513:2347:4b57 with SMTP id r16-20020ac24d10000000b0051323474b57mr2257304lfi.66.1709237490692; Thu, 29 Feb 2024 12:11:30 -0800 (PST) X-Received: from ?IPV6:2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e? ([2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e]) by smtp.googlemail.com with ESMTPSA id fe1-20020a056402390100b00566a1b8614esm841193edb.58.2024.02.29.12.11.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 29 Feb 2024 12:11:30 -0800 (PST) Message-ID: <59e7875f-4d81-41cf-969d-29e4212816cb@redhat.com> Date: Thu, 29 Feb 2024 21:11:29 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [edk2-devel] [PATCH 2/2] MdeModulePkg/DxeCore: Fix stack overflow issue due to nested interrupts To: Michael Brown , devel@edk2.groups.io, Ray Ni Cc: Michael D Kinney , Liming Gao , Laszlo Ersek References: <20240229130246.3-1-ray.ni@intel.com> <20240229130246.3-3-ray.ni@intel.com> <6ce2acb8-08a2-417c-9f4b-5f96befb412c@redhat.com> <0102018df6511d8e-aab48741-c939-4d11-b7f7-263f1b370444-000000@eu-west-1.amazonses.com> From: "Paolo Bonzini" Autocrypt: addr=pbonzini@redhat.com; keydata= xsEhBFRCcBIBDqDGsz4K0zZun3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IQtBAm0ihWPltXkyITA92ngCmPdHa6M1hMh4RDX+Jf1fiWubzp1voAg0 JBrdmNZSQDz0iKmSrx8xkoXYfA3bgtFN8WJH2xgFL28XnqY4M6dLhJwV3z08tPSRqYFm4NMP dRsn0/7oymhneL8RthIvjDDQ5ktUjMe8LtHr70OZE/TT88qvEdhiIVUogHdo4qBrk41+gGQh b906Dudw5YhTJFU3nC6bbF2nrLlB4C/XSiH76ZvqzV0Z/cAMBo5NF/w= In-Reply-To: <0102018df6511d8e-aab48741-c939-4d11-b7f7-263f1b370444-000000@eu-west-1.amazonses.com> 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,pbonzini@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed 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=RAL50PDi; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=redhat.com (policy=none) On 2/29/24 20:22, Michael Brown wrote: >> The design of NestedInterruptTplLib is that each nested interrupt must increase the TPL, but if I understand correctly there is a hole here: >> >> // >> // Call RestoreTPL() to allow event notifications to be >> // dispatched. This will implicitly re-enable interrupts. >> // >> gBS->RestoreTPL (InterruptedTPL); >> >> // >> // Re-disable interrupts after the call to RestoreTPL() to ensure >> // that we have exclusive access to the shared state. >> // >> DisableInterrupts (); >> >> because gBS->RestoreTPL will unconditionally enable interrupts if InterruptedTPL < TPL_HIGH_LEVEL. > > There's no hole there. Yes, what I meant is that the whole of NestedInterruptTplLib is designed around plugging that hole. But if you can avoid re-enabling interrupts at the end of CoreRestoreTpl(), you don't need DisableInterruptsOnIret() anymore. > See the comments in the code for further details - I made them fairly > extensive.  🙂 Yup, I remember. :) >> If possible, the easiest solution would be to merge >> NestedInterruptTplLib into Core DXE. > > The question with that approach would be how to cleanly violate the > abstraction layer that separates the timer interrupt handler (existing > in a separate DXE driver executable) from the implementation of > CoreRestoreTplInternal() (existing in core DXE and not exposed via the > boot services table). See outline in the other mail I have sent. Paolo -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#116190): https://edk2.groups.io/g/devel/message/116190 Mute This Topic: https://groups.io/mt/104642317/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-