From patchwork Wed Jun 17 21:02:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 190971 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp830044ilo; Wed, 17 Jun 2020 14:54:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxC/kqVutQp4bBmtS6QG/mjbpsPKbS6NcEWWc7+kslER2x6plvC1aep1qe5I8TJYlAgAWCS X-Received: by 2002:a25:8284:: with SMTP id r4mr1490019ybk.351.1592430891664; Wed, 17 Jun 2020 14:54:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592430891; cv=none; d=google.com; s=arc-20160816; b=Ru+A4XCBWXtYuCURA+Ku883LlM1WOC3Pqplf4PrlTXSD4XlypVJE6ikaXt71DItIvD h4yURYJYmFIdlH7bg1r0Q+NeD2oroIou2pDSMGEbBg76XJiT9PbL14aXefPMOIbSWoN8 /MxfLAjvHp5qEkAggQ2xvYtM3u3ZLjTc0Ija4ofjKuCTwHLPiRo9nw/OAGaIyJXEiOCu +eT8D1/Ju98esm1C+wSNKBknPRBN5PtIHtx/iU47pw5G0B2z2BEOXPxrdx52Xw9nR3Y2 L8OWPmka+prgB86le/4AHIPxvp/w9PItt5K4Sdgoc9jGV4D3MoZuSLMkvPf+Ad9+eRF0 gxLA== 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=kEALw3cb/snp1kLPThKHADdrwsKNjGM+CsHVn0z1BOY=; b=GCFLxKOTbGRv85BGQ8hkhsvsTPKiwamq963b/PmqURaM8J5EZRdl3VojpBAQ4i1cpO ADd/Ta2CSHVSn5w2CGcozZlVu86o/JkTQYBouRHPw3MKkv2VdmAjo3FiXF5EHWf5+n0a 0Z9YeYNRvISoDNTbZZNVy2jCWMNiUPotsxChHPVN2fD3+1xjGVKpIhe4mAxi/BMudswh BX1x+jX2TQ3h6fMC3aYZ5KSvwKJgc9h/OP7VsEEu889wZLjX2/5Z7ErUIqk+PdqLn1fL UOcOWPmm8YmnRhMUdK1IC4Kkhf2SgCSXgIedQ9itLOqynLtsARaaq0SBkpDwwDb2X8dc PX2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=bO9MuSq1; 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 e4si756265ybp.143.2020.06.17.14.54.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Jun 2020 14:54:51 -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=bO9MuSq1; 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]:57738 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlg1D-0005j3-1K for patch@linaro.org; Wed, 17 Jun 2020 17:54:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38298) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlfF1-0004mC-BO for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:05:03 -0400 Received: from mail-qk1-x743.google.com ([2607:f8b0:4864:20::743]:34526) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlfEx-0000Qd-99 for qemu-devel@nongnu.org; Wed, 17 Jun 2020 17:05:01 -0400 Received: by mail-qk1-x743.google.com with SMTP id f18so3525502qkh.1 for ; Wed, 17 Jun 2020 14:04:58 -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=kEALw3cb/snp1kLPThKHADdrwsKNjGM+CsHVn0z1BOY=; b=bO9MuSq1OMXIKKUrkq0Ed1xUAKaGJHYI3TUP8sVHeVVlXy8kYH34c8iZgMJ7FGnlqe LtFgPKywurlzQsVGxJ+n385Gxywl8qMKrJusr9swyNSfM3ix8tHpJMafEU+pLWKQI6iH sVjHNyiQd+vTndm/NIBFjdGdApsInLbwWq+1lIdmXpRff6HaHI5VmnqhejNxGBQNCpI3 GNpwgL8Zt05GSWMz2KJLeu9VCQbJ9U826hXuqgwsQM9KtnHQrZtRU5FCUohfbxYRBzC1 PNdle87wdF5h7jtxISc2tomBatJOEAFx1/oThnriGf/ZERfyrgcuLg8ymi0XmJw604ib irjg== 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=kEALw3cb/snp1kLPThKHADdrwsKNjGM+CsHVn0z1BOY=; b=OeTJPSthp0iRxitLyTqHbD5M/iqIBSnoczQpJizvzhgr29lwQHwbcN61hg+XOLkzXU 9jhvshn0mZC/Y7LMO9VyqWR5v31LbDTIkteyjGPGX0/t0c3WB8kYuA/zfXvE7XcrDfJO BiiwCwRd7GgXiW2fYL8sRb51aM8iGkmhHNl2bcd2I7GBAxGoguzzFk5MyWAbC9pxaVF/ d7S8FR1p6gGzkVZ73glcDiW6e68M/w36p7cPzhdsXaN4HtnnJTPWrvGrQPRx0rBOLjfK bo4MSiodYnkyg5a05ysSPgXWE/NzQi5afTHTrVnTstmoY8EnWOElrGANGPr9h/3eD3kF HTIw== X-Gm-Message-State: AOAM531B26OfLKMZWk+WZ7Abg75wgkFjTQQ+IhzUT5iZWoKeXkkJgBjP uBUki7tdWDM8WLvu968Y0sgIGQ/rPhX3xw== X-Received: by 2002:a37:d246:: with SMTP id f67mr578006qkj.300.1592427897910; Wed, 17 Jun 2020 14:04:57 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fc79:714c:9711:2e9c]) by smtp.gmail.com with ESMTPSA id w13sm997245qkb.91.2020.06.17.14.04.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:04:57 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v10 71/73] cpus-common: release BQL earlier in run_on_cpu Date: Wed, 17 Jun 2020 17:02:29 -0400 Message-Id: <20200617210231.4393-72-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200617210231.4393-1-robert.foley@linaro.org> References: <20200617210231.4393-1-robert.foley@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::743; envelope-from=robert.foley@linaro.org; helo=mail-qk1-x743.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_HELO_NONE=0.001, 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: robert.foley@linaro.org, cota@braap.org, Paolo Bonzini , peter.puhov@linaro.org, alex.bennee@linaro.org, Richard Henderson 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 0287018dc4..eecd63029a 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;