From patchwork Fri Sep 24 09:38:14 2021 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: 12514701 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 142F4C433EF for ; Fri, 24 Sep 2021 09:39:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EB82760FDC for ; Fri, 24 Sep 2021 09:39:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245260AbhIXJlA (ORCPT ); Fri, 24 Sep 2021 05:41:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237056AbhIXJk5 (ORCPT ); Fri, 24 Sep 2021 05:40:57 -0400 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16087C061574 for ; Fri, 24 Sep 2021 02:39:24 -0700 (PDT) Received: by mail-wr1-x432.google.com with SMTP id t7so25368900wrw.13 for ; Fri, 24 Sep 2021 02:39:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=D1NIBiKsJLet/LtgtEl9N8uYnLoHyxQP991kqXpIcyw=; b=Ww8e5hZDWqw9JfWpbMGhlqI7pDDqNdcsWrhsNdLDPKqjDZuCT/aOjXMXb3ffPDz4JC q4k8WWznxOI4F1skYyZqEK49yp2FXUcThpTuvaBp4eAAxMqnxHpRgbgShH5w+bK6l+qN 5CbHVj/3aQaStowcB7zyX9sRrzHvahYpMf3OEf1LI3dUTj81LxjmhzocnrQtkABZT4bv pOjNSpXr+tK4BYdzodu+F7O/vsKfVbunl1/0JxhfUws8bpvBn7zud2onCKzhJiPhXEHd X+zYEuybb3KioSVSLtAJeCqSWblWl3MMoMNaTWjoQbL2AQSeoiHPEyH5HYcl/aJsxWDB pFFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=D1NIBiKsJLet/LtgtEl9N8uYnLoHyxQP991kqXpIcyw=; b=o1hpPYFmGkqUYlDzukvk/4Y6xSPjmAfJfTkEEmDYMY7XLfVQtyiy1VmUz8w2R5tw3C Pag/37lhoomXhrQgjREarzu5nZjta8nizuwZZoJzuLEo2fGljZws1gxNnCkjt3CuR3Mn A8ZRNFQBOxJsLGKoIPz5RowHlwNWG65WfCUughUVwTfsVuaDXij4RJuQ9f2tyRrrkjTl IL7tu8FjtzmDXbZZCOkAV8aq/9jDBu4NMrCMYeQXMRSK6GKR0jLMrWaCaDJhTkAwzD37 zJgJ58VLAO/865cHTgK4Jplx1w7mkPnbaLKShHxCSJ9K41yTZVzuWnjKmtZFfFwFCByn HRGw== X-Gm-Message-State: AOAM531ZY75vEd05zFQV/9c2H2IJwps90MQJEWmFwfJQEZIcKj56mrf9 9Ti94Gwpt8pF1xYvNw7GJns= X-Google-Smtp-Source: ABdhPJwoZCGo+hg2kmuMf981/dvpSfGlMLdZmtK66h5QoVdyf/I/omnPIeNLYPXTYxRqHVoRVka+SQ== X-Received: by 2002:a7b:c947:: with SMTP id i7mr1051357wml.136.1632476362750; Fri, 24 Sep 2021 02:39:22 -0700 (PDT) Received: from x1w.. (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id m128sm5645595wme.0.2021.09.24.02.39.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Sep 2021 02:39:22 -0700 (PDT) Sender: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , =?utf-8?q?Philippe_Mat?= =?utf-8?q?hieu-Daud=C3=A9?= , Paolo Bonzini , kvm@vger.kernel.org (open list:Overall KVM CPUs) Subject: [PATCH v6 07/40] accel/kvm: Implement AccelOpsClass::has_work() Date: Fri, 24 Sep 2021 11:38:14 +0200 Message-Id: <20210924093847.1014331-8-f4bug@amsat.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210924093847.1014331-1-f4bug@amsat.org> References: <20210924093847.1014331-1-f4bug@amsat.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Implement KVM has_work() handler in AccelOpsClass and remove it from cpu_thread_is_idle() since cpu_has_work() is already called. Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé --- accel/kvm/kvm-accel-ops.c | 6 ++++++ softmmu/cpus.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/accel/kvm/kvm-accel-ops.c b/accel/kvm/kvm-accel-ops.c index 7516c67a3f5..6f4d5df3a0d 100644 --- a/accel/kvm/kvm-accel-ops.c +++ b/accel/kvm/kvm-accel-ops.c @@ -74,6 +74,11 @@ static void kvm_start_vcpu_thread(CPUState *cpu) cpu, QEMU_THREAD_JOINABLE); } +static bool kvm_cpu_has_work(CPUState *cpu) +{ + return kvm_halt_in_kernel(); +} + static void kvm_accel_ops_class_init(ObjectClass *oc, void *data) { AccelOpsClass *ops = ACCEL_OPS_CLASS(oc); @@ -83,6 +88,7 @@ static void kvm_accel_ops_class_init(ObjectClass *oc, void *data) ops->synchronize_post_init = kvm_cpu_synchronize_post_init; ops->synchronize_state = kvm_cpu_synchronize_state; ops->synchronize_pre_loadvm = kvm_cpu_synchronize_pre_loadvm; + ops->has_work = kvm_cpu_has_work; } static const TypeInfo kvm_accel_ops_type = { diff --git a/softmmu/cpus.c b/softmmu/cpus.c index 85b06d3e685..c9f54a09989 100644 --- a/softmmu/cpus.c +++ b/softmmu/cpus.c @@ -90,7 +90,7 @@ bool cpu_thread_is_idle(CPUState *cpu) return true; } if (!cpu->halted || cpu_has_work(cpu) || - kvm_halt_in_kernel() || whpx_apic_in_platform()) { + whpx_apic_in_platform()) { return false; } return true;