| Message ID | 20260923171116.31276-1-philmd@oss.qualcomm.com |
|---|---|
| Headers | show
Return-Path: <qemu-ppc-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; dkim=pass (2048-bit key; unprotected) header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=avCVbfmY; dkim=pass (2048-bit key; unprotected) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=hq8my2aA; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists1p.gnu.org; envelope-from=qemu-ppc-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) 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 legolas.ozlabs.org (Postfix) with ESMTPS id 4hqk5q3W2Cz1xyW for <incoming@patchwork.ozlabs.org>; Thu, 24 Sep 2026 03:11:43 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from <qemu-ppc-bounces@nongnu.org>) id 1x9QVJ-0003QL-Rf; Wed, 23 Sep 2026 13:11:37 -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 <philmd@oss.qualcomm.com>) id 1x9QVC-0003OX-9x for qemu-ppc@nongnu.org; Wed, 23 Sep 2026 13:11:26 -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 <philmd@oss.qualcomm.com>) id 1x9QV8-0000zX-Uj for qemu-ppc@nongnu.org; Wed, 23 Sep 2026 13:11:26 -0400 Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68NGTkcH2470212 for <qemu-ppc@nongnu.org>; Wed, 23 Sep 2026 17:11:20 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=qcppdkim1; bh=mpy8GfzB6U3h/VgxUJ724l x7Y140GhQDd9gKEjSCAzc=; b=avCVbfmYyqKtfzXDijpV31HiOl+O8GOFSaSw3m hL5nRHq8xmQf9Xhy4Ho7GsBSjvrJo3enXKM75sn1aTZpcp7qEziMF6cm7ndY2wyl Tp6lnFFH2oNz47bWL+aviwGgb4lOjt9ohtQKucBE61srJGOsnJ8Gql8FfeqaHaQY 596My5cszqq6oSkp6hbWmtDYDprwCYsueNffT11IGST6vy4jIVcsIydIdGAGy+pG xwMVN0DYFJDpNHYGNUHmWYRaQQH2vOVFwjYcJM8dC/Vbcr18cTs/zFKYNC4DuJI1 p7wV5P0aQEojxgxaD7aTxbPDBw2e+qfUHW+QqXRfVNGTO5QA== Received: from mail-vs1-f72.google.com (mail-vs1-f72.google.com [209.85.217.72]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4gvfjv12fw-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for <qemu-ppc@nongnu.org>; Wed, 23 Sep 2026 17:11:20 +0000 (GMT) Received: by mail-vs1-f72.google.com with SMTP id ada2fe7eead31-78350646d7eso63979137.1 for <qemu-ppc@nongnu.org>; Wed, 23 Sep 2026 10:11:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1790183479; x=1790788279; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:message-id:date :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to :content-type; bh=mpy8GfzB6U3h/VgxUJ724lx7Y140GhQDd9gKEjSCAzc=; b=hq8my2aALbsfyFDrL4pDZ4Y3ZUpQUhajopPJL8e6WdMFdu5M+0N5GiOWbiG5fpYQQG gS+JQTR5WEWaypJG7H8OZE4vDlf6s1+r4bGkYGRz5YEeDW616NndUBCol2p5J0DnblC3 +I2bOIMCQYru5WRsgWmkHBJwE6w/791gB69mBR1hNowP7AMTz0L6NfjDg8KlNsfeU+tW ytkrWZpOvcCTfhW1L96PACT1e1Z2UeFdy/l9b73iWxiyVsowqNqmtCrPjH+z6CbkOex+ vu6UIkIve0+W2YN1VpVecyW2w85ScYDsEcTBMkhaSNq7IjiqtwscDT/B4atmtw4qgasA yGAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790183479; x=1790788279; h=content-transfer-encoding:content-type:mime-version: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=mpy8GfzB6U3h/VgxUJ724lx7Y140GhQDd9gKEjSCAzc=; b=Xw3P4tDxl/r5dNA+TaQixDRbaZKTBS5ii7C4sue3H0axd6mH0G30GwEodyHglMOOPn 8KXFRp2mySZvMNWEw2fqGe2XlR57wW9//QCOP/5TOr4bq/47jP8lxOlvUNkzZ4PT4mEq o7qouOKNFMOkxS7sO0zIxzS85Ax/7LtN8wU+xFVTWzabC4trV5PoLdNxlaWRGCYVOEgE ne+jd2Npx2kz71Q06iJFcw34S5bAOSPa/2xsZScxdfvPpi2yvmpwlNBaBXuW1noeHcC4 4TkcNrScxz52DBm5IP4v3iJR7u2U/FhTviYKKNcgeDdgGMt5xlTLkHxyddmd+uwPaqoQ lvnw== X-Forwarded-Encrypted: i=1; AKwUvBydnlKvFDN+4Y3opQplKz2ruwc2jKa5arLjl0duwh0xcCf2dqntatmqxwjMsRab7pB8puyM8CpIIg==@nongnu.org X-Gm-Message-State: AFuF++mdirFr7MWdJbzxGNsQuQmBgAMR0wftO41QW47xhjU3cWOTKhrp BAGzE8d6qm/QAhQ8rBYTKqgsSs/a3ZfQVyp9Io9cgngrse2Xwo49CXwdJHITiLfQ5gsBCUkbe1m UTlwoG8+WBWffZI3s4VZH9rJkzu64Bim+uRZ5lz3Mt5CZLN2PLcmH6bk= X-Gm-Gg: AYBFou2GOqR55QEXnexirkRPp24e4L9FrYHgsn8Y/0dkyTOwyq7XWbtBMp/YQhMMfQU v7eMZOmrVwJGFj27m0ZcBUnR+jPWL0sUm4+dGwFT7C5aB6CgtKs35kCViht/5ufUNvVIif/YOht 85B3kbSw0aE9+u1hh9Un3+l5ilCEN9QSnpE9KAaZpCfq5px8rHvzySmEEqDHGmJwh3W+rW9cBng 1I73/zcqphIbx8o7pJeXvGBufFUmbB7rv1ePqGAJuFuOiks216DvruOUO+o7AWxZAMjm9l6zQg0 +YWnR0oDnu/nrEMBWRVmJNIzXJaqr5LmjUcklq0PfJrEoiaeSKPn/Zx8byIjEcoxEHj3RDIJe+B COquwvpk61ka0EKEooiSgRhcOjryf/Bs07lSYwjpt X-Received: by 2002:a67:f818:0:b0:7a1:f2b5:646c with SMTP id ada2fe7eead31-7aaa0f22399mr5116857137.41.1790183479323; Wed, 23 Sep 2026 10:11:19 -0700 (PDT) X-Received: by 2002:a67:f818:0:b0:7a1:f2b5:646c with SMTP id ada2fe7eead31-7aaa0f22399mr5116838137.41.1790183478755; Wed, 23 Sep 2026 10:11:18 -0700 (PDT) Received: from localhost.localdomain (pmd666.hd.free.fr. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49fe5cbd134sm687575e9.9.2026.09.23.10.11.17 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 23 Sep 2026 10:11:18 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <philmd@oss.qualcomm.com> To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, qemu-ppc@nongnu.org, qemu-arm@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>, qemu-riscv@nongnu.org, Richard Henderson <richard.henderson@linaro.org>, Peter Maydell <peter.maydell@linaro.org>, =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= <philmd@oss.qualcomm.com> Subject: [PATCH v3 00/21] accel/tcg: Make halt-to-exec transition explicit and remove cpu_exec_halt Date: Wed, 23 Sep 2026 19:10:54 +0200 Message-ID: <20260923171116.31276-1-philmd@oss.qualcomm.com> X-Mailer: git-send-email 2.53.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTIzMDA2OCBTYWx0ZWRfX00MUUY74NL5X WiBDQcHAxhuvwQcVoWC8EDKBL9e6Df5eGOODWLfk+UOqm4wEtOX5XcOfjVnFRI2ULohsvc/zgke qB3pvvQuQU8eu/aZWqvgxqU66Vw2i1GMsS4KLholir3kL8QVqVUBloiMNI59vq4yyB6YxEZ1/CC kwAS0rmP2zw/tqyoSSVtY41CCXkGNBOwDVB1VhY1hWIws6g0Nx0YLksZXmtfWFwaOLHUG/agIxA agQiCa1A5cLoJjginxY98Vh7FfIKHJ8S22SV2ab4injtoCm3/v03MHeF5nDHXscA801OBQ8iAR1 FSKfD356paTRKKEiViELPSQ+Hn9OqMpUeLTwjzhWTjzfjjhDe7MBLWtudSM0aMbHSenaIu8D+xd O7KV07y6TwPPRME2LAl6OoPgtNrwvlV06icHL+ECkv4MKUDPE3kOze7xIuwo/PgalynIDjOnPK3 5lVDWnCfnmjzagnywVQ== X-Authority-Analysis: v=2.4 cv=aIxlOr9m c=1 sm=1 tr=0 ts=6ab40838 cx=c_pps a=DUEm7b3gzWu7BqY5nP7+9g==: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=DJpcGTmdVt4CTyJn9g5Z:22 a=VwQbUJbxAAAA:8 a=pGLkceISAAAA:8 a=lXy-g8FGwViYJ1dSwUkA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=O8hF6Hzn-FEA:10 a=-aSRE8QhW-JAV6biHavz:22 X-Proofpoint-GUID: wMDL3VV1Z9IdE2OHo3vcOPPEkkyfhVd_ X-Proofpoint-Spam-Info: AW1haW4tMjYwOTIzMDA2OCBTYWx0ZWRfXxGjgEY23prVY G3bZFmzWc8iT+LC+ntc353xBmlbE5p10qrxYv76PrHZb/f5pFqW+9FRcv7mu5lusRGFEQUymrjo 66t74rFuQHRk/XJ+xJnnt8Zr6lBHadM= X-Proofpoint-ORIG-GUID: wMDL3VV1Z9IdE2OHo3vcOPPEkkyfhVd_ 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-23_06,2026-09-21_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 suspectscore=0 priorityscore=1501 spamscore=0 phishscore=0 malwarescore=0 lowpriorityscore=0 adultscore=0 bulkscore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609230068 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-ppc@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: <qemu-ppc.nongnu.org> List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-ppc>, <mailto:qemu-ppc-request@nongnu.org?subject=unsubscribe> List-Archive: <https://lists.nongnu.org/archive/html/qemu-ppc> List-Post: <mailto:qemu-ppc@nongnu.org> List-Help: <mailto:qemu-ppc-request@nongnu.org?subject=help> List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-ppc>, <mailto:qemu-ppc-request@nongnu.org?subject=subscribe> Errors-To: qemu-ppc-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-ppc-bounces+incoming=patchwork.ozlabs.org@nongnu.org |
| Series |
accel/tcg: Make halt-to-exec transition explicit and remove cpu_exec_halt
|
expand
|
Missing review: 4, 7, 9-12, 17 Since v2: - Make all ARM halt_reason accesses atomic, including WFI/WFE helpers and halt-exit handling, and read event_register atomically. - Keep the RISC-V changes focused on MIP: skip empty updates, add a shared accessor, and convert existing MIP reads to use it. Since v1: - Collected Richard R-b tags (sometimes commit description updated). - Documented the BQL and synchronization requirements of has_work(). - Renamed the callbacks to poll_during_halt() and leaving_halt(). - Addressed Peter's comments by removing racy halt-work assertions, documenting the BQL contract, and explaining why x86 #DB delivery through do_interrupt_all() is safe without the BQL. - Addressed Paolo's comments by making ARM PSCI state updates atomic, kicking remote vCPUs after power-state changes, and ensuring x86 APIC polling runs before cpu_has_work() with the BQL held only around APIC access. - Sanitized s390_cpu_get_state() for atomic accesses without BQL. This series was inspired by a previous thread on the list [*]. Refactor the CPU halt-to-execution transition logic in TCG as something more explicit and composable. Core problem: TCGCPUOps::cpu_exec_halt callback mixed concerns, it checked for work, processed async events, and handled state transitions all in one place. Solution: introduces two dedicated callbacks: * poll_during_halt(): Process target-specific async events before checking for work. Called early in cpu_exec(). * leaving_halt(): Perform target-specific state updates when transitioning from halt to execution. This separation allows the generic cpu_exec() code to orchestrate the flow cleanly (process events, check for work, transition state). Only 2 targets need to be migrated (x86 and ARM) then we can remove the redundant cpu_exec_halt() hook. The changes are expected to be purely refactoring with no functional impact. [*] https://lore.kernel.org/qemu-devel/CABgObfaDAhrpnVqQaKgG6uxPQe1YDu77YOsUEx9nqrN=3M2cGw@mail.gmail.com/ Philippe Mathieu-Daudé (21): system: Document has_work() synchronization requirements target/s390x: Use s390_cpu_get_state() consistently target/s390x: Make s390_cpu_set_state() return void target/s390x: Use S390CpuState for CPU state APIs target/s390x: Access S390CpuState atomically target/arm: Un-inline arm_set_cpu_power_state() target/arm: Kick vCPU after updating PSCI power state target/arm: Access PSCI state atomically target/arm: Access halt state atomically target/riscv: Skip empty MIP updates target/riscv: Add riscv_cpu_get_mip() target/riscv: Access MIP atomically accel/tcg: Refactor poll-while-halted flow in cpu_exec() accel/tcg: Introduce poll_during_halt() and leaving_halt() target/arm: Split leaving-halt handling from arm_cpu_exec_halt() target/arm: Convert cpu_exec_halt() to leaving_halt() target/i386: Use an acquire load for interrupt_request target/i386: Split APIC polling from x86_cpu_exec_halt() target/i386: Split leaving-halt handling from x86_cpu_exec_halt() target/i386: Use generic halt transition handlers accel/tcg: Remove the redundant cpu_exec_halt() hook include/accel/tcg/cpu-ops.h | 36 ++++++++++++++++------------- include/hw/core/sysemu-cpu-ops.h | 6 +++-- target/arm/internals.h | 11 +-------- target/i386/tcg/helper-tcg.h | 3 ++- target/loongarch/internals.h | 1 - target/riscv/cpu.h | 1 + target/riscv/internals.h | 5 ---- target/s390x/cpu.h | 9 ++++---- target/s390x/kvm/kvm_s390x.h | 2 +- target/s390x/s390x-internal.h | 1 - accel/tcg/cpu-exec.c | 20 ++++++++++------ hw/intc/riscv_aclint.c | 2 +- hw/intc/s390_flic.c | 7 ++++-- target/alpha/cpu.c | 1 - target/arm/arm-powerctl.c | 13 +++++++++++ target/arm/cpu.c | 31 +++++++++++-------------- target/arm/tcg/cpu-v7m.c | 1 - target/arm/tcg/op_helper.c | 8 +++---- target/avr/cpu.c | 1 - target/hexagon/cpu.c | 1 - target/hppa/cpu.c | 1 - target/i386/cpu.c | 5 +++- target/i386/tcg/system/seg_helper.c | 17 +++++++++----- target/i386/tcg/tcg-cpu.c | 3 ++- target/loongarch/cpu.c | 2 +- target/loongarch/tcg/tcg_cpu.c | 1 - target/m68k/cpu.c | 1 - target/microblaze/cpu.c | 1 - target/mips/cpu.c | 1 - target/or1k/cpu.c | 1 - target/ppc/cpu_init.c | 1 - target/riscv/cpu.c | 5 ++-- target/riscv/tcg/cpu_helper.c | 20 ++++++++++++---- target/riscv/tcg/csr.c | 6 +++-- target/riscv/tcg/tcg-cpu.c | 1 - target/rx/cpu.c | 1 - target/s390x/cpu-system.c | 26 ++++++++++++--------- target/s390x/cpu.c | 3 +-- target/s390x/kvm/kvm.c | 4 ++-- target/s390x/kvm/stubs.c | 2 +- target/s390x/machine.c | 2 +- target/s390x/sigp.c | 9 ++++++-- target/sh4/cpu.c | 1 - target/sparc/cpu.c | 1 - target/tricore/cpu.c | 1 - target/xtensa/cpu.c | 1 - 46 files changed, 150 insertions(+), 127 deletions(-)