From nobody Tue Feb 10 01:30:42 2026 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 15137906555162.631923590282895; Wed, 20 Dec 2017 09:24:15 -0800 (PST) Received: from localhost ([::1]:60367 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRi5v-0002Kz-7U for importer@patchew.org; Wed, 20 Dec 2017 12:23:51 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56259) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRhy9-0004SB-Uf for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRhy9-00078N-3S for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:49 -0500 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]:45032) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRhy8-00077o-SI for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:49 -0500 Received: by mail-wr0-x242.google.com with SMTP id l41so10723741wre.11 for ; Wed, 20 Dec 2017 09:15:48 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-251-125.clienti.tiscali.it. [78.12.251.125]) by smtp.gmail.com with ESMTPSA id f125sm2751101wme.45.2017.12.20.09.15.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2017 09:15:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=hV9xxOXotobaXtz1aicRhVSNmR7PQmRqVGsGcd0yx4M=; b=EyjAq5PJqnkFqDrYxDTvx+yIYYwFm4LbniH2Ovq3Cja12zLPLGrF+sND7THBHuInzn C3fvvvGHk4lfbFw4yYuqbdm5pmwlbUPzkEXqdJCl7fyIHt76m3wSHwR3WKLnNvsQ8COA qk25hpc7TNB61aXpyYswVz0xWaQxKXIj9mpcQWM11d2CRwk7L8zuMjFdngNSsBlLmBZ+ dFGn8UPbCr6996Y4ou7zh7wpQ37/8lcOv7aCrfSowvGBfMSR6huvBRYBlsKXmvcpcANS zT0/mVX/U5xXdui9SmRjoYdqI0myKG5uOq/XXHDfUy5VPEGh8uTUx/DOL9CEabf2OahX C/sA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=hV9xxOXotobaXtz1aicRhVSNmR7PQmRqVGsGcd0yx4M=; b=mELUHTRHBd/LeRQpctYqqQgK1VDtzXFF5T9loL1hsDxMcLhpiw3mdOK8q17M6ohgw7 +HnisKCrzhReZsZc/+7N6psbhl94BwQAbMGdaqeUXpDVmur/7BmxiGa3mH3SeyaGYbuu M5V8cBQcxXj+27WK3RIoj2f102z+Z4sHZB9qCNkSLc+4uT18/FQ+HPZqEt+OlXJAL1dj 9CvZ7JYATC2krI5hNmQYfR5m7tnMSE2YavLw03uO6R7MJZjXdLH5ULtDqmiV+9mN3ORu LYZWjDTuHCZHYgbyEvIX8QD4NqGQaG24JPWhDh1Obz8dC8HiXIazFTnhPGMmps7v1yFj 0XQw== X-Gm-Message-State: AKGB3mJUNtQPLB7/alxs0fXdhmSKcyJ/+KXtKSoMmX/2FPbtUsAzfveq iSVXZ5rf+U2noMCELhmSj+YfLES6 X-Google-Smtp-Source: ACJfBovHlG9c0ShTHuMfHhNdFKv2558DNBFr/VYIQGfvq9AI5Z5NlPoA4zX/5HNDuv0iolo+7eriIw== X-Received: by 10.223.175.194 with SMTP id y2mr9207194wrd.106.1513790147597; Wed, 20 Dec 2017 09:15:47 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 20 Dec 2017 18:14:25 +0100 Message-Id: <1513790098-9815-14-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> References: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::242 Subject: [Qemu-devel] [PULL 13/46] cpu-exec: fix missed CPU kick during interrupt injection X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Hildenbrand Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_6 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: David Hildenbrand The conditional memory barrier not only looks strange but actually is wrong. On s390x, I can reproduce interrupts via cpu_interrupt() not leading to a proper kick out of emulation every now and then. cpu_interrupt() is especially used for inter CPU communication via SIGP (esp. external calls and emergency interrupts). With this patch, I was not able to reproduce. (esp. no stalls or hangs in the guest). My setup is s390x MTTCG with 16 VCPUs on 8 CPU host, running make -j16. Signed-off-by: David Hildenbrand Message-Id: <20171129191319.11483-1-david@redhat.com> Signed-off-by: Paolo Bonzini --- accel/tcg/cpu-exec.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 9b544d8..4452cd9 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -525,19 +525,13 @@ static inline bool cpu_handle_interrupt(CPUState *cpu, TranslationBlock **last_tb) { CPUClass *cc =3D CPU_GET_CLASS(cpu); - int32_t insns_left; =20 /* Clear the interrupt flag now since we're processing * cpu->interrupt_request and cpu->exit_request. + * Ensure zeroing happens before reading cpu->exit_request or + * cpu->interrupt_request (see also smp_wmb in cpu_exit()) */ - insns_left =3D atomic_read(&cpu->icount_decr.u32); - atomic_set(&cpu->icount_decr.u16.high, 0); - if (unlikely(insns_left < 0)) { - /* Ensure the zeroing of icount_decr comes before the next read - * of cpu->exit_request or cpu->interrupt_request. - */ - smp_mb(); - } + atomic_mb_set(&cpu->icount_decr.u16.high, 0); =20 if (unlikely(atomic_read(&cpu->interrupt_request))) { int interrupt_request; --=20 1.8.3.1