From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mx.groups.io with SMTP id smtpd.web11.7275.1684574455202647781 for ; Sat, 20 May 2023 02:20:55 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XMe0SBrN; spf=pass (domain: kernel.org, ip: 139.178.84.217, mailfrom: ardb@kernel.org) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BA4AF60F95 for ; Sat, 20 May 2023 09:20:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F2E0C433D2 for ; Sat, 20 May 2023 09:20:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684574454; bh=HF9T2M7l4tT/5lfl1/Uyc1LVll4cRuXh2N/nQpMsEgI=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=XMe0SBrNsGSHipwN/A0AfDZiwsHyhSY+nEcpxJA3KtiScp7XqaDy2YXZVmY4jEByu NbRkzWRUkqqRzWUqNSfBdt4MGgbxJCuO4zOZ5h72RwVcRxa42b8ZJiYUPzUHdkaEOb IL29dJuMxstTRMC4Nljk2GZXMhMjolnr/cXc7ERsKiyt53cb/ywTcn6Q3YSX6eB3Hh 4Awt88XP3beAdFPD6tJ+n+rGjq2lfctXnN6TnsgKcL1YHrxUF5KTQeIL6HeDbzMEPF 9+dWDgJ7g5RkB1aU13nupKdHZxY6E4KXYy9lgCmcdXvsksDuE/YEHRDoxAWs/TZIQX recNNFjOlqS2w== Received: by mail-lf1-f48.google.com with SMTP id 2adb3069b0e04-4f3a7241c0aso2980876e87.1 for ; Sat, 20 May 2023 02:20:54 -0700 (PDT) X-Gm-Message-State: AC+VfDw6XTRg5Dz0NNKNoTi2222jfJXfcltL5vBSs/VNchMzqcJnuXbC 6z3Hae6Gbpgw/divnk1rBg0gxL84ZQZbnQFVg2E= X-Google-Smtp-Source: ACHHUZ5w6pyEeP2a0aj6XvRSYY/RkFPp/6c/tlOrxD1TQVyvmw2h8DmovpfkZ9e7kLzu0gUJAtJy/UdKLgyO8MTVvlM= X-Received: by 2002:ac2:57d5:0:b0:4e9:a3b7:2360 with SMTP id k21-20020ac257d5000000b004e9a3b72360mr1896766lfo.8.1684574452169; Sat, 20 May 2023 02:20:52 -0700 (PDT) MIME-Version: 1.0 References: <173FFD60429C89C3.3213@groups.io> <17489D498A098DB9.9697@groups.io> In-Reply-To: From: "Ard Biesheuvel" Date: Sat, 20 May 2023 11:20:40 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [edk2-devel] [PATCH v2 2/2] ArmVirtPkg/ArmVirtQemu: Avoid early ID map on ThunderX To: Oliver Steffen Cc: devel@edk2.groups.io, Gerd Hoffmann , Marc Zyngier , dann.frazier@canonical.com Content-Type: text/plain; charset="UTF-8" On Sat, 20 May 2023 at 10:37, Oliver Steffen wrote: > > Quoting Ard Biesheuvel (2023-05-19 23:36:53) > > On Fri, 19 May 2023 at 18:32, Oliver Steffen wrote: > > > > > > > > > Hi all, > > > > > > I had another look at this and I can now reproduce the issue consistently, > > > with a quite minimal setup, on recent Linux kernel, Qemu, and EDK2. > > > It requires rebooting the guest in a tight loop. It happens in silent > > > and verbose > > > builds alike, but since the verbose ones are slowed down by the serial > > > output, it > > > takes longer to hit the issue. > > > It is possible to reproduce it with the silent builds within a few minutes. > > > For the verbose case I recommend running multiple Qemu instances in parallel (as > > > many as the machine allows, in my case ~100). > > > > > > > Thanks a lot for all these details, this is extremely helpful. > > > > So what appears to be happening is that we split the 2M block mapping > > that covers the code that we were called from, and hit a level 2 > > translation fault because the updated page table entry is still > > observed to be in its transient 'invalid' state as we return to it. > > > > Could you please check whether this makes a difference? > > > > --- a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibReplaceEntry.S > > +++ b/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibReplaceEntry.S > > @@ -65,6 +65,7 @@ > > // write updated entry > > str x1, [x0] > > dsb nshst > > + isb > > > > .L2_\@: > > .endm > > That fixes it - no crash observed within 150k iterations. > Thanks, Ard! > Fantastic! Thanks a lot for all the effort in tracking this down.