From patchwork Wed Mar 23 17:17:49 2022 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: 12789985 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 54E06C433FE for ; Wed, 23 Mar 2022 17:20:30 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.294004.499703 (Exim 4.92) (envelope-from ) id 1nX4ee-0000EV-7V; Wed, 23 Mar 2022 17:20:16 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 294004.499703; Wed, 23 Mar 2022 17:20:16 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nX4ee-0000EO-3z; Wed, 23 Mar 2022 17:20:16 +0000 Received: by outflank-mailman (input) for mailman id 294004; Wed, 23 Mar 2022 17:20:14 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nX4ec-0007T4-Hz for xen-devel@lists.xenproject.org; Wed, 23 Mar 2022 17:20:14 +0000 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [2607:f8b0:4864:20::1036]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 7fb285ef-aacd-11ec-8fbc-03012f2f19d4; Wed, 23 Mar 2022 18:20:13 +0100 (CET) Received: by mail-pj1-x1036.google.com with SMTP id m22so2405557pja.0 for ; Wed, 23 Mar 2022 10:20:13 -0700 (PDT) Received: from localhost.localdomain (198.red-83-50-65.dynamicip.rima-tde.net. [83.50.65.198]) by smtp.gmail.com with ESMTPSA id d24-20020a637358000000b003823aefde04sm336971pgn.86.2022.03.23.10.20.06 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 23 Mar 2022 10:20:12 -0700 (PDT) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 7fb285ef-aacd-11ec-8fbc-03012f2f19d4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MsX1ZkecFTiI7JDWgHH13CsFxdulVP/faYY6Ho3L9NU=; b=WiW4MrCr//Z88g+PXSFrPmTGMoceaVHESi73affp7lvaELZrmIQzuoUOKQHWdxEGR1 NO8SV9ARJQk3egmkmUIPnlIThomv8Lit2KqxTc39Z2U2FpA9dGoRpDFaiV7jNk13qUza 7zTfMC78Yc9mIXAGObaiUFBGpvB4UERocSaZSl7rhPntj8Gi1+FoC3nfqPiNjeGgZmPh TRMYKUG2CwwJHNw1Jqgv/qe0wIDn26xQq8oJkIoqzDAj6WG0NmljbJFdXSn/JSJOqJKV ad67bhyOCOEqsfPGFGJ1vRiL63Vd3PXt65wKeeSdZ40GLF1FXc9OTqtSP/xBz7j9+tjc hyJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MsX1ZkecFTiI7JDWgHH13CsFxdulVP/faYY6Ho3L9NU=; b=6UdX6dVP5cjODG+BvQRiZCDSG7NudnyjoZc1zvFHYIsNWSZxKzdYBSFaRODybwFrUF IglWoVtqdU1I2+N37dEW7wlBluulRalPPMUNTfbPmz2+4xv5uKRtcnFLmN/rGhyUmF15 3vR8xrGF/xyhfRKTWM8FbXio/E0rGRs3lAhSMllQH3hsb7o0p1l6DXShKHDlPQqPPNH+ /igIeDdGQz/WytUQU1/rkHHBpZ9oqSu7Vm0TQ+CA7A1uSqI46U78LOmiW2JYcc6ZXccF +W+diRUr2Au4ZTDFSL4M5nM9nTcx7pWGlapsbBZnmJ8eoNcXX1FT16XR2mdhOo3n+eDb KtnQ== X-Gm-Message-State: AOAM53233n7n9i/tRrqEuAXs6cV73RPw0zFFEnnEdUo1qdfBLkL4OyXR UUdl+Z5DQOSJBk6j8JPVKN0= X-Google-Smtp-Source: ABdhPJyjcb2sZqeH87rq3zUZWSVN13XuvvacgYKtkqz+CZvHLPq51GDtssoIVmULExUOmBBtc3gkrA== X-Received: by 2002:a17:90a:5291:b0:1bb:ef4d:947d with SMTP id w17-20020a17090a529100b001bbef4d947dmr12885297pjh.243.1648056012464; Wed, 23 Mar 2022 10:20:12 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Wenchao Wang , Laurent Vivier , David Hildenbrand , Yanan Wang , Cameron Esfahani , Marcelo Tosatti , Sunil Muthuswamy , Anthony Perard , haxm-team@intel.com, Paul Durrant , Richard Henderson , xen-devel@lists.xenproject.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Roman Bolshakov , Reinoud Zandijk , Marcel Apfelbaum , Kamil Rytarowski , Paolo Bonzini , Peter Xu , Eduardo Habkost , Stefano Stabellini , Thomas Huth , Colin Xu Subject: [PATCH v4 11/13] accel/tcg: Add rr_destroy_vcpu_thread_precheck() Date: Wed, 23 Mar 2022 18:17:49 +0100 Message-Id: <20220323171751.78612-12-philippe.mathieu.daude@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220323171751.78612-1-philippe.mathieu.daude@gmail.com> References: <20220323171751.78612-1-philippe.mathieu.daude@gmail.com> MIME-Version: 1.0 From: Philippe Mathieu-Daudé TCG/RR is special and creates a single vCPU. It only have to release its resources once. Implement the .precheck() for that purpose. Signed-off-by: Philippe Mathieu-Daudé --- accel/tcg/tcg-accel-ops-rr.c | 9 +++++++++ accel/tcg/tcg-accel-ops.c | 1 + 2 files changed, 10 insertions(+) diff --git a/accel/tcg/tcg-accel-ops-rr.c b/accel/tcg/tcg-accel-ops-rr.c index 006b787289..6fe8e20356 100644 --- a/accel/tcg/tcg-accel-ops-rr.c +++ b/accel/tcg/tcg-accel-ops-rr.c @@ -295,3 +295,12 @@ void rr_create_vcpu_thread_postcheck(CPUState *cpu) cpu->created = true; } } + +bool rr_destroy_vcpu_thread_precheck(CPUState *cpu) +{ + if (single_tcg_cpu_thread) { + single_tcg_cpu_thread = NULL; + return true; + } + return false; +} diff --git a/accel/tcg/tcg-accel-ops.c b/accel/tcg/tcg-accel-ops.c index 127dd6fee5..0b0dbcc47a 100644 --- a/accel/tcg/tcg-accel-ops.c +++ b/accel/tcg/tcg-accel-ops.c @@ -102,6 +102,7 @@ static void tcg_accel_ops_init(AccelOpsClass *ops) ops->vcpu_thread_fn = rr_vcpu_thread_fn; ops->create_vcpu_thread_precheck = rr_create_vcpu_thread_precheck; ops->create_vcpu_thread_postcheck = rr_create_vcpu_thread_postcheck; + ops->destroy_vcpu_thread_precheck = rr_destroy_vcpu_thread_precheck; ops->kick_vcpu_thread = rr_kick_vcpu_thread; if (icount_enabled()) {