From patchwork Tue Mar 28 11:09:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 96139 Delivered-To: patch@linaro.org Received: by 10.182.246.10 with SMTP id xs10csp267666obc; Tue, 28 Mar 2017 04:11:40 -0700 (PDT) X-Received: by 10.237.41.7 with SMTP id s7mr24437991qtd.64.1490699500949; Tue, 28 Mar 2017 04:11:40 -0700 (PDT) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id p79si3167229qkh.172.2017.03.28.04.11.40 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 28 Mar 2017 04:11:40 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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]:52419 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1csp2K-0005Vy-Bc for patch@linaro.org; Tue, 28 Mar 2017 07:11:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48419) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1csp0S-0004Gx-41 for qemu-devel@nongnu.org; Tue, 28 Mar 2017 07:09:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1csp0P-00037L-Dq for qemu-devel@nongnu.org; Tue, 28 Mar 2017 07:09:44 -0400 Received: from mail-wr0-x22c.google.com ([2a00:1450:400c:c0c::22c]:35807) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1csp0P-00036i-7F for qemu-devel@nongnu.org; Tue, 28 Mar 2017 07:09:41 -0400 Received: by mail-wr0-x22c.google.com with SMTP id u1so99369718wra.2 for ; Tue, 28 Mar 2017 04:09:41 -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=tu+woEqXaKcxPO94kYC7x+9A4DE+5k3GCrnqjhYHFbA=; b=jU18jNMjXorzhxZD8d5E3pbN8fR2w2SbPnrfmXyap9mtIZsfZdthrzG2GyqYlgwcRR Eah+88TTSb4ZcVQ7trCnIUwJU9/UL+b7rr11psAtzIXrrZiIwyRKYQ5csQ4aB/c8W8YY CjFGngAZR1eQmNpCnU2RyKJiabk2CTF+qWkLc= 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=tu+woEqXaKcxPO94kYC7x+9A4DE+5k3GCrnqjhYHFbA=; b=nRBQ7FOKumsR0JJ4coWtgrUANOHn5QH/htWCOPs2CWDVhVdmVL9gTfMcsgiwqzC4FA e7WCBBdFf5mMZLIhTL8u5/3W9pAlkxiTZbsi8za+elq6QtagVWIsMFGMaLlLe3rv2nCu CbCr1nJ43XnJ5a1aH/PBFVVhvjhmX5iCmuOn8YgUDppuX2BlxFH/yxRGGba623VxDRr1 jHTT40Xyce5uHISI9JrkNsZWEPot7WyAeWCAw5tJB73/QI2RXQRanv3ieysVCg4W8696 JOpFIJJ9d0cH4ucsrbqnfcLGSpNzh49tKpWlW9L6KO2EQ8EwDFgEUhtSgltFznh1IEm9 Tb2Q== X-Gm-Message-State: AFeK/H3hMjFWfk/3sBKV9t1+JuME36zoyZytq6+GaOWuK8WsnNlqtgWEIMjcamsWpTuFGgNy X-Received: by 10.28.95.87 with SMTP id t84mr13859396wmb.35.1490699380230; Tue, 28 Mar 2017 04:09:40 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id w12sm4428919wra.21.2017.03.28.04.09.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Mar 2017 04:09:38 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 828E33E0600; Tue, 28 Mar 2017 12:09:36 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Tue, 28 Mar 2017 12:09:33 +0100 Message-Id: <20170328110936.24806-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170328110936.24806-1-alex.bennee@linaro.org> References: <20170328110936.24806-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::22c Subject: [Qemu-devel] [PULL 3/6] ui/console: ensure do_safe_dpy_refresh holds BQL X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Crosthwaite , qemu-devel@nongnu.org, Gerd Hoffmann , Paolo Bonzini , =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" I missed the fact that when an exclusive work item runs it drops the BQL to ensure all no vCPUs are stuck waiting for it, hence causing a deadlock. However the actual helper needs to take the BQL especially as we'll be messing with device emulation bits during the update which all assume BQL is held. We make a minor cpu_reloading_memory_map which must try and unlock the RCU if we are actually outside the running context. Reported-by: Laurent Desnogues Signed-off-by: Alex Bennée Reviewed-by: Paolo Bonzini Reviewed-by: Gerd Hoffmann --- cpu-exec-common.c | 2 +- ui/console.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) -- 2.11.0 diff --git a/cpu-exec-common.c b/cpu-exec-common.c index 0504a9457b..e81da276bb 100644 --- a/cpu-exec-common.c +++ b/cpu-exec-common.c @@ -35,7 +35,7 @@ void cpu_loop_exit_noexc(CPUState *cpu) #if defined(CONFIG_SOFTMMU) void cpu_reloading_memory_map(void) { - if (qemu_in_vcpu_thread()) { + if (qemu_in_vcpu_thread() && current_cpu->running) { /* The guest can in theory prolong the RCU critical section as long * as it feels like. The major problem with this is that because it * can do multiple reconfigurations of the memory map within the diff --git a/ui/console.c b/ui/console.c index 937c950840..dd27c9501b 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1586,7 +1586,9 @@ bool dpy_gfx_check_format(QemuConsole *con, static void do_safe_dpy_refresh(CPUState *cpu, run_on_cpu_data opaque) { DisplayChangeListener *dcl = opaque.host_ptr; + qemu_mutex_lock_iothread(); dcl->ops->dpy_refresh(dcl); + qemu_mutex_unlock_iothread(); } static void dpy_refresh(DisplayState *s)