From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 46DB2606A322 for ; Thu, 3 Dec 2026 21:38:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=JtapC4fg Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xZEVM-0006qo-4x; Thu, 03 Dec 2026 16:38:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xZEVJ-0006qR-J1 for qemu-arm@nongnu.org; Thu, 03 Dec 2026 16:38:13 -0500 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xZEVG-0004KV-6J for qemu-arm@nongnu.org; Thu, 03 Dec 2026 16:38:13 -0500 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-4a32576da88so174916f8f.3 for ; Thu, 03 Dec 2026 13:38:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1796333888; x=1796938688; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:message-id:date :user-agent:references:in-reply-to:subject:cc:to:from:from:to:cc :subject:date:message-id:reply-to:content-type; bh=3A7wJarK8y3iUmn4z8Ji7Lt8Srqjk2/Y2IlCETPHrTk=; b=JtapC4fgAF593bddZ+45rsKkJduXwo2aVYTVEHkvVdAaIksG5dc3dxcPg25vpSsXs1 XBYRNE7ghok9cOx3lIBDdVIQSU8PP+JxBjpZToK/r3JVmpbEDToVPhs9ILL5u6P40OAh 7oxMiecmrKSdo/hiC29MfDNnQGVPg4h/FcWRZm7+Vm3mfNM3FniQNaYcQGi7a0soB1kr 13+O1VWpG9pMsc4E07l353KU4Cm2p0jsqXbIzhredCo5lqCwYtBLk0hE468vj4Ywy7ss vx0UgtOPun1q54DcHAsj+lDGyJvBs/8FFHL159EwKTtG6jTa5faGz/+7TH4UGteJvomy cgQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796333888; x=1796938688; h=content-transfer-encoding:content-type:mime-version:message-id:date :user-agent:references:in-reply-to:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=3A7wJarK8y3iUmn4z8Ji7Lt8Srqjk2/Y2IlCETPHrTk=; b=lF0FHzkTRHWer3Yqt/5n0TrjmflKdB4mypKXtaK6q8/qp0Ao0i9uSB1VGsMEmpEOCY WBmJnwTSzBPBq62Hsw/oH9PngYRemz7WVk5yjTotn+G8n7bEzZaW7utDWQZQzavqb8JA BvAcaIggfx47WDtzDgrMRaS3tZ2zKv7fyBnJIuNfs4GxQrgjbIICpFjlUeAj3Zq40m9r 3V7Mv0KFMnUE6Gpl1PO/n6NOvIKTOIFlPgEzW5+2wysHKLwLf+xK6CiAquqj48e2gc1o 8YJmGqYaImyKIW/aXEFN/iIxNedfZkCm0R4lF/5Oid3bK0aIkIOfa7XmO2dQ+/yRiZqo 2Zmw== X-Forwarded-Encrypted: i=1; AL+hErGkLonzRiQgWMiE9qCREDHddAry4YvvCrfpEIpx0NBAYhL7dgPhLGAtKjYsqTC2MgBV9w4vjO0i3w==@nongnu.org X-Gm-Message-State: APuU4Z8DBhCyyWN7ggCaO+R2uPY729xm4AMtSw6pYCiZWo1tWOOzFIOM kbvWArF77BULuLG6TBXPbqcaIj0orgUs5QyYyqSd4OBFLot6WrewB7M/FARItjKz5G0= X-Gm-Gg: AZFdTZdz9tO/A1VWPMXOLPId3TMGzZ88gHEbvi+3xNHZiF6gdBwja1cb9gypiEkxaHZ waXV4XgJhnO3oEH9yCYUPRdUvYvKZEbaqUSQpznXfaTPi/KVkiGZaOSMSqYLlUsg9ATt4+KdWXk MViQ3UbkQmaoIz/SBTeUnzod5gfrhcoA6sPe8+Fpp/n0glMwZh9fMrpTMeKCVFInXPHzhTD249o /vLIiz8/fCDwdzI3UHIBtbrDKDzUFwjuM2JjGVehMJ7xv/K832kKpWawZ4pYBLqW/6iowwgKLck tvhlcDTXtVkl0cEyBWuj00aqCdVp0zQ4N6pJ9aDMK0Rd8NI1Ot+rIxEL/rkdR6JBmdWRpr4HI5b uohTbJFGFGehGwMhFGP1he8UyhydNJ7V+OR5LNaCa+pFXFSdUK/5vGA3JidqjihPCAyPAUTT+Vf BXHrE29xb3PoXkbAA1P7DJ0fJLiy3Yhoxa68m+unxnk45C7wFc9Tqpeq0XsFvui+8IgSmU/civx oqCf1BZNdFKfoKAQD+QXpe8StwSjLTtXr0GkwSu5ajcrp9fKMYNO2ZUbla87GEXXHDB1Bd95xM9 OZm6A6C/sq5ObABjrjqO8cTllvjn7Q== X-Received: by 2002:a05:6000:1a8f:b0:4aa:842f:5f78 with SMTP id ffacd0b85a97d-4d1ea4b3a15mr258372f8f.46.1796333887619; Thu, 03 Dec 2026 13:38:07 -0800 (PST) Received: from draig.lan ([185.124.0.158]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4d172e41e27sm1325641f8f.21.2026.12.03.13.38.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2026 13:38:05 -0800 (PST) Received: from draig (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 4907C5F8DE; Thu, 03 Dec 2026 21:38:04 +0000 (GMT) From: =?utf-8?Q?Alex_Benn=C3=A9e?= To: Xudong Zhang Cc: qemu-devel@nongnu.org, qemu-arm@nongnu.org, Peter Maydell , Richard Henderson Subject: Re: [PATCH] accel/tcg, target/arm: Close softmmu MTTCG cross-PE CMODX stale-TB races In-Reply-To: <20261203174513.167750-1-boxzxd@gmail.com> (Xudong Zhang's message of "Fri, 4 Dec 2026 01:45:13 +0800") References: <20261203174513.167750-1-boxzxd@gmail.com> User-Agent: mu4e 1.14.5-pre2; emacs 30.1 Date: Thu, 03 Dec 2026 21:38:04 +0000 Message-ID: <87se0eyrib.fsf@draig.linaro.org> X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x429.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-arm@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-arm-bounces+qemu-arm=archiver.kernel.org@nongnu.org X-Spam-Status: No, score=-20.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 Xudong Zhang writes: > Close the softmmu MTTCG cross-PE concurrent modification and execution of > instructions (CMODX) races required by the Arm Architecture Reference Man= ual for > A-profile architecture (Arm DDI 0487, =C2=A7B2.2.5 "Concurrent modificati= on and > execution of instructions" and =C2=A7B2.4.4 (Issue M.d =C2=A7B2.7.4) "Syn= chronization and coherency issues > between data and instruction accesses") across three coupled mechanisms w= ithout > altering guest-visible `CTR_EL0.DIC` live-migration ABI or introducing gl= obal > stop-the-world `tb_flush()` calls: > 1. Defer `TLB_NOTDIRTY` clearing and re-invalidate TBs after RAM stores c= ommit > in `accel/tcg/cputlb.c` (normal `do_st_*` and atomic RMW helpers), whi= le > synchronizing `physical_memory_is_clean()` checks under `tlb.c.lock` in > `tlb_set_page_full()` and `tlb_set_dirty()`. > 2. Protect newly translated code pages in `accel/tcg/tb-maint.c` > (`tb_lock_page0()` / `tb_lock_page1()`) **before** `setjmp_gen_code()` > reads guest instruction bytes, closing the fast-path-store vs. first-TB > translation race. > 3. Extend `ic_ivau_write()` in `target/arm/helper.c` to softmmu under MTT= CG > for AArch64 `IC_IVAU` and AArch32 `ICIMVAU`, closing both pre-protect > in-flight fast-path stores and direct-RAM `probe_access*()` writes (su= ch as > SVE `ST1W`, `DC ZVA`, and MOPS) when followed by architectural `IC IVA= U` / > `ICIMVAU`. > > Reproducer: https://gist.github.com/canxin121/34f26564c3667e2b250becdd0b5= a331f > Resolves: https://gitlab.com/qemu-project/qemu/-/issues/5099 > Signed-off-by: Xudong Zhang > --- > accel/tcg/cputlb.c | 156 ++++++++++++++++++++++++++++++++++--------- > accel/tcg/tb-maint.c | 31 +++++++-- > target/arm/helper.c | 68 ++++++++++++++----- > 3 files changed, 204 insertions(+), 51 deletions(-) NACK - this is an AI generated slop patch and isn't a carefully considered approach to the locking around TB code generation. --=20 Alex Benn=C3=A9e Virtualisation Tech Lead @ Linaro