From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from a7-19.smtp-out.eu-west-1.amazonses.com (a7-19.smtp-out.eu-west-1.amazonses.com [54.240.7.19]) by mx.groups.io with SMTP id smtpd.web11.4085.1670599368018016267 for ; Fri, 09 Dec 2022 07:22:48 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@ipxe.org header.s=cphpx6z2rfcgehlykjjh3gknqe3hsoe2 header.b=jU3OezH0; spf=pass (domain: eu-west-1.amazonses.com, ip: 54.240.7.19, mailfrom: 01020184f77b5558-6781c306-bc9e-4040-88fb-55409427d5af-000000@eu-west-1.amazonses.com) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=cphpx6z2rfcgehlykjjh3gknqe3hsoe2; d=ipxe.org; t=1670599366; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=HGD9iGHu5UHxBayT/g48TpKz903Qtax0snqvR4b6UP8=; b=jU3OezH0dRNIYEus8g923ACO00AFlqk4SyVccNkOC5TWeWH3uH9hVJgS3OuMGF5j RrBx6zp1BcbLt7F7p4xSkYz7cE2phEaZPplQ8psMEkt9xp2JUS4CsYOAvDROBaFLTLn ClrbLkXuRkBYRRaGuq6WDm0tXxB/KBqnf8ziljYFXsNRUNeUAFPH9hHhKix0rpVoIdP AoXoIwf1lYP3tuoDo9E1XDQxc0Fa0RCnWgl4QGFt5oT+qYKMS4ynGWGGZVk1eET7li2 nYY9qycTkB5dOS8RVM384XA2ZsMYYQkHAKENvVOgpiSSvzb3yBVeMAYdBsEp7nMbvNx cKIw1Aa8Qw== DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=ihchhvubuqgjsxyuhssfvqohv7z3u4hn; d=amazonses.com; t=1670599366; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:In-Reply-To:Content-Type:Content-Transfer-Encoding:Feedback-ID; bh=HGD9iGHu5UHxBayT/g48TpKz903Qtax0snqvR4b6UP8=; b=uqBRk3pi5an3+J873XFxnmiRTlnkSRA5I9XzUwyWFlL3Y0hu+jcruVq+JRiA7BnM sqVN2UgCZVKN4eG1yrsJMA1FPXnKaY/CAmQ4BohSdoBflLlva7lRpravV5onM1/CLVV Kio2s61w4Xmebucj3Q9+W98+/uNfvbB7ehrS3aAk= Message-ID: <01020184f77b5558-6781c306-bc9e-4040-88fb-55409427d5af-000000@eu-west-1.amazonses.com> Date: Fri, 9 Dec 2022 15:22:46 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: [edk2-devel] [PATCH 2/3] OvmfPkg: Add library to handle TPL from within nested interrupt handlers To: devel@edk2.groups.io, kraxel@redhat.com Cc: Laszlo Ersek , Paolo Bonzini , Ard Biesheuvel References: <01020184f66682f9-7696e0c5-f2f6-43e0-962f-38f1d5af4859-000000@eu-west-1.amazonses.com> <20221209150227.wns5mhtcfismxtgd@sirius.home.kraxel.org> From: "Michael Brown" In-Reply-To: <20221209150227.wns5mhtcfismxtgd@sirius.home.kraxel.org> X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on blyat.fensystems.co.uk Feedback-ID: 1.eu-west-1.fspj4M/5bzJ9NLRzJP0PaxRwxrpZqiDQJ1IF94CF2TA=:AmazonSES X-SES-Outgoing: 2022.12.09-54.240.7.19 Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 09/12/2022 15:02, Gerd Hoffmann wrote: >> Add the Nested Interrupt TPL Library (NestedInterruptTplLib) to >> provide helper functions that can be used by nested interrupt handlers >> in place of RaiseTPL()/RestoreTPL(). > > So, in a nutshell this makes inner interrupt handler only run callbacks > with a priority higher than the priority of the outer interrupt handler. > Anything with equal or lower priority is deferred to the outer handler. Essentially, yes, though for accuracy I would replace "run callbacks with" with "restore TPL to": The inner interrupt handler will only restore TPL to a priority higher than the priority of the outer interrupt handler. Anything with equal or lower priority is deferred to the outer handler. The distinction matters because in the deferral case the inner interrupt will not run any callbacks at all: the running of callbacks is then deferred in its entirety to the outer interrupt handler (with a hard guarantee that the deferred running of callbacks will take place immediately). > That way we never nest at the same priority, which in turn limits > nesting to the number of different priorities in use. > > Correct? Yes, limiting nesting to the number of different priorities in use is exactly what this patch does. > The idea looks sane to me and I couldn't spot any logic errors in this. Great! :) Thanks, Michael