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 054A1C433EF for ; Mon, 14 Mar 2022 08:04:10 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A46F083938; Mon, 14 Mar 2022 09:04:07 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="BIkdHquh"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 254A7839A7; Mon, 14 Mar 2022 09:04:05 +0100 (CET) Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) (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 1374D820DE for ; Mon, 14 Mar 2022 09:04:00 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=takahiro.akashi@linaro.org Received: by mail-pg1-x529.google.com with SMTP id 6so13090341pgg.0 for ; Mon, 14 Mar 2022 01:03:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=q5iJAyJPNoj9SClSUlvO1e1fbIg/iPl7Di7/rjPOiJg=; b=BIkdHquhaxjYCsTFH/ulRZ1zqxGv60p9/NPsvdcq+zcRXtaLnr7plzNR/6zy78c22u W9uSIkMTNkQ1GF4tzaZ3OTUdPAeGlQIomG/JHdWO6l8uz0qGAJg4Pb0ZVhf6jH76j0l+ r+8dABIzalyw3u5yczc+RwrtGbQfWUZz8Z6rP9I6mLLmd2VafRD+7D06aL/xpoBlr+bN TSSk2JmFqsFDj+AxvT77Pa9F0RpCBSaeqL4YM1OxR/LIjG2y3EDpgPCFSXC8k3hg55rI +PL5iYpNUoWgd3SDW+kppd0768HziM4h4PLpW2EQrQYiTA8kwC/c83ckefMoei45x9YL iyFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :content-transfer-encoding:in-reply-to; bh=q5iJAyJPNoj9SClSUlvO1e1fbIg/iPl7Di7/rjPOiJg=; b=UmeM8FaB6NrBp5Dyrh6+3nfnGyo0+kBENjt+JRLGCa8aCE1njdjSPOTsd1s1s5n5UX gjkpOZ/OubAtDbtcO0fNK1vE85+TgjN1kigehyz1enoyWocFzTAQle99+VgpvUISdvsR kbnQP0pA4hKNFUqvFmcOrg3vQhu4vVklHZGIOgl76Nc3XjgcIcS0zKd7P/1RHYsSV9AT IL8Bq0JHe+iRh83REriGX0xCvHV2tGPrsPySIhWxFeYWvEGmptH6/bfQpgKbBxmPF62X QGvQO7e9RCfwRErWFCjk9OZ3rbKf7tP1uNXYi+6ZNj2PdwKl/1SM0H0oQjaMn8hwaQ5+ 0RrA== X-Gm-Message-State: AOAM533u0ZEQeBUJyiCx8yvqxVprgZhYmmrSLSXCKubbUpWJeKX13cie IIfVch56Ml/E7nZXFrIivmMC5w== X-Google-Smtp-Source: ABdhPJzUnh11qN1cAB5W5rkB9NIawmPRiwIiPY0/7a4v1WlwsPLdqHUvqE0txJipeb3pYV1YkjLQdg== X-Received: by 2002:a63:d253:0:b0:380:3aee:8437 with SMTP id t19-20020a63d253000000b003803aee8437mr19219689pgi.382.1647245038315; Mon, 14 Mar 2022 01:03:58 -0700 (PDT) Received: from laputa (p914133-ipoe.ipoe.ocn.ne.jp. [153.243.15.132]) by smtp.gmail.com with ESMTPSA id b9-20020a056a000cc900b004f7ac2189e2sm7392678pfv.191.2022.03.14.01.03.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Mar 2022 01:03:57 -0700 (PDT) Date: Mon, 14 Mar 2022 17:03:52 +0900 From: AKASHI Takahiro To: Masami Hiramatsu Cc: Simon Glass , Heinrich Schuchardt , 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 Subject: Re: [PATCH] test/py: efi_capsule: Handle expected reset after capsule on disk Message-ID: <20220314080352.GE37492@laputa> Mail-Followup-To: AKASHI Takahiro , Masami Hiramatsu , Simon Glass , Heinrich Schuchardt , 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 References: <20220219011550.GB6672@laputa> <20220314010813.GA37492@laputa> <20220314024258.GC37492@laputa> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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 On Mon, Mar 14, 2022 at 04:35:45PM +0900, Masami Hiramatsu wrote: > Hi Simon, > > 2022年3月14日(月) 15:45 Simon Glass : > > > > 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 wrote: > > > > > > > > On 2/18/22 03:16, Masami Hiramatsu wrote: > > > > > > > > > Hi Simon, > > > > > > > > > > > > > > > > > > Thank you for your reply. > > > > > > > > > > > > > > > > > > 2022年2月18日(金) 2:56 Simon Glass : > > > > > > > > > > > > > > > > > > > > > > > > > > > > > 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 update 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 restart itself), > > > > > > > > > > > > > > > > > > > > Here you should be able to avoid doing a reset. See > > > > > > > > > > dm_test_sysreset_base() which tests sysreset drivers on sandbox. > > > > > > > > > > > > > > > > > > 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 capsule updates > > > > > > > > lead to resets. > > > > > > > > > > > > > > > > > > > > > > > > > > In dm_test_sysreset_base(), I can see the below code, this means > > > > > > > > > sysreset_request() > > > > > > > > > will not execute real reset, but just mimic the reset, right? > > > > > > > > > > > > > > > > > > state->sysreset_allowed[SYSRESET_WARM] = true; > > > > > > > > > ut_asserteq(-EINPROGRESS, sysreset_request(dev, SYSRESET_WARM)); > > > > > > > > > state->sysreset_allowed[SYSRESET_WARM] = false; > > > > > > > > > > > > > > > > > > > > but Qemu and real board will cause a real reset and it will terminate > > > > > > > > > > > the qemu or stop the board (depends on how it is implemented). 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 logic which > > > > > > > > > > could be tbot of the U-Boot pytest hooks. I suggest you avoid this and > > > > > > > > > > handle it some other way, without reset. > > > > > > > > > > > > > > > > The sandbox should run through exactly the same code path as all 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 needed. > > > > > > > > > > > > > > +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 UEFI > > > 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. > > Actually, we already have that command, "efidebug capsule disk-update" > which kicks the capsule update code even without the 'reset by a > user'. So we can just kick this command for checking whether the > U-Boot UEFI code correctly find the capsule file from ESP which > specified by UEFI vars. I oppose it simply > However, the 'capsule update on-disk' feature is also expected (and > defined in the spec?) to run when the UEFI subsystem is initialized. > This behavior will not be tested if we skip the 'reset by a user'. I > guess Takahiro's current test case tries to check it. because of this. System test should not use an internal function, it should only exercise public interfaces from user's viewpoint. -Takahiro Akashi > > > 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. > > So If I I call sysreset_walk_halt(SYSRESET_COLD) after capsule update, > it could help? > > Thank you, > > > > > 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 > > > > -- > Masami Hiramatsu