From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B9762C433F5 for ; Mon, 14 Mar 2022 06:45:37 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 409C0820EA; Mon, 14 Mar 2022 07:45:35 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="fzQFcPco"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8EA3A837E2; Mon, 14 Mar 2022 07:45:33 +0100 (CET) Received: from mail-vk1-xa2f.google.com (mail-vk1-xa2f.google.com [IPv6:2607:f8b0:4864:20::a2f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B8841820DE for ; Mon, 14 Mar 2022 07:45:29 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@google.com Received: by mail-vk1-xa2f.google.com with SMTP id i43so7759568vkd.12 for ; Sun, 13 Mar 2022 23:45:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :content-transfer-encoding; bh=69+HguPaG4MU7qfYH8OQ87HN2pdn9kHDtubaYOOJZa4=; b=fzQFcPcoiRM4j2gIAF0ILi1KnqJxvyPbM+Bk1+rLz5YKtesG588gr/oPm0j7HcgUY2 xKR7c5TymS1khpZaRJCkMT9yYkSdV2wcvEaZYwgdIyWeWMcw1itkVy32/n5BW9lBhScv FfyvUqSRcHOYhHVVpOnfLPbIf/ZCypde3Q4b4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:content-transfer-encoding; bh=69+HguPaG4MU7qfYH8OQ87HN2pdn9kHDtubaYOOJZa4=; b=Lkb7S9cUQeaMUNcEv2PyvsCn8whWNCPydQovCHvuCHXpqbWrAhm1PXGZzc/GSBtIzA goSlP+sSsmxk59Bm/35xPLEPWxtOeeNDLDAvor2L12cCJuZtBqanNTFv5KGnEsmbpj0T E1uqwBtqjyrKVbE+ZJ7FJ1AvJyxS2vyfRoIXWTk+HeQ2zJe2nfRjNrYjHbsFWZMQyol1 CTxbJM13sEwHHLx/Fa6rZzc0HfhfbDRf0hZDGnq++SFXMODzZrLFcwqVs18CVD1lHVDZ SRy6x9WKGKj4kD8eBCJBqhfQxdAu7W//quJkiXmAXLYvX8al6OSrku0fh81Nf9NTFZZE 6r7Q== X-Gm-Message-State: AOAM532/eNdHX5zZDT1KKc0PiaVQr8UdOQ+6wQqPnbmYn/A7eMNHFVqh wCoWU3y64h25cZ55Hn5WTgIKkLdhfXA1vHMuVPvf+Q== X-Google-Smtp-Source: ABdhPJzw4biQhL4rA9agH2gOIgmNAjnNlM/mbxVFBZpTtNiGJ27HFDBtIbIK7JDURVFfTwJb2rsajqfM4SZITGhM/IU= X-Received: by 2002:a05:6122:200a:b0:337:540d:265c with SMTP id l10-20020a056122200a00b00337540d265cmr8590868vkd.21.1647240328184; Sun, 13 Mar 2022 23:45:28 -0700 (PDT) MIME-Version: 1.0 References: <4ba143f8-6114-db0e-08e2-d97ac9dc6e13@gmx.de> <20220219011550.GB6672@laputa> <20220314010813.GA37492@laputa> <20220314024258.GC37492@laputa> In-Reply-To: <20220314024258.GC37492@laputa> From: Simon Glass Date: Mon, 14 Mar 2022 00:45:17 -0600 Message-ID: Subject: Re: [PATCH] test/py: efi_capsule: Handle expected reset after capsule on disk To: AKASHI Takahiro , Simon Glass , Heinrich Schuchardt , Masami Hiramatsu , Tom Rini , U-Boot Mailing List , Patrick Delaunay , Patrice Chotard , Alexander Graf , Bin Meng , Ilias Apalodimas , Jose Marinho , Grant Likely , Etienne Carriere , Sughosh Ganu , Paul Liu Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean Hi Takahiro, On Sun, 13 Mar 2022 at 20:43, AKASHI Takahiro wrote: > > On Sun, Mar 13, 2022 at 08:15:02PM -0600, Simon Glass wrote: > > Hi Takahiro, > > > > On Sun, 13 Mar 2022 at 19:08, AKASHI Takahiro > > wrote: > > > > > > Hi Simon, > > > > > > On Fri, Mar 11, 2022 at 07:24:39PM -0700, Simon Glass wrote: > > > > Hi Takahiro, > > > > > > > > On Fri, 18 Feb 2022 at 18:16, AKASHI Takahiro > > > > wrote: > > > > > > > > > > On Fri, Feb 18, 2022 at 02:48:54PM +0100, Heinrich Schuchardt wro= te: > > > > > > On 2/18/22 03:16, Masami Hiramatsu wrote: > > > > > > > Hi Simon, > > > > > > > > > > > > > > Thank you for your reply. > > > > > > > > > > > > > > 2022=E5=B9=B42=E6=9C=8818=E6=97=A5(=E9=87=91) 2:56 Simon Glas= s : > > > > > > > > > > > > > > > > > > > > > > > Hi Masami, > > > > > > > > > > > > > > > > On Wed, 16 Feb 2022 at 18:11, Masami Hiramatsu > > > > > > > > wrote: > > > > > > > > > > > > > > > > > > Hi Simon, > > > > > > > > > > > > > > > > > > Let me confirm your point. > > > > > > > > > So are you concerning the 'real' reset for the capsule up= date test > > > > > > > > > case itself or this patch? > > > > > > > > > > > > > > > > > > I'm actually learning how the test is working, so please = help me to > > > > > > > > > understand how I can solve it. > > > > > > > > > > > > > > > > > > There are 3 environments to run the test, sandbox, Qemu, = and a real board. > > > > > > > > > If we reset a sandbox, it will continue to run (just rest= art itself), > > > > > > > > > > > > > > > > Here you should be able to avoid doing a reset. See > > > > > > > > dm_test_sysreset_base() which tests sysreset drivers on san= dbox. > > > > > > > > > > > > > > Would you mean that reset-after-capsule-on-disk itself should= not > > > > > > > make a reset on sandbox? > > > > > > > > > > > > We have several tests that do resets by calling do_reset(), e.g= . the > > > > > > UEFI unit tests. There is nothing wrong about it. > > > > > > > > > > > > We want the sandbox to behave like any other board where capsul= e updates > > > > > > lead to resets. > > > > > > > > > > > > > > > > > > > > In dm_test_sysreset_base(), I can see the below code, this me= ans > > > > > > > sysreset_request() > > > > > > > will not execute real reset, but just mimic the reset, right? > > > > > > > > > > > > > > state->sysreset_allowed[SYSRESET_WARM] =3D true; > > > > > > > ut_asserteq(-EINPROGRESS, sysreset_request(dev, SYSRESET_WARM= )); > > > > > > > state->sysreset_allowed[SYSRESET_WARM] =3D false; > > > > > > > > > > > > > > > > but Qemu and real board will cause a real reset and it wi= ll terminate > > > > > > > > > the qemu or stop the board (depends on how it is implemen= ted). Thus, > > > > > > > > > if a command or boot process will cause a reset, it will = need a > > > > > > > > > special care (maybe respawn?). > > > > > > > > > > > > > > > > Here you need to worry about the surrounding automation log= ic which > > > > > > > > could be tbot of the U-Boot pytest hooks. I suggest you avo= id this and > > > > > > > > handle it some other way, without reset. > > > > > > > > > > > > The sandbox should run through exactly the same code path as al= l other > > > > > > boards to get a meaningful test results. Therefore don't put in= any > > > > > > quirks on C level. Your Python test changes are all that is nee= ded. > > > > > > > > > > +1, I have the same opinion here. > > > > > To exercise capsule-on-disk code, we need a "real" reset > > > > > because pytest/CI loop is basically a black-box test. > > > > > > > > I don't see why you need the reset at all to test the code. > > > > > > As I repeatedly said, I believe that this is a black-box test and > > > a system test. The purpose of the test is to make sure the firmware > > > update be performed in real operations as expected, that is, > > > a *reset* triggers the action *at the beginning of* system reboot. > > > > I understand you are frustrated with this, but I just don't agree, or > > perhaps don't understand. > > > > What specific mechanism is used to initiate the firmware update? Is > > this happening in U-Boot or somewhere else? > > There are two ways: > a. CapsuleUpdate runtime service > b. capsule delivery on disk > > My original patch provides only (b), partly, because runtime > service is a bit hard to implement under the current framework. > > UEFI specification requires that (b) can/should be initiated > by a *reset by a user* and another reset be automatically triggered by UE= FI > when the update has been completed either successfully or in vain. > The latter behavior has been enforced on U-BOOT UEFI implementation > by Masami's patch (not this series). OK, well 'reset by a user' presumably starts the board up and then runs some code to do the update in U-Boot? Is that right? If so, we just need to trigger that update from the test. We don't need to test the actual reset, at least not with sandbox. As I said, we need to write the code so that it is easy to test. > > Masami's patch (this series) fixes issues around those two resets > in pytest. Yes and that is the problem I have, at least on sandbox. Regards, Simon > > > > > > > > You should > > > > be able to run a command to make the update happen. How does the > > > > updata actually get triggered when you reset? > > > > > > It's not the purpose of this test. > > > > Then drop the reset and design the feature with testing in mind. > > So it's just beyond of my scope. > > -Takahiro Akashi > > > Regards, > > SImon