Message ID | 20190731160719.11396-29-alex.bennee@linaro.org |
---|---|
State | Superseded |
Headers | show
Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp4240260ile; Wed, 31 Jul 2019 09:33:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqyXZtUcwWnivlGnPDrdcCvad718b41sk1cdHsXSc+r1Mnz2pAgKU94auJMVQnP8zgOfPWGx X-Received: by 2002:aa7:c554:: with SMTP id s20mr105355520edr.209.1564590783137; Wed, 31 Jul 2019 09:33:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564590783; cv=none; d=google.com; s=arc-20160816; b=0IrZ+wXIZOYTp0d+TXRQaz6AZVXmxBpsNLHmN6cPo30YnpF2Hjhj1m9jtJf+IO9NXk Pg47vL+36XXwq7pNFn8FoUxUc1fUQh83wQ6wQ4tUJnFWOd+Keo7cRSJkbZ01EAZhHSAk zu/7zJrjEL3ri3+Qw/aJvkBk93W8iatSOY+y2l6EwfrF9O5W7B6TMCLlnnZfUbe7eXBJ cSgb3GYDPwp9m4r63LsWexImslL4AnBlVjgID94NHI8uxFkAyRfzJ8Ld2z2dsXaCNcom dsOacMvvR4LRuetLB0gQsg6n6FRJTxB3VITIccIuNugESSjgFJTkMb9MDYUzUwZOMkqG EyIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=NZPJc3zYVl2nOnmRetp03IWG86OpIb2lpqWUrvn/Bks=; b=XVnkClubWdnjYbIprq3peAGzQNVl/K5067BFSOnDUCu9ZuTHboL5IqqK1T5Jsxy3E/ kxpjHMhcPSSgr8pEQeh2BSJ5Z6wnD4j13bmLn8Yynqii4JMAxiTnKcRSFbeFZVb4GBPJ 3VW+YUKGySMQUDJbbhMc9AMpYqM0EwnUz5sKZksifwYP+ncPdbVIlATGFtDXLm88uwTf eLEsUX8KU/eKvpBZtGhSZ2IrUrQKMmL17o7ogoysAdaSQb7xiqLCKSfJD6uCpE52qrgI C4HIJommpoZXOWWolmMDJrjefjim36TTIY34uCBNAOZmpZhqqTEwhv42+TgB181NJmUI XQNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=lHZEjEKg; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: <qemu-devel-bounces+patch=linaro.org@nongnu.org> Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f6si21047654edx.449.2019.07.31.09.33.02 for <patch@linaro.org> (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 31 Jul 2019 09:33:03 -0700 (PDT) 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=fail header.i=@linaro.org header.s=google header.b=lHZEjEKg; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:42846 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from <qemu-devel-bounces+patch=linaro.org@nongnu.org>) id 1hsrXC-0004ic-6Y for patch@linaro.org; Wed, 31 Jul 2019 12:33:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45267) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from <alex.bennee@linaro.org>) id 1hsrPq-00059d-Hb for qemu-devel@nongnu.org; Wed, 31 Jul 2019 12:25:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <alex.bennee@linaro.org>) id 1hsrPp-0000PI-Gk for qemu-devel@nongnu.org; Wed, 31 Jul 2019 12:25:26 -0400 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:34321) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from <alex.bennee@linaro.org>) id 1hsrPp-0000Om-9u for qemu-devel@nongnu.org; Wed, 31 Jul 2019 12:25:25 -0400 Received: by mail-wr1-x444.google.com with SMTP id 31so70406825wrm.1 for <qemu-devel@nongnu.org>; Wed, 31 Jul 2019 09:25:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NZPJc3zYVl2nOnmRetp03IWG86OpIb2lpqWUrvn/Bks=; b=lHZEjEKgtFtZ3MYo1QDovaqQEGDCTQU9V1WKGUbhfugZV/k2qg8DGVOHf2WZ4ruwf9 f9vi2n/WI2xOpMc6IBKsFtlKnzZomjLimL3kstT7tlPCiuI0HqFoNGm1LKm1JgVFUEvA zcJo3WxONnl8WAliaISdt0MCxqaVYed9I/fiDb6aR9DJWggCjELVwkCEWC4O2LZfQzN4 wCe9BiseZvPOPHqiaipcuAtozt1eXxXzJCck+OzNpLAbyTLCBjbcJkssgJ0nMArld9fM rj3bPEc4BvHWOYcMnxZXxayuwUgWKgqxO/fEHzTTne5XkdxizVc/5SXoo2DK6N343PLc CYbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NZPJc3zYVl2nOnmRetp03IWG86OpIb2lpqWUrvn/Bks=; b=aFerla8RHXJAzHS58xXtPCOXJ388EV1HTTOjOKjQ6oActuTIXA65Ur8Pj+t1BxHKKP T3aP19xh1HqvjZN6xpDU5X/X+SDDU7+HtQ7I+LaUWniEpXTqLQcEW99HUAEU34AKY3M+ osMrnNGj9jYgvsH2XR6ZjLTXNbc7BpDzmXHDYfZ/KIS/Uvo+N7+38Os1kDKEow3UpHwC gqUVDCd47JMxNVpqgMIyFjm0cW25JPEvGSv4BChSPTp++Xpdq6q5cMA1AnPIwCRHjvSu bkJHRSq7KUa5q7DGn7HNuNJenj3egs+c4H41zEQIi6+hdoGy/Jzs7A/Stc9X7A4K0JtE Wmdg== X-Gm-Message-State: APjAAAV+3ZE69u1pXt+KtimZAH+zfdKVn1hEFRZnUuw9eLRnh93ZOr3F 0NCt5tbd3lvmB48CYZK9VFw0Ug== X-Received: by 2002:a5d:4cca:: with SMTP id c10mr129112522wrt.233.1564590324261; Wed, 31 Jul 2019 09:25:24 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id l17sm47513161wrr.94.2019.07.31.09.25.17 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 31 Jul 2019 09:25:22 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 2CB3E1FFB1; Wed, 31 Jul 2019 17:07:22 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= <alex.bennee@linaro.org> To: qemu-devel@nongnu.org Date: Wed, 31 Jul 2019 17:06:53 +0100 Message-Id: <20190731160719.11396-29-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190731160719.11396-1-alex.bennee@linaro.org> References: <20190731160719.11396-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::444 Subject: [Qemu-devel] [PATCH v4 28/54] cpu: hook plugin vcpu events X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: <qemu-devel.nongnu.org> List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe> List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel> List-Post: <mailto:qemu-devel@nongnu.org> List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help> List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=subscribe> Cc: Eduardo Habkost <ehabkost@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, aaron@os.amperecomputing.com, cota@braap.org, Paolo Bonzini <pbonzini@redhat.com>, bobby.prani@gmail.com, =?utf-8?q?Alex_Benn=C3=A9e?= <alex.bennee@linaro.org>, Richard Henderson <rth@twiddle.net> Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" <qemu-devel-bounces+patch=linaro.org@nongnu.org> |
Series |
plugins for TCG
|
expand
|
diff --git a/cpus.c b/cpus.c index 927a00aa90b..cef94560e31 100644 --- a/cpus.c +++ b/cpus.c @@ -44,6 +44,7 @@ #include "exec/exec-all.h" #include "qemu/thread.h" +#include "qemu/plugin.h" #include "sysemu/cpus.h" #include "sysemu/qtest.h" #include "qemu/main-loop.h" @@ -1241,9 +1242,18 @@ static void qemu_tcg_rr_wait_io_event(void) static void qemu_wait_io_event(CPUState *cpu) { + bool slept = false; + while (cpu_thread_is_idle(cpu)) { + if (!slept) { + slept = true; + qemu_plugin_vcpu_idle_cb(cpu); + } qemu_cond_wait(cpu->halt_cond, &qemu_global_mutex); } + if (slept) { + qemu_plugin_vcpu_resume_cb(cpu); + } #ifdef _WIN32 /* Eat dummy APC queued by qemu_cpu_kick_thread. */ diff --git a/exec.c b/exec.c index 3e78de3b8f8..65374d0bdc8 100644 --- a/exec.c +++ b/exec.c @@ -974,6 +974,8 @@ void cpu_exec_realizefn(CPUState *cpu, Error **errp) } tlb_init(cpu); + qemu_plugin_vcpu_init_hook(cpu); + #ifndef CONFIG_USER_ONLY if (qdev_get_vmsd(DEVICE(cpu)) == NULL) { vmstate_register(NULL, cpu->cpu_index, &vmstate_cpu_common, cpu); diff --git a/qom/cpu.c b/qom/cpu.c index f376f782d83..90ebb214bb2 100644 --- a/qom/cpu.c +++ b/qom/cpu.c @@ -33,6 +33,7 @@ #include "hw/boards.h" #include "hw/qdev-properties.h" #include "trace-root.h" +#include "qemu/plugin.h" CPUInterruptHandler cpu_interrupt_handler; @@ -354,6 +355,7 @@ static void cpu_common_unrealizefn(DeviceState *dev, Error **errp) CPUState *cpu = CPU(dev); /* NOTE: latest generic point before the cpu is fully unrealized */ trace_fini_vcpu(cpu); + qemu_plugin_vcpu_exit_hook(cpu); cpu_exec_unrealizefn(cpu); }