[{"id":3681201,"web_url":"http://patchwork.ozlabs.org/comment/3681201/","msgid":"<ede428ce-a99e-4630-a000-7d8356f08ac7@linaro.org>","list_archive_url":null,"date":"2026-04-22T23:00:15","subject":"Re: [PATCH v3 29/32] target/arm: implement global monitor events","submitter":{"id":72104,"url":"http://patchwork.ozlabs.org/api/people/72104/","name":"Richard Henderson","email":"richard.henderson@linaro.org"},"content":"On 4/22/26 22:52, Alex Bennée wrote:\n> Moving from Exclusive to Open Access should generate event stream\n> events. Technically a non-exclusive store to any address range covered\n> by the global monitor should also trigger such an event but we can\n> only detect that after the event by seeing if memory doesn't match\n> cpu_exclusive_val when processing the eventual store exclusive.\n> \n> The CLREX instruction has the same effect as do other operations\n> clearing the exclusive state (such as eret).\n> \n> We special case STLR/STL (Store Release) instructions to generate\n> events because their use is a suggested pattern for clearing locks\n> that might be sleeping. We only trigger the event if we detect an\n> exclusive instruction is running.\n> \n> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>\n> \n> ---\n> v2\n>    - add gen_global_event_reg() and use that\n>    - add handling for STL/STLR\n> ---\n>   target/arm/internals.h         |  1 +\n>   target/arm/tcg/translate.h     | 14 ++++++++++++++\n>   target/arm/tcg/translate-a64.c | 23 +++++++++++++++++++++++\n>   target/arm/tcg/translate.c     | 20 ++++++++++++++++++++\n>   4 files changed, 58 insertions(+)\n> \n> diff --git a/target/arm/internals.h b/target/arm/internals.h\n> index 089f679ac0a..7045b4a56bd 100644\n> --- a/target/arm/internals.h\n> +++ b/target/arm/internals.h\n> @@ -709,6 +709,7 @@ static inline void arm_broadcast_event(void)\n>   static inline void arm_clear_exclusive(CPUARMState *env)\n>   {\n>       env->exclusive_addr = -1;\n> +    arm_broadcast_event();\n>   }\n\nAn out-of-line arm_broadcast_event suggests an out of line arm_clear_exclusive too.\n\n> @@ -3544,6 +3553,7 @@ static bool trans_STLR(DisasContext *s, arg_stlr *a)\n>       TCGv_i64 clean_addr;\n>       MemOp memop;\n>       bool iss_sf = ldst_iss_sf(a->sz, false, false);\n> +    TCGLabel *skip_monitor_event = gen_new_label();\n>   \n>       /*\n>        * StoreLORelease is the same as Store-Release for QEMU, but\n> @@ -3562,6 +3572,19 @@ static bool trans_STLR(DisasContext *s, arg_stlr *a)\n>                                   true, a->rn != 31, memop);\n>       do_gpr_st(s, cpu_reg(s, a->rt), clean_addr, memop, true, a->rt,\n>                 iss_sf, a->lasr);\n> +\n> +    /*\n> +     * We don't fully model the global monitor as it would be very\n> +     * expensive for every memory access. However in the Arm ARM \"Use\n> +     * of Wait for Event (WFE) and Send Event (SEV) with lock\" it does\n> +     * give the example of using STLR to clear a lock. So if a lock is\n> +     * active trigger the global event register so we don't deadlock\n> +     * while sleeping.\n> +     */\n> +    tcg_gen_brcondi_i64(TCG_COND_EQ, cpu_exclusive_addr, -1, skip_monitor_event);\n> +    gen_global_event_reg();\n> +    gen_set_label(skip_monitor_event);\n> +\n>       return true;\n>   }\n>   \n\nUm, no.  Just because STLR is used in the example, *any* change to the memory region must \nraise the event.  There's nothing special about STLR vs STL vs STB etc.\n\nThe only thing I can think that would handle this is to set up a watchpoint in WFE before \ngoing to sleep, then wake on the watchpoint trigger.  Disabling the watchpoint on any \nother wakeup could be annoying.\n\n\nr~","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256\n header.s=google header.b=A7yd1vRk;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g1F7x3Yn8z1yD5\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 23 Apr 2026 09:01:01 +1000 (AEST)","from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wFgYW-0002ai-FN; Wed, 22 Apr 2026 19:00:28 -0400","from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <richard.henderson@linaro.org>)\n id 1wFgYU-0002aK-LX\n for qemu-devel@nongnu.org; Wed, 22 Apr 2026 19:00:26 -0400","from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <richard.henderson@linaro.org>)\n id 1wFgYS-0007XP-HU\n for qemu-devel@nongnu.org; Wed, 22 Apr 2026 19:00:26 -0400","by mail-pf1-x435.google.com with SMTP id\n d2e1a72fcca58-82735a41920so2451612b3a.2\n for <qemu-devel@nongnu.org>; Wed, 22 Apr 2026 16:00:23 -0700 (PDT)","from [192.168.1.134] ([110.239.0.232])\n by smtp.gmail.com with ESMTPSA id\n d2e1a72fcca58-82f94204ac8sm17187649b3a.0.2026.04.22.16.00.18\n for <qemu-devel@nongnu.org>\n (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);\n Wed, 22 Apr 2026 16:00:20 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=linaro.org; s=google; t=1776898822; x=1777503622; darn=nongnu.org;\n h=content-transfer-encoding:in-reply-to:content-language:from\n :references:to:subject:user-agent:mime-version:date:message-id:from\n :to:cc:subject:date:message-id:reply-to;\n bh=MKI+3ncngUQuOf/A2a3/pnSbJtCw8Fu0fkPbMWKLwSc=;\n b=A7yd1vRkX8H3Yl10CdVOlk2S3CJFNNxWD2UYzGUWmPHhVcP9z1HOGR+9urZdxnvseC\n 5+X7DmA27owmEGQJblzmp7DUPRYm8NPXebe9ykRg+1zar4PRlBM5MhniTpkGwJSHl/1Q\n S9lGgNbFpuE9IWdYMY45pHEysM2BTK532JobOPWyLBu+SICshv8MNXZeivZxPVpDefUg\n 3CxzwzABgPcME8FLw5zDMMoN18J09kvfknV5Do4ANr9kYd0CcmVVSmFlhHSfGETFo61d\n 0tfISRYviNkoifQkCDgF2UYuPYH5y0SGdkKjPLjbAU4m209bQxbR6Rs9mF5LrMTOAGnO\n VKfw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776898822; x=1777503622;\n h=content-transfer-encoding:in-reply-to:content-language:from\n :references:to:subject:user-agent:mime-version:date:message-id\n :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id\n :reply-to;\n bh=MKI+3ncngUQuOf/A2a3/pnSbJtCw8Fu0fkPbMWKLwSc=;\n b=eZknWuYmptfaEMoxskN1iQ/w5Dtm+rcAvvwTnytQe3SSVcoBCvGJfXtEZG43Z23U8q\n r+pjkeovuOmUgZ5tJMwHwZMopGTDJ47siDH/nLShLsylmNRlCgvrRU/Kv25qwDueZ3CY\n fHvslCvRUi5KHj7HPspBLNZtrRO6HdiU/I8Brx9YY5ssreuv8KiwWUx3A3EfOQ4+y1zc\n ZFIWYJedx+54kgBFLLREUiR4wzjMel2hqJ8YpDhWzWGNjk3xgJEnsd/0sldtn3r1cqfL\n Y98ZO8Cm3Ts+R0kQa/9QKtkinSDTi5v9YslcDets0pSfwvZO5bhHKlFjRCQSKvyzTy7d\n eMxg==","X-Gm-Message-State":"AOJu0Yw8VEWA8+dXySaXdyK/p+pzzg2I6UwquSnPaFfU14HvMLQ1Mtrj\n vfzPR5X8PCkP6tyMf0BbTF6U+i8/yYj1qDLgTKndL7LmO1L07U63/K6R4ssHM2DmOff2kiSO/Ai\n BgjAnDqE=","X-Gm-Gg":"AeBDieunmatVQSg4kbXUyBLwGJ4+rfkydGIjQIlGRgTNcANU4wqn7pItpQ67c1Vz92k\n hTX9Ilst3HvQH7TJrPx5TTnnePAm4SCDDUcXUwM5wzejvXGaWUcHuHJuLtbtsyX41J1mrsV4yXr\n 2xQRecoi6pD1vBmxkMEAEXJH0nb8hUw6htsdqLCZeEiWFCyMQnl31/41k3GVz3hjT+4zSK5s0+O\n AFlQBAvBNPazUILti0Ke5VKX8986asZv/soar5ygd7J6+A7UlRG4wmkod1gvW1RQ3MLuPiqHDf0\n 7Nz89EgdO0JOMXJM4OCeIduUM6E1H+Ha4qX/sdTSd2nvY2k8HS/40FPR5tkXVpkOG7buMGAmwwI\n z+OYTZFEDGhTXmvaIeKZmHgTo5k5b3B0UiZs1YVBU1jKgi7Rl3oNTecwasGEyI87h1vyNW94cw4\n gQii8InKQW3oGMYCPOMq4zJvh6FKLtvgnr0E9WHMp8HUT5GqbioA==","X-Received":"by 2002:a05:6a00:27a1:b0:82c:d7c4:4c5c with SMTP id\n d2e1a72fcca58-82f8c82e219mr25728197b3a.20.1776898820823;\n Wed, 22 Apr 2026 16:00:20 -0700 (PDT)","Message-ID":"<ede428ce-a99e-4630-a000-7d8356f08ac7@linaro.org>","Date":"Thu, 23 Apr 2026 09:00:15 +1000","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v3 29/32] target/arm: implement global monitor events","To":"qemu-devel@nongnu.org","References":"<20260422125250.1303100-1-alex.bennee@linaro.org>\n <20260422125250.1303100-30-alex.bennee@linaro.org>","From":"Richard Henderson <richard.henderson@linaro.org>","Content-Language":"en-US","In-Reply-To":"<20260422125250.1303100-30-alex.bennee@linaro.org>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"8bit","Received-SPF":"pass client-ip=2607:f8b0:4864:20::435;\n envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x435.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,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,\n SPF_PASS=-0.001 autolearn=ham autolearn_force=no","X-Spam_action":"no action","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"qemu development <qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<https://lists.nongnu.org/archive/html/qemu-devel>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"}},{"id":3681415,"web_url":"http://patchwork.ozlabs.org/comment/3681415/","msgid":"<87se8lx4jq.fsf@draig.linaro.org>","list_archive_url":null,"date":"2026-04-23T12:08:25","subject":"Re: [PATCH v3 29/32] target/arm: implement global monitor events","submitter":{"id":39532,"url":"http://patchwork.ozlabs.org/api/people/39532/","name":"Alex Bennée","email":"alex.bennee@linaro.org"},"content":"Richard Henderson <richard.henderson@linaro.org> writes:\n\n> On 4/22/26 22:52, Alex Bennée wrote:\n>> Moving from Exclusive to Open Access should generate event stream\n>> events. Technically a non-exclusive store to any address range covered\n>> by the global monitor should also trigger such an event but we can\n>> only detect that after the event by seeing if memory doesn't match\n>> cpu_exclusive_val when processing the eventual store exclusive.\n>> The CLREX instruction has the same effect as do other operations\n>> clearing the exclusive state (such as eret).\n>> We special case STLR/STL (Store Release) instructions to generate\n>> events because their use is a suggested pattern for clearing locks\n>> that might be sleeping. We only trigger the event if we detect an\n>> exclusive instruction is running.\n>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>\n>> ---\n>> v2\n>>    - add gen_global_event_reg() and use that\n>>    - add handling for STL/STLR\n>> ---\n>>   target/arm/internals.h         |  1 +\n>>   target/arm/tcg/translate.h     | 14 ++++++++++++++\n>>   target/arm/tcg/translate-a64.c | 23 +++++++++++++++++++++++\n>>   target/arm/tcg/translate.c     | 20 ++++++++++++++++++++\n>>   4 files changed, 58 insertions(+)\n>> diff --git a/target/arm/internals.h b/target/arm/internals.h\n>> index 089f679ac0a..7045b4a56bd 100644\n>> --- a/target/arm/internals.h\n>> +++ b/target/arm/internals.h\n>> @@ -709,6 +709,7 @@ static inline void arm_broadcast_event(void)\n>>   static inline void arm_clear_exclusive(CPUARMState *env)\n>>   {\n>>       env->exclusive_addr = -1;\n>> +    arm_broadcast_event();\n>>   }\n>\n> An out-of-line arm_broadcast_event suggests an out of line arm_clear_exclusive too.\n>\n>> @@ -3544,6 +3553,7 @@ static bool trans_STLR(DisasContext *s, arg_stlr *a)\n>>       TCGv_i64 clean_addr;\n>>       MemOp memop;\n>>       bool iss_sf = ldst_iss_sf(a->sz, false, false);\n>> +    TCGLabel *skip_monitor_event = gen_new_label();\n>>         /*\n>>        * StoreLORelease is the same as Store-Release for QEMU, but\n>> @@ -3562,6 +3572,19 @@ static bool trans_STLR(DisasContext *s, arg_stlr *a)\n>>                                   true, a->rn != 31, memop);\n>>       do_gpr_st(s, cpu_reg(s, a->rt), clean_addr, memop, true, a->rt,\n>>                 iss_sf, a->lasr);\n>> +\n>> +    /*\n>> +     * We don't fully model the global monitor as it would be very\n>> +     * expensive for every memory access. However in the Arm ARM \"Use\n>> +     * of Wait for Event (WFE) and Send Event (SEV) with lock\" it does\n>> +     * give the example of using STLR to clear a lock. So if a lock is\n>> +     * active trigger the global event register so we don't deadlock\n>> +     * while sleeping.\n>> +     */\n>> +    tcg_gen_brcondi_i64(TCG_COND_EQ, cpu_exclusive_addr, -1, skip_monitor_event);\n>> +    gen_global_event_reg();\n>> +    gen_set_label(skip_monitor_event);\n>> +\n>>       return true;\n>>   }\n>>   \n>\n> Um, no.  Just because STLR is used in the example, *any* change to the\n> memory region must raise the event.  There's nothing special about\n> STLR vs STL vs STB etc.\n\nI think in the context of locks the release is important. But yes I\nagree this isn't covering all the global monitor cases.\n\n> The only thing I can think that would handle this is to set up a\n> watchpoint in WFE before going to sleep, then wake on the watchpoint\n> trigger.  Disabling the watchpoint on any other wakeup could be\n> annoying.\n\nThe global monitor and the event stream are different things though. So\nif we are committing to fully modelling the monitor (which would also\nsolve the ABA issue) it couldn't just be active while doing WFEs.\n\nWe could generate a postscript for every store which might be cheaper\nthan slow-pathing a whole page for the global monitor. If we supported\nsub-pages maybe slow-pathing a cache-lines worth of address space makes\nmore sense.\n\nAnother option would be exposing a exclusive address mask as a dedicated\nregister to the backend and making the check part of the softmmu\ngenerated code?\n\nI guess we could put the monitor active state in tb_flags to avoid the\ncost of code generation when no one uses ldstexcl because they have\naccess to far atomics instead?\n\n>\n>\n> r~","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256\n header.s=google header.b=OivWCho1;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g1ZdQ4Rfzz1yCv\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 23 Apr 2026 22:09:13 +1000 (AEST)","from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wFsrC-0000jE-30; Thu, 23 Apr 2026 08:08:34 -0400","from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <alex.bennee@linaro.org>)\n id 1wFsrA-0000j2-KC\n for qemu-devel@nongnu.org; Thu, 23 Apr 2026 08:08:32 -0400","from mail-wm1-x331.google.com ([2a00:1450:4864:20::331])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <alex.bennee@linaro.org>)\n id 1wFsr8-0004pQ-Hn\n for qemu-devel@nongnu.org; Thu, 23 Apr 2026 08:08:32 -0400","by mail-wm1-x331.google.com with SMTP id\n 5b1f17b1804b1-488ad135063so58258545e9.0\n for <qemu-devel@nongnu.org>; Thu, 23 Apr 2026 05:08:28 -0700 (PDT)","from draig.lan ([185.124.0.195]) by smtp.gmail.com with ESMTPSA id\n 5b1f17b1804b1-488fc0f8188sm546017935e9.2.2026.04.23.05.08.26\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Thu, 23 Apr 2026 05:08:26 -0700 (PDT)","from draig (localhost [IPv6:::1])\n by draig.lan (Postfix) with ESMTP id 3F7C85F7F9;\n Thu, 23 Apr 2026 13:08:25 +0100 (BST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=linaro.org; s=google; t=1776946107; x=1777550907; darn=nongnu.org;\n h=content-transfer-encoding:mime-version:message-id:date:user-agent\n :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=zSTjV5J/44GAA3EnTElOCmB2+krdvC6LR4tezh4F57Y=;\n b=OivWCho1uNqMBZRqbUz4UtwQAzBcQLBkYKfaPz2vhCZhO52klujyZ2XN4CeHMQPKv2\n MF5oB2LZT1sVhFfUb1+wOHkMt/ci5TK1b9+3XqGdTChNPwQPAJBminY3h+z4PZjdS+Wg\n QsjbDIeqGRzCyuZkAuyBVeclPQ7LodhcM5kF8cD3KRKz7Xgw/nZhBD4Op4mTeqF+Ax2t\n ixPOezQVdrOospxixOjLk6QERNBknaz2TZuq+QalQK0Wn/suxCww9uw/40TAkS2+F+kI\n a9D6+TyNj/yVcVCjNEFfRhof1TGTQ/dgLjNrV7S7u7Hz/M8M3GPZOiKrt8Ux0wGJ2hYr\n GSFg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776946107; x=1777550907;\n h=content-transfer-encoding:mime-version:message-id:date:user-agent\n :references:in-reply-to:subject:cc:to:from:x-gm-gg\n :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;\n bh=zSTjV5J/44GAA3EnTElOCmB2+krdvC6LR4tezh4F57Y=;\n b=QEKFQc3uk1yLyH9WaSTFJ5cEktFeyDjBBcAEAosOHkNzQiGn4h0r0VXiK0GHK4A0qU\n jKTynd+ZF/mOPRQyRNT2Dsi8MTQhWUWXIySc3iteglFErzgL5g/sSB8NGiYmDjpX+Zgn\n R9QDDL9XmC/3OJbfdg4S8lsHQ+YPaW8PqruefpqhTm7kQK6VAZeJxcS0/qpgQvgSqCVk\n 733lytwDj/M3SAE/ZRoZdCmAReRJIBfccmut+/wP2NKV9ApGQl87cGEuIikoyCCzhmPN\n 8yq65N9SCXdhPb9AXXMbhqMGE2oomX8DDpZpzs8x0eH9H7uZvqdsWJP/kZnzop2M7bZ8\n iOMw==","X-Gm-Message-State":"AOJu0YxjxzlYdFn0tONDfdFDkMvdup67FkPNbE8En84C8jEY3xmB8ZnV\n da4boaM2ePjpmm6IlYgAvwblefahuoQRzwGTQptyOWxwhkxR6Vc/Cjfot7hjdxPH1xlFTllctoA\n CzLOAQoM=","X-Gm-Gg":"AeBDievgwzoiR55QbHMRjeBfmPohEn64uOskRzzqE4PnBo+Ajl9fg3b3ploiSqro8sO\n gj8tul+XyzkvifNnmmL9E84Ri7anuIa+aeECUxOVHGc9oxEdhIXN5BVPw7L/r7BDsvnnuWb/mAa\n hVZuoTWsE6ynEVMn1AGNix2vXTG8ez0vygODLwKmk79Dzcwmbi+CXinDfyQrVyoObK5Sfqi0mKT\n a5BvPV7RQ6XkuWpdmKNJcx2RjFsBpi1ZCes/RR7ynoVu6LV+ScOTGBMlpNdTkXuYUZSEKv3hnlI\n buBalTdG1Z1FRZSHJJzQcGW6j0saH7y3tCXeB1ymcbckHpI9L2S60MjtbF9VTaPZicZJ3HEAfWk\n BxJ7rlAGqY3bEmhBuWAjm5czn/zOej8SHZSsZfu989JtjjXNX5v6x/bupiV5b6udixQxbwN/nzi\n lSSB/Mzq83PrA5R195icM5tWn8ejzVsUo8ug==","X-Received":"by 2002:a05:600c:3423:b0:488:fd7e:1063 with SMTP id\n 5b1f17b1804b1-488fd7e1253mr205138745e9.29.1776946107159;\n Thu, 23 Apr 2026 05:08:27 -0700 (PDT)","From":"=?utf-8?q?Alex_Benn=C3=A9e?= <alex.bennee@linaro.org>","To":"Richard Henderson <richard.henderson@linaro.org>","Cc":"qemu-devel@nongnu.org","Subject":"Re: [PATCH v3 29/32] target/arm: implement global monitor events","In-Reply-To":"<ede428ce-a99e-4630-a000-7d8356f08ac7@linaro.org> (Richard\n Henderson's message of \"Thu, 23 Apr 2026 09:00:15 +1000\")","References":"<20260422125250.1303100-1-alex.bennee@linaro.org>\n <20260422125250.1303100-30-alex.bennee@linaro.org>\n <ede428ce-a99e-4630-a000-7d8356f08ac7@linaro.org>","User-Agent":"mu4e 1.14.1-pre3; emacs 30.1","Date":"Thu, 23 Apr 2026 13:08:25 +0100","Message-ID":"<87se8lx4jq.fsf@draig.linaro.org>","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::331;\n envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x331.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,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,\n SPF_PASS=-0.001 autolearn=ham autolearn_force=no","X-Spam_action":"no action","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"qemu development <qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<https://lists.nongnu.org/archive/html/qemu-devel>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"}},{"id":3681451,"web_url":"http://patchwork.ozlabs.org/comment/3681451/","msgid":"<8c223aa8-f8a2-485a-b9db-56b022d86cc2@linaro.org>","list_archive_url":null,"date":"2026-04-23T12:59:58","subject":"Re: [PATCH v3 29/32] target/arm: implement global monitor events","submitter":{"id":72104,"url":"http://patchwork.ozlabs.org/api/people/72104/","name":"Richard Henderson","email":"richard.henderson@linaro.org"},"content":"On 4/23/26 22:08, Alex Bennée wrote:\n>> Um, no.  Just because STLR is used in the example, *any* change to the\n>> memory region must raise the event.  There's nothing special about\n>> STLR vs STL vs STB etc.\n> \n> I think in the context of locks the release is important.\n\nNo, it's not.  Notice the aa32 example uses STR.\n\n\n>> The only thing I can think that would handle this is to set up a\n>> watchpoint in WFE before going to sleep, then wake on the watchpoint\n>> trigger.  Disabling the watchpoint on any other wakeup could be\n>> annoying.\n> \n> The global monitor and the event stream are different things though. So\n> if we are committing to fully modelling the monitor (which would also\n> solve the ABA issue) it couldn't just be active while doing WFEs.\n\nI didn't suggest fully modeling the monitor.\n\n\n> We could generate a postscript for every store which might be cheaper\n> than slow-pathing a whole page for the global monitor. If we supported\n> sub-pages maybe slow-pathing a cache-lines worth of address space makes\n> more sense.\n\nNot a chance.\n\n> Another option would be exposing a exclusive address mask as a dedicated\n> register to the backend and making the check part of the softmmu\n> generated code?\n\nI'm not sure I understand this suggestion.\n\n> I guess we could put the monitor active state in tb_flags to avoid the\n> cost of code generation when no one uses ldstexcl because they have\n> access to far atomics instead?\n\nMonitor active state is a global thing.  I really don't see how you're going to \nsynchronize selection of that tb state globally.\n\n\nr~","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256\n header.s=google header.b=my++W8L1;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g1bn80qzlz1yD5\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 23 Apr 2026 23:00:58 +1000 (AEST)","from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wFtfE-000542-SZ; Thu, 23 Apr 2026 09:00:16 -0400","from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <richard.henderson@linaro.org>)\n id 1wFtf7-00053S-76\n for qemu-devel@nongnu.org; Thu, 23 Apr 2026 09:00:09 -0400","from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <richard.henderson@linaro.org>)\n id 1wFtf5-0004Ak-FQ\n for qemu-devel@nongnu.org; Thu, 23 Apr 2026 09:00:08 -0400","by mail-pj1-x1032.google.com with SMTP id\n 98e67ed59e1d1-35fb7c1a455so2587784a91.3\n for <qemu-devel@nongnu.org>; Thu, 23 Apr 2026 06:00:06 -0700 (PDT)","from [192.168.1.134] ([110.239.0.232])\n by smtp.gmail.com with ESMTPSA id\n d9443c01a7336-2b5fab3ac1fsm207328715ad.70.2026.04.23.06.00.03\n (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);\n Thu, 23 Apr 2026 06:00:04 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=linaro.org; s=google; t=1776949206; x=1777554006; darn=nongnu.org;\n h=content-transfer-encoding:in-reply-to:content-language:from\n :references:cc:to:subject:user-agent:mime-version:date:message-id\n :from:to:cc:subject:date:message-id:reply-to;\n bh=O+sgP29uMaU8WHbJ/EjASH6nCteNCOPnKVzqlQC7zHc=;\n b=my++W8L1vbyw+bMz2+UBEQZk/EJVJwQbCRzBGKpZVpD3FH4SRg2GAiStnzhfo8kvWJ\n iK8vF/RG6q+FAZFWUeVRgp+gFEWVkR5B/o3mYui3qpSa/h4Rsv2laGVQfqVgP5lkPTJn\n j8Wz5aDwH6b1Kstc7yGbJf+jw/T06Cgrl1hoOdzRkcMDgRq4czCuS46pIKl4YGmTWD9p\n oCFy3hLc0BzQhTfnaNI0n8VhulkInOkedZBRphUZpI5Q+N8mhxa6o/iAQn8r5vi7lOiF\n k0GYyTKwzdxPSI4+j8L0ZMKyr0qm+xUMQlafTTfs4si48rR2dlU259oZ4vY96/0EKeTn\n mRdA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776949206; x=1777554006;\n h=content-transfer-encoding:in-reply-to:content-language:from\n :references:cc:to:subject:user-agent:mime-version:date:message-id\n :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id\n :reply-to;\n bh=O+sgP29uMaU8WHbJ/EjASH6nCteNCOPnKVzqlQC7zHc=;\n b=X+6THKLhYeRTRG2O+BRmUMtaon80bdqAKuAvj3EtKxqAjpsxErYrnXvFgqCUxKTUhl\n v008+mgfOpgtbMzWGJdmdglAhcyOKRfstJnKGHTJ5+OAE5hWvSe3KmphKCpyh7RQke5V\n 1VfL5L5FMXp5ca46HP+x3OgGmDWtNM/gNnbMs7jwAFlsRmfGxRLxPB0/CEZqFYrygYgv\n 3aFzNwEwFaabxZkdyMZmwMxZo48yFeFfigi32/CgIDj5D87YZBdE160EBR81sCRLUuGm\n 78AVFPOTwG2NfesRfImJUIC/mLZHY5sHACSYCVkAJqDYmqd9wk21juqTIfA11RcbeM1C\n k00Q==","X-Gm-Message-State":"AOJu0YyMFqHNfbepga8yU+9T/l2j7F7qlFunRFZtGxlKtFxXJzFJaEBm\n Zi+M34VHbJBPo/y/pXycFHg/cSXi1y7AIxzod+l9cvZUmoaIaoV7Bq4kZKP0R9CGuOo=","X-Gm-Gg":"AeBDiet7B0VC2OpZf6JHCuqtpeN/lv7A7pl2Ynl0N2NLswR/O48w6uYzo0B8JWvjInf\n O71T0N4OJ6Rs/rISulSdTFCHeBcDWWTAMMmqFzSko8ZKvnmuNSOzQ/ckedx088PkSUWjmOuPNTJ\n n/GDx8oVKC03clC1mcI5vwAl0us6Iv8LKS4zpWMXxl2i/+Wj9WRYaAJMC4SjnGwqyK4ydrVzxqd\n WQCfqqvYxm9wusvlLKXa60rJBmYGGW6X06VVYtcmpGFuNmcFIMBWDxCR9RpP86ALM0+QeDRFP8t\n /91w31sSV5F7bTc9I4NtGYHBDXgmm6KUhmbNjbY4T0/9RjXsyiYot8K1qvf0Q0ZA7qVIWW/VahB\n PQpTRIy7EBd6bZ5RBQh4FI30fbC89ZYQh7Mph1/ZdqQTWlm9nkniM9p9HKngH4Rpu2Nhxj28YW6\n Zfj4jM33IwwW2sQZn3XrXMBnHjIO+DUPhel8S3QzzHbwI9WCkYrA==","X-Received":"by 2002:a17:90b:384e:b0:35e:5a24:3c43 with SMTP id\n 98e67ed59e1d1-3614040861dmr27920163a91.8.1776949205417;\n Thu, 23 Apr 2026 06:00:05 -0700 (PDT)","Message-ID":"<8c223aa8-f8a2-485a-b9db-56b022d86cc2@linaro.org>","Date":"Thu, 23 Apr 2026 22:59:58 +1000","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v3 29/32] target/arm: implement global monitor events","To":"=?utf-8?q?Alex_Benn=C3=A9e?= <alex.bennee@linaro.org>","Cc":"qemu-devel@nongnu.org","References":"<20260422125250.1303100-1-alex.bennee@linaro.org>\n <20260422125250.1303100-30-alex.bennee@linaro.org>\n <ede428ce-a99e-4630-a000-7d8356f08ac7@linaro.org>\n <87se8lx4jq.fsf@draig.linaro.org>","From":"Richard Henderson <richard.henderson@linaro.org>","Content-Language":"en-US","In-Reply-To":"<87se8lx4jq.fsf@draig.linaro.org>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"8bit","Received-SPF":"pass client-ip=2607:f8b0:4864:20::1032;\n envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1032.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,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,\n SPF_PASS=-0.001 autolearn=ham autolearn_force=no","X-Spam_action":"no action","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"qemu development <qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<https://lists.nongnu.org/archive/html/qemu-devel>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"}}]