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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 15221C982FA for ; Tue, 22 Sep 2026 16:50:15 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x93gn-0003ag-QY; Tue, 22 Sep 2026 12:49:54 -0400 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 1x93gk-0003Z1-Qb for qemu-riscv@nongnu.org; Tue, 22 Sep 2026 12:49:51 -0400 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x93gj-0002DY-0C for qemu-riscv@nongnu.org; Tue, 22 Sep 2026 12:49:50 -0400 Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68MEix3e3924426 for ; Tue, 22 Sep 2026 16:49:47 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= bAjPGKjObvrHSu8DXVRbAWjcrM6pRucHJzyibk07IRk=; b=LVB/4KqkPFulLrhe LssceO+TXm/ved14iDPcs5hb0GA2W4pS+a5HNm95dRjGTJrqWS7FQ7Yw8M1iWIOX Dgy36zMixj79zpuC3r7RiecXQpuJpf1pitdbZ0js89v4gc/ur05WUFxZ2L5gyb4e hsvQw/CyYDGcHNxxRBBsDuHlNkbjlSZvH/CYsGlkOxPFPwQAdyBl4JJCDUXJnRZW LVF7+zQ4S86eXkh9St1X/NfDsrO9yLXUgpP0ktYbPmLQAR15F6BkUBTneGY/2E9S Lff5GbuVTNXjyJKqwQ/Ca+dBRC9m1eLa8cgsWKB0edi5mgSp1pCe9L/0S8yQOi9l ixmxGw== Received: from mail-vs1-f71.google.com (mail-vs1-f71.google.com [209.85.217.71]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4guuec0rku-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 22 Sep 2026 16:49:47 +0000 (GMT) Received: by mail-vs1-f71.google.com with SMTP id ada2fe7eead31-7847917c402so4050468137.2 for ; Tue, 22 Sep 2026 09:49:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1790095787; x=1790700587; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=bAjPGKjObvrHSu8DXVRbAWjcrM6pRucHJzyibk07IRk=; b=ebIy20IN8zKKCd7jnARM7CLquMDBR8lykS9gC4zVMu5JJ739R/I9gwHp/NZvljsKdY sHbTgiGMMdd9OkkZREW1m7RoKk4l3b1AWxoYiM8MKW6y0elR7h1eFKEZE8H7Xb93MR3X +tzcs0Ybjl6ex+HUWZm4wezVs5RUKhRNrQhTUwVwMCC9e7za46OD7bVwwWfvub0iXUEX ij55RF/iDsPktZiQSLh3ZPfj+EZU6NHC2eqBcNOViIEJmi7rsbFm9LXLmqCyTt2XYbv3 5KXwKalbH85KzFx1blGXo5Fh2ylDK32TZnTYTFAs/gTupJIcpfJaTKAaqDN0T/M4rJdP 5scg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790095787; x=1790700587; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=bAjPGKjObvrHSu8DXVRbAWjcrM6pRucHJzyibk07IRk=; b=JTRHafWx+4nSJqbp/2/6eW/dNr4jVSY4uEmV7R0pHKEtCzE8d6vU691RaeJFDpZA5I TROT787B1GFUOaarnYICRgjBM14omHydjD8o/V0I2tZrEPNG4MvcRch4oC8vuWEDVW2J hLbWcrGEwiyJLaPHjYPrWS55Mf9PfALS+HSNmed7kts+r008Kkgn6Y+Yc/P7qRmv+GAy Uc5XPjUPpmlEW1jmOnEU6dl0Vzyhg4rbcNr20yCywlRbEvQn/Fwu7vMk7WqPvKbSCXBy RVbuAd49IxOoCzQ3SbSDFylqlq3INs4fIGGQ0uQUDpyOR12g0luuvJYIHJlfcu1qV1yv SgcA== X-Gm-Message-State: AFuF++lblJ+SppeySgapHnUgG4Gr3OXg2EcbOeWDiB47DzlOHwkRoDma eA446fs7xo7IH8UU6JOj+JEoWaPGIjlz2rJ9e7F75J1dvUYem2anWXAyGJ4Uw/HsKMttM+zvoqM QTs+1TdEAxiQlxUuRX5HOR7vcJaGR8dIg1CULLCUVtkBjHs7E2I3aiNjUgA== X-Gm-Gg: AYBFou3bprazgjM5nmb09kpsv3Cs0X1HH7hxAEjXE6lzTz7C3MoMMCkk6rS/MgEHDwN 3bqYbSzHlza3eQXYTbPEERObfSPDyAiVYRbG5H8siGDlFn4iSYwU/ShAxLPw+JIF9BF3tduEbhb 4QT6XWHvX79uAe0JX+1fZe4/4dDgOvh2P0jlfoDt50iya7xXTen6Md17aF6hrvfYsFKXkoKkxI0 lBZ1ZVeyGyYeLk4TAacYMHpzQHhvyFa8/ZVsjQ1/+LKATFaZK83kqx//gUgfzuNcdjxs+9uBxPt i4tjQy6HIKF3vrz6Yr/ygDtbfDSJ/y+Z4BPG94EkB19kIioGszrnkVhTH8BZ+nGmlP8w1E5efsZ OUGikWJvfGhZ2n1jzmaIEG2SDyGjWuaT61qPJs8H7 X-Received: by 2002:a05:6102:2922:b0:7a3:4e75:d1f0 with SMTP id ada2fe7eead31-7a55d38b2b7mr9259948137.23.1790095786643; Tue, 22 Sep 2026 09:49:46 -0700 (PDT) X-Received: by 2002:a05:6102:2922:b0:7a3:4e75:d1f0 with SMTP id ada2fe7eead31-7a55d38b2b7mr9259874137.23.1790095786038; Tue, 22 Sep 2026 09:49:46 -0700 (PDT) Received: from localhost.localdomain (pmd666.hd.free.fr. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49fdaada7b6sm42135825e9.2.2026.09.22.09.49.44 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 22 Sep 2026 09:49:45 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, Peter Maydell , qemu-ppc@nongnu.org, Paolo Bonzini , qemu-s390x@nongnu.org, Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 01/17] system: Document has_work() synchronization requirements Date: Tue, 22 Sep 2026 18:49:19 +0200 Message-ID: <20260922164936.15189-2-philmd@oss.qualcomm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260922164936.15189-1-philmd@oss.qualcomm.com> References: <20260922164936.15189-1-philmd@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTIyMDI0NiBTYWx0ZWRfX6s5lAtHEJIa6 PCmjtxYtf1YmHUG08YDVAcSpI/vVYc2y55QWhfSjQdPPbd2DtZs3oGBLRe7juckJ2HvaBADLRZ7 6nudPP2JKSonvZH9qq9u7GYy+RsQ9Wz7JJfch7GZXbRRKdKpWUsM371Bbx2GX+LZ+P9tMQIiWd+ C5ESj4Hql+GaDsCwAsxnh3jLUX0SNJjEANdryyzKoTlljl6MRFOvV/smOIdbjDSmBq/ubxz+ozo WA5mwvL53jk0xI8r+iveeqzdSbXBncE+q8CUR0udGyQLvTfOuQ2UW1ilzqlzKrnl3Mj0YRmGEJo iUrCmJBSdnd46g6/g/NHrgJperK9nmN3DAFigznudr8S3BNqcpAoX3ed82t/K/ExP9NBwxNddPG t/ZVoC2GvWLrpUX8X7yx3rlFyS/8JpuH1ODEJACRKRKvqAqg8M1y0ZluxFqCa7mDrs1z3BFEnyi uXpbuk9zY+XIRqlS5Ug== X-Authority-Analysis: v=2.4 cv=VKdIDNPX c=1 sm=1 tr=0 ts=6ab2b1ab cx=c_pps a=P2rfLEam3zuxRRdjJWA2cw==:117 a=4s3hRJSeHn4rkQlkrse1kQ==:17 a=IkcTkHD0fZMA:10 a=VdqzKS8jKosA:10 a=M51BFTxLslgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=YMgV9FUhrdKAYTUUvYB2:22 a=KKAkSRfTAAAA:8 a=EUspDBNiAAAA:8 a=XUsUnerbLd2lX0N3J0UA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=ODZdjJIeia2B_SHc_B0f:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-GUID: DZn6AL3QePhH-bbUilk3NS9FfPR5eI5L X-Proofpoint-Spam-Info: AW1haW4tMjYwOTIyMDI0NiBTYWx0ZWRfXxWIAPKp4o5hg mOJvcVaN05bDSy1LvUvlp0FA61RpbBBLccFWgMe6/mncxcu2sq3DukVQ8tgmEV4ju4C8WarjLI1 lrkR1n3FX4y3tDuVe2l/O1djx+3RAFM= X-Proofpoint-ORIG-GUID: DZn6AL3QePhH-bbUilk3NS9FfPR5eI5L X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-22_02,2026-09-21_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 phishscore=0 spamscore=0 malwarescore=0 suspectscore=0 bulkscore=0 clxscore=1015 adultscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609220246 Received-SPF: pass client-ip=205.220.168.131; envelope-from=philmd@oss.qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-riscv@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-riscv-bounces+qemu-riscv=archiver.kernel.org@nongnu.org Sender: qemu-riscv-bounces+qemu-riscv=archiver.kernel.org@nongnu.org Document that has_work() may be called with or without the BQL. Require implementations to remain idempotent and avoid consuming work, and to synchronize state shared with other threads without acquiring the BQL unconditionally. Suggested-by: Peter Maydell Signed-off-by: Philippe Mathieu-Daudé --- include/hw/core/sysemu-cpu-ops.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/hw/core/sysemu-cpu-ops.h b/include/hw/core/sysemu-cpu-ops.h index e56eea18b78..d125540262d 100644 --- a/include/hw/core/sysemu-cpu-ops.h +++ b/include/hw/core/sysemu-cpu-ops.h @@ -19,8 +19,10 @@ typedef struct SysemuCPUOps { /** * @has_work: Callback for checking if there is work to do. * - * This function should be idempotent (i.e. not change state) as - * it will likely be queried multiple times before a CPU resumes. + * This callback may be called with or without the BQL. It must be + * idempotent, must not consume work, and must not assume that the BQL + * is held or acquire it unconditionally. State shared with other + * threads must use appropriate synchronization. */ bool (*has_work)(CPUState *cpu); /* MANDATORY NON-NULL */ /** -- 2.53.0