From patchwork Wed Jan 24 15:54:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 765639 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:10c4:b0:337:62d3:c6d5 with SMTP id b4csp2180868wrx; Wed, 24 Jan 2024 07:55:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IE9RZQXdK8nypaccr8i1DI+AmuUzdqRkxfM1b5N5laLMDsyagS8kXS0v8Qpflni9Sf3MF31 X-Received: by 2002:a25:e309:0:b0:dc2:3ae4:fc14 with SMTP id z9-20020a25e309000000b00dc23ae4fc14mr728417ybd.110.1706111756295; Wed, 24 Jan 2024 07:55:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706111756; cv=none; d=google.com; s=arc-20160816; b=czc+wFdClU1xnQk9Q4L9NQe+33s2tFg/zZ3p+2u/OCUkJ1jSTbr7fqzE5JiVe5YYS6 IadvQZEDXAtfNQY1KPYd0MGuCjWnKyM8fCp+Z9/Sb4w43YF3gvNZKm2M5VOqSTJKhI8U r9aLEsQUgXeQZ7M6V2rSRUu7gLqLidg/3xzB9NgzH1GZxctjxZSC9ZWvBZJHsh7br08E JYxtAY800pcLoNXfdxQLxZaWOoYiYU1pIGSBAf8dB4PkXKWR0eIH8Dq0GD4S3rqeFGSu OXh/PqkEi7vLzeXl5L3nHCVPmV+PFgYsArgL+l6ek6PrAvZD62G/x8MqRHjCt6z5429M nbTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=v3Z0Jq1OM+053LyGdHXwEFjN+ojKTQFR08GCVhW4ybo=; fh=xK/PpTBdOmWf4C8q/qM/JEZSr/jQk367oOzmeGjbBKo=; b=mNteNFhZPRJfiLLB8ZeUbz3zPozc145qcm9xtkT1XCy5vaWttefn3INp8EBDB7mHmH Mz/OpYgcqNeY4/ghelg6Y68t6QVzxuR1+qPH9N1+XlT0nIHlDv+pOpd3oUP7N5mk2804 +uSJ6ACq+Ho55TlfuaJltH6RGNC7JEoWC7zIX7Vd/n/SWPwbriPsuB84IctmZrN8QuAD ktClwNN66PLRpJxNicPEh+ZOF0hinnWi6wuGIfxUSf7iycq25GCY2Tg1LnUnMAxvYMo3 4FjCkbzvqKU9xnmfNFQXygm6hYhBSaIe+XT4g/xeB7wzPJ9kQynQvR8o6DvQXLUQ20gY B0UQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zsihVpru; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id v16-20020a05620a0f1000b00781784aa6b4si11652539qkl.303.2024.01.24.07.55.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Jan 2024 07:55:56 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zsihVpru; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rSfac-0003g5-Ol; Wed, 24 Jan 2024 10:54:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rSfaP-0003bu-4s for qemu-devel@nongnu.org; Wed, 24 Jan 2024 10:54:46 -0500 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rSfaN-0002P7-J0 for qemu-devel@nongnu.org; Wed, 24 Jan 2024 10:54:44 -0500 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-40e775695c6so54824025e9.3 for ; Wed, 24 Jan 2024 07:54:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706111681; x=1706716481; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=v3Z0Jq1OM+053LyGdHXwEFjN+ojKTQFR08GCVhW4ybo=; b=zsihVpruycjU1JIQURwG+6A4eTLvnwD5oMzhCBPQxO3hdiv+DDfYxOG74jjihbU1j/ Amt/YICWuNzoIpJWA/M8KL6Ab+hnfX76zB0WTE0I6UCqHC9z9rCLr1rDTKneIrL9B25b JSGx69+DZnPSO+mY63GUTJPDBzAZ+pky4Plkq20fBOGDNO5UZlkESmp5j0tB1x4O51Gr F4Cz6RY9xHvO0bXg2eguAf1pU79wxVmnpfejo6VbECWOhA6MNcSHAHgKEptEV3moYC2k az/Tzs7H4rq2bfSNoko2yvNZcMMyiStzPs90qioFuLwtO1h8KdZGrDhHaWjPWqUdtECd r6JA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706111681; x=1706716481; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=v3Z0Jq1OM+053LyGdHXwEFjN+ojKTQFR08GCVhW4ybo=; b=TtXu1occJriRU0SeA4OMTLPH/nZbe4wYZJcN1AEFBsfLezdtO3Zof7lcaFRoI5lAzS swotXwrHZ7Imi/7idCF5LbfrfSlp2Cvrs+UpxM9jzCBEdXJ5ZZmsHZb+OuquZj+zF9iu AajJNrWC/JbX2cjukj/fAazLvfFS7sBamYB/nnIjRqIpzffORQ3PrWyL+oF1qfAgvvZB uEHO3SyGq5cUl7jM85i+9LQqgRaz5Lx2mWpf8dbEFvS9weHc/rlStG9HIf52kITj+oHJ tqntQHiK6lREg8WW38GgSlPhNxlvpeKEGCBPNFSMbLw/mqLCtUno7k5S9ZRBPS7f2Bit 9fTQ== X-Gm-Message-State: AOJu0Yw7bITWcorskspEff9TAde1+JzfEou3hwNNwVVFWM9EXLmBT1xF RS9Jj2S7Lf//CgRIDUcMkW/1Sw0LiS1M7jWbnOlDAvoK+y/MRgJtf6V7m26HCngNq4FkpXAZmWB A X-Received: by 2002:a05:600c:4f87:b0:40d:8810:468b with SMTP id n7-20020a05600c4f8700b0040d8810468bmr1763339wmq.88.1706111681634; Wed, 24 Jan 2024 07:54:41 -0800 (PST) Received: from localhost.localdomain (lgp44-h02-176-184-8-67.dsl.sta.abo.bbox.fr. [176.184.8.67]) by smtp.gmail.com with ESMTPSA id l7-20020a05600c4f0700b0040d5f466deesm57530wmq.38.2024.01.24.07.54.40 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 24 Jan 2024 07:54:41 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, Thomas Huth , Paolo Bonzini , Peter Maydell , kvm@vger.kernel.org, qemu-s390x@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 2/2] accel/kvm: Directly check KVM_ARCH_HAVE_MCE_INJECTION value in place Date: Wed, 24 Jan 2024 16:54:25 +0100 Message-ID: <20240124155425.73195-3-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240124155425.73195-1-philmd@linaro.org> References: <20240124155425.73195-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=philmd@linaro.org; helo=mail-wm1-x330.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@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-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Directly use KVM_ARCH_HAVE_MCE_INJECTION instead of KVM_HAVE_MCE_INJECTION. Signed-off-by: Philippe Mathieu-Daudé --- include/sysemu/kvm.h | 6 +++--- accel/kvm/kvm-all.c | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h index 2e9aa2fc53..4107678233 100644 --- a/include/sysemu/kvm.h +++ b/include/sysemu/kvm.h @@ -350,11 +350,11 @@ bool kvm_vcpu_id_is_valid(int vcpu_id); /* Returns VCPU ID to be used on KVM_CREATE_VCPU ioctl() */ unsigned long kvm_arch_vcpu_id(CPUState *cpu); -#if KVM_ARCH_HAVE_MCE_INJECTION -#define KVM_HAVE_MCE_INJECTION +#ifndef KVM_ARCH_HAVE_MCE_INJECTION +#error Missing KVM_ARCH_HAVE_MCE_INJECTION definition in "cpu.h" #endif -#ifdef KVM_HAVE_MCE_INJECTION +#if KVM_ARCH_HAVE_MCE_INJECTION void kvm_arch_on_sigbus_vcpu(CPUState *cpu, int code, void *addr); #endif diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index 49e755ec4a..b98c0843b1 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -2750,7 +2750,7 @@ void kvm_cpu_synchronize_pre_loadvm(CPUState *cpu) run_on_cpu(cpu, do_kvm_cpu_synchronize_pre_loadvm, RUN_ON_CPU_NULL); } -#ifdef KVM_HAVE_MCE_INJECTION +#if KVM_ARCH_HAVE_MCE_INJECTION static __thread void *pending_sigbus_addr; static __thread int pending_sigbus_code; static __thread bool have_sigbus_pending; @@ -2855,7 +2855,7 @@ int kvm_cpu_exec(CPUState *cpu) attrs = kvm_arch_post_run(cpu, run); -#ifdef KVM_HAVE_MCE_INJECTION +#if KVM_ARCH_HAVE_MCE_INJECTION if (unlikely(have_sigbus_pending)) { bql_lock(); kvm_arch_on_sigbus_vcpu(cpu, pending_sigbus_code, @@ -3339,7 +3339,7 @@ void kvm_init_cpu_signals(CPUState *cpu) sigaction(SIG_IPI, &sigact, NULL); pthread_sigmask(SIG_BLOCK, NULL, &set); -#if defined KVM_HAVE_MCE_INJECTION +#if KVM_ARCH_HAVE_MCE_INJECTION sigdelset(&set, SIGBUS); pthread_sigmask(SIG_SETMASK, &set, NULL); #endif @@ -3358,7 +3358,7 @@ void kvm_init_cpu_signals(CPUState *cpu) /* Called asynchronously in VCPU thread. */ int kvm_on_sigbus_vcpu(CPUState *cpu, int code, void *addr) { -#ifdef KVM_HAVE_MCE_INJECTION +#if KVM_ARCH_HAVE_MCE_INJECTION if (have_sigbus_pending) { return 1; } @@ -3375,7 +3375,7 @@ int kvm_on_sigbus_vcpu(CPUState *cpu, int code, void *addr) /* Called synchronously (via signalfd) in main thread. */ int kvm_on_sigbus(int code, void *addr) { -#ifdef KVM_HAVE_MCE_INJECTION +#if KVM_ARCH_HAVE_MCE_INJECTION /* Action required MCE kills the process if SIGBUS is blocked. Because * that's what happens in the I/O thread, where we handle MCE via signalfd, * we can only get action optional here.