Message ID | 20230110173922.265055-23-alex.bennee@linaro.org |
---|---|
State | Superseded |
Headers | show
Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp2849389pvb; Tue, 10 Jan 2023 10:15:15 -0800 (PST) X-Google-Smtp-Source: AMrXdXvmkc5C9BkMhrvglD94qTYGBJxK42epxx/86X0bF+vWfRaiZcio5vx4pV6IWahHWhjbO4x3 X-Received: by 2002:a1f:2110:0:b0:3da:e00d:44 with SMTP id h16-20020a1f2110000000b003dae00d0044mr1796028vkh.4.1673374515455; Tue, 10 Jan 2023 10:15:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673374515; cv=none; d=google.com; s=arc-20160816; b=iwxmU7cLldCiSBQs/M2zp2RHXXMUkyFmb6qBoxKH4kr9ssJbeabEoZDtCIqD6yGLH/ VA7cxZkst1qdpXG1U0/V0FB1hm11y0YtRjc9EuYo27bO05ODVn57wa3zhvt56yrCRN2m eAfWvIb6Lp8M7LT+ip3afBQa01DntiQHJCMYuI81Ff1+8mF27x5eHhjW0IOfjHL8p5Ky TanIwVjdsJRVhuZl7puMSgiiZ8AqQDDV6dHqbDJGk8/poKT7Zl/q10zGRPzEex/U2Kk3 SKn0VDh/sc9qr6pJnkO/yB6P88fnhMDfL+Q9KZLWzeU8Qn3HziUov3UeuUgtSBIH5z46 l5+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=nybovEkM2L6vVZDAOSUOuJJ5Ue1JCC8gNJeG8SzKrzg=; b=veXZMCiY5bioA+vMJsno0D0tPqG5EcZYimBJjdMiXTmGYV4UBYz0qglFuksz1Gz8F/ InS8p+wxeJ57Q0DSzI9gvfcQEkqyDIriFaQfg82ovBKsO7+oIcRa7DxLRwUGaS30kRZ1 DsY3jj33K+q5RydT/d2u6kv97OVTjRv3yCiU4VFoOzyb+ZxuNBLHe+bTLKFLyux9MMRx UTmrCdab7AxlCtLgrI7RMAFS/4JgrdmmF+r/QROvvv2NjvasPbQ9dserAs7YyD1b6AvV RL5NMOdKXQopFEta97eLNmaFyKccSIrm4uamGWNimmnrIsJ26lGzHFZYCUl70QVWAK6K 3FXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KK0BPeJP; 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=pass (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 d194-20020ae9efcb000000b006ffa0ea866esi2558186qkg.652.2023.01.10.10.15.15 for <patch@linaro.org> (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Jan 2023 10:15:15 -0800 (PST) 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=pass header.i=@linaro.org header.s=google header.b=KK0BPeJP; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <qemu-devel-bounces@nongnu.org>) id 1pFIiF-00072o-5x; Tue, 10 Jan 2023 12:47:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <alex.bennee@linaro.org>) id 1pFIiE-00072M-BP for qemu-devel@nongnu.org; Tue, 10 Jan 2023 12:47:02 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <alex.bennee@linaro.org>) id 1pFIiC-0003aU-JU for qemu-devel@nongnu.org; Tue, 10 Jan 2023 12:47:01 -0500 Received: by mail-wm1-x334.google.com with SMTP id ay40so9398088wmb.2 for <qemu-devel@nongnu.org>; Tue, 10 Jan 2023 09:47:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nybovEkM2L6vVZDAOSUOuJJ5Ue1JCC8gNJeG8SzKrzg=; b=KK0BPeJPvh1EOZwTaGsf0twlZy82yJehMBXjXI5cNFQ8Ven9nlLneTLYrMoszY1oVi J9iNoMdZYN5Rg0pTRlLye+FYtZLVQYXvpmT5q8q9ZJGqM9hN8i7bnpFiBKtel/EhaCeE uE1lfynW2GfXxOSBLI6uE0kTQWDDMWby6fS8keC1wn8xeqR77w93ZNCnHcPEAoaSiBJj WEXZCR6InO0CzcPnbgGm3y/vlaQhadcg8Q1ZME9qh4IYjPuUp2mof2SZltVFd7VeknZ/ fto0NhTsu4FY0Wky578yz2Q7W1WkYSo2w99MfElL7vpT/thLjXMW/cPRvOqagdxB2NCP Kx4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nybovEkM2L6vVZDAOSUOuJJ5Ue1JCC8gNJeG8SzKrzg=; b=bYoDfUiz5FmECDDTR9Sh7FqzYLh3zAzkMs2NyPqcmlaYGoAdg9prQwvEPHxUAsTQUZ tGYlOiw/t+6BlFyIC8BK03Q2I4aP27SiWKL64inobFQfEgfMF6lcZo9gOScxPePxWP+s ljflWXfR41yCErKu/UdCkblju6NLMKYqp8KltPlLzdYOsX7s+a+hqJD/WVaqQkrgxQrp ZwfJibTwBNClnQgEd0jSAWz7F+iy4uziuPjD9oogtZU36OpDCWjv8BidTBcjn+u1rXB1 9CbRernyLkL14Bzdwingtw6HSV6KmAahX5BYp6iChV8jkderCVjbBGX/J5PLcYGORvjD NDCw== X-Gm-Message-State: AFqh2koQhzHdNlBx39ykHMctQ1oxZvNLoQB3SEcV3hUyDe+es7gQHpX7 HDJ219i/5nE7EOtSX5ZL+Js4Fg== X-Received: by 2002:a05:600c:2247:b0:3d3:4b1a:6ff9 with SMTP id a7-20020a05600c224700b003d34b1a6ff9mr50504276wmm.26.1673372819079; Tue, 10 Jan 2023 09:46:59 -0800 (PST) Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id s23-20020a1cf217000000b003d1e3b1624dsm20185141wmc.2.2023.01.10.09.46.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jan 2023 09:46:58 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id A9AAC1FFCC; Tue, 10 Jan 2023 17:39:25 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= <alex.bennee@linaro.org> To: qemu-devel@nongnu.org Cc: Richard Henderson <richard.henderson@linaro.org>, Alexandre Iooss <erdnaxe@crans.org>, Beraldo Leal <bleal@redhat.com>, Thomas Huth <thuth@redhat.com>, John Snow <jsnow@redhat.com>, Eduardo Habkost <eduardo@habkost.net>, Elena Ufimtseva <elena.ufimtseva@oracle.com>, Ed Maste <emaste@freebsd.org>, Yanan Wang <wangyanan55@huawei.com>, Cleber Rosa <crosa@redhat.com>, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= <marcandre.lureau@redhat.com>, Li-Wen Hsu <lwhsu@freebsd.org>, Markus Armbruster <armbru@redhat.com>, Jagannathan Raman <jag.raman@oracle.com>, =?utf-8?q?Daniel_P=2E_Berrang?= =?utf-8?q?=C3=A9?= <berrange@redhat.com>, =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= <philmd@linaro.org>, Michael Roth <michael.roth@amd.com>, Wainer dos Santos Moschetta <wainersm@redhat.com>, =?utf-8?q?Alex_Benn?= =?utf-8?q?=C3=A9e?= <alex.bennee@linaro.org>, qemu-arm@nongnu.org, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Peter Maydell <peter.maydell@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, Mahmoud Mandour <ma.mandourr@gmail.com>, John G Johnson <john.g.johnson@oracle.com>, Emilio Cota <cota@braap.org> Subject: [PATCH 22/26] plugins: make qemu_plugin_user_exit's locking order consistent with fork_start's Date: Tue, 10 Jan 2023 17:39:18 +0000 Message-Id: <20230110173922.265055-23-alex.bennee@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230110173922.265055-1-alex.bennee@linaro.org> References: <20230110173922.265055-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x334.google.com 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 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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> Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org |
Series |
current maintainer trees (testing/semihosting/plugins)
|
expand
|
diff --git a/plugins/core.c b/plugins/core.c index ccb770a485..728bacef95 100644 --- a/plugins/core.c +++ b/plugins/core.c @@ -500,10 +500,17 @@ void qemu_plugin_user_exit(void) enum qemu_plugin_event ev; CPUState *cpu; - QEMU_LOCK_GUARD(&plugin.lock); - + /* + * Locking order: we must acquire locks in an order that is consistent + * with the one in fork_start(). That is: + * - start_exclusive(), which acquires qemu_cpu_list_lock, + * must be called before acquiring plugin.lock. + * - tb_flush(), which acquires mmap_lock(), must be called + * while plugin.lock is not held. + */ start_exclusive(); + qemu_rec_mutex_lock(&plugin.lock); /* un-register all callbacks except the final AT_EXIT one */ for (ev = 0; ev < QEMU_PLUGIN_EV_MAX; ev++) { if (ev != QEMU_PLUGIN_EV_ATEXIT) { @@ -513,13 +520,12 @@ void qemu_plugin_user_exit(void) } } } - - tb_flush(current_cpu); - CPU_FOREACH(cpu) { qemu_plugin_disable_mem_helpers(cpu); } + qemu_rec_mutex_unlock(&plugin.lock); + tb_flush(current_cpu); end_exclusive(); /* now it's safe to handle the exit case */