From patchwork Thu May 21 16:40:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 187079 Delivered-To: patch@linaro.org Received: by 2002:a92:5b0a:0:0:0:0:0 with SMTP id p10csp1742013ilb; Thu, 21 May 2020 10:22:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHDfcbmFpuLjYJZsyPSppCReiqzLXkgWqYHioT2jvs/M+0Tafh46gnI2eTyw2Gi1NV9maA X-Received: by 2002:a25:be41:: with SMTP id d1mr17573427ybm.462.1590081776115; Thu, 21 May 2020 10:22:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590081776; cv=none; d=google.com; s=arc-20160816; b=xsFQlggcYCF5GEttZJkac2LSaspfR3mQip6HpRmLbbYrLbya1aSFsHZtN3i5KXWAsd hyrtxwXZq9Tf0FOJ+kWP+H+7fMB4RZ3b7/sQdVaJxK+zIYdyMEjFzq5/2h8mDWroaaZ/ /FaQire0rVEXYfyn0n7E8uCYEJrKL/mjCSTIXL3HgwSGNb9oZXcu9izMqTNNKiDC8ppv eOGwfQXJOQRck02cWguMCeHfOqKHqkw3sh8MCasTgpWZnAIxshAsp055tHMqrtH9DUK7 j937oWXkQ+XB+fWrqKBlfuAdb3PcBiakGUQcO9lMsnYRoc9HByZrAMaRh2oq+wvcekbG ARkg== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=PofzzyIN8ZoMX3VcbhKeSDmt2Z4USbgC222e6DzhLWQ=; b=qCR0G5UAMskDWNHPSY2el+E2EW+IxWcBM2nVM/oCCm+JUjbAotBGk9dIUDh8IH7H8e VRK43mjebYDcfTqw9omo+AxMwUhjVLJpUCpz8EGATDEcsGfhvfPIVYVQHt1dXiVZNX4Y J2jUjbXYB21DD8pRmL6fFLq62gPa5I9aMurjXDm4F2fb8O8nKCGhYWPPz1cuZ8p2op08 mNwEf+12tqaBgb3jaTtAp+/scYMvAZSBUUtFzH7A97ES85Kp8Q0OIkl/c9i7WYWEPUMX XBjDLoLRydYIA2yk7Hc9rTH1izag/YqWx3oHF3DLzfIzyLdE1pwBPsiQoxJvIrAZtxcM HbEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=D7TRfDNX; 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: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y7si5457741ybs.53.2020.05.21.10.22.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 May 2020 10:22:56 -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=D7TRfDNX; 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]:57230 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbouF-0000yA-J2 for patch@linaro.org; Thu, 21 May 2020 13:22:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50266) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jboJS-00053q-4f for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:54 -0400 Received: from mail-qt1-x843.google.com ([2607:f8b0:4864:20::843]:36690) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jboJQ-0006zm-99 for qemu-devel@nongnu.org; Thu, 21 May 2020 12:44:53 -0400 Received: by mail-qt1-x843.google.com with SMTP id v4so6015721qte.3 for ; Thu, 21 May 2020 09:44:51 -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=PofzzyIN8ZoMX3VcbhKeSDmt2Z4USbgC222e6DzhLWQ=; b=D7TRfDNXXyAbBnWHO/BW6jNN13ajx8i1EgERkdVyXr7GHH7kmYc0qcFfaEv5z90mzQ wuvWFcuTFMYe71jc8dK6Y2eoiVzeROO9SJ9UUrEn+f3GWXJtoDS2vX35PSfUxnt5pjqj mN+dngBfIAC/cBXTS6iZr4GQwqmbZtdKo4nCDSs0SFAXFIwu2016qImQ/07+1jtxPI8Z d3ADahoV8cHN5EuQ/AODEBRx1+bgj3hHTM7JXBwTn428UCS2ubzjGjZg1vUHrNnoCpkT iTwapSBkDSCLFB9eswwIDfEMcKt6soQndSmfdQSUjpSLNSZwFz1S4760QCUkkhgHpv2J fosA== 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=PofzzyIN8ZoMX3VcbhKeSDmt2Z4USbgC222e6DzhLWQ=; b=LzEeLx75ILLDLVcF/5JjIzNMJnmKM3udi1zMIwTcOi6vzaeyJrz2p9jOk0BTm5HZwA 2eKISy2cGBVAWlkgQiqoOm6W1UQCTryS7re9wiYuSIGfzIlOctNwrhhyNZ9nEHy7rlhI pSzsMPlmDLTXmutfEsBnu6f+WgPZMUkbBF/kG6A0lhbAi3GOgGP7wG0u75EOMjkLQI54 dArk9YyoKnwC8BGZY7/99eFra1QlPDsUVLRYeO57HK6qLRRFyjB0vsTbiPmcYtc2P9eH 9PV5OKpuBJnz3iVY4HswY5IOKCmn6uSDcVCaYJfB7cs/UG8HbuXaEKyRjhOkQroWqZz6 HRyQ== X-Gm-Message-State: AOAM531+4Prox6WkOvjhxFcgSYZmPn87ykTZDK9R5KWI7SK4yUtYa052 0WjMWYJA0fvXQz7xZIPw6NnVZMR2yj+mZQ== X-Received: by 2002:ac8:6c54:: with SMTP id z20mr11450617qtu.76.1590079491175; Thu, 21 May 2020 09:44:51 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:1944:c530:655c:5583]) by smtp.gmail.com with ESMTPSA id x24sm5923829qth.57.2020.05.21.09.44.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 09:44:50 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v9 72/74] cpus-common: release BQL earlier in run_on_cpu Date: Thu, 21 May 2020 12:40:09 -0400 Message-Id: <20200521164011.638-73-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200521164011.638-1-robert.foley@linaro.org> References: <20200521164011.638-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::843; envelope-from=robert.foley@linaro.org; helo=mail-qt1-x843.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, cota@braap.org, alex.bennee@linaro.org, robert.foley@linaro.org, peter.puhov@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" After completing the conversion to per-CPU locks, there is no need to release the BQL after having called cpu_kick. Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- cpus-common.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) -- 2.17.1 diff --git a/cpus-common.c b/cpus-common.c index d418eb5aef..7ccc7df876 100644 --- a/cpus-common.c +++ b/cpus-common.c @@ -135,6 +135,11 @@ void run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data) return; } + /* We are going to sleep on the CPU lock, so release the BQL */ + if (has_bql) { + qemu_mutex_unlock_iothread(); + } + wi.func = func; wi.data = data; wi.done = false; @@ -143,21 +148,6 @@ void run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data) cpu_mutex_lock(cpu); queue_work_on_cpu_locked(cpu, &wi); - - /* - * We are going to sleep on the CPU lock, so release the BQL. - * - * During the transition to per-CPU locks, we release the BQL _after_ - * having kicked the destination CPU (from queue_work_on_cpu_locked above). - * This makes sure that the enqueued work will be seen by the CPU - * after being woken up from the kick, since the CPU sleeps on the BQL. - * Once we complete the transition to per-CPU locks, we will release - * the BQL earlier in this function. - */ - if (has_bql) { - qemu_mutex_unlock_iothread(); - } - while (!atomic_mb_read(&wi.done)) { CPUState *self_cpu = current_cpu;