From patchwork Fri Jun 5 17:34:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 187566 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp2587452ilo; Fri, 5 Jun 2020 10:41:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzrxY0KU4d9vhszc/pQVPh8tbldi+e50Z5wGROhSS0qTihTBYTdqL/dDhH0qLDH5VpkvYkW X-Received: by 2002:a25:810f:: with SMTP id o15mr17156558ybk.35.1591378897359; Fri, 05 Jun 2020 10:41:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591378897; cv=none; d=google.com; s=arc-20160816; b=EWypNWDJ6+TOeb8n1bs/JgZ9YdwEpdAHavyT7qww4IF34o8pOPTYVxlXu/vLLWkAps eFrvoTYJ0pq5cJBdHmYY6MhkV3MYtV0GB7SgvStpJkyVf+u9gg9hn82pf74qYMsog10M eQ7uiJXsCARjFqOvjfr32112+VA342aty+Uhm4ZQyQiBZ0EcxLhLVtzjFPptI6i+PiG8 6zndYJ4Pg4SGWkac3DAkFlSEOYkloid3ceZeFDArAgE2E+OP/2O/aPmt5Ht3NTA9h6Df sCUOWhLcyzV2leKRYQ012NHKP7wzHP236pVk/8r+syGTJ2PxIfU/TK0ZIMrP1H6C/aoF TYDQ== 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:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=v6Twul2TWinr3wq/OK/PDzXQA1fcuJlgD8ranJI4BbA=; b=sMWSHD51w44jjxY2gZSd9EpcgnY2xaqhjnV+Svr35J1G/IaaWQ15FXTmQEjKvSrNwz k8jbUoqISwDiaoxbx6HI8cOUQe4/dkC3U5tqbIAsJRltrx2RIv0QWkgT6uYW17M22LOq /38ZRZh4uZtZKLeFFXI2ZXU6ySO+DzxQVA9WPyyZVDEfRgidcZ2MTWUqBjz8VQb7gXQV kPJ1YfniNbw5qaVSqGxK4neXDIsIsCn8n7UnMb07xD9i/W0VChz25TfVCHjWyIYyChRM KybzlzNyORAJy7Agry+nYsEa3B+uoNdAHdt+wavdjFCNnkcrpmaE7TTcAieq8F/dxSLM bYWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=EBdON3YY; 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 h65si8084830ybi.200.2020.06.05.10.41.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jun 2020 10:41:37 -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=EBdON3YY; 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]:43444 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jhGLY-0002Tu-P2 for patch@linaro.org; Fri, 05 Jun 2020 13:41:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48176) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jhGHt-0003np-7e for qemu-devel@nongnu.org; Fri, 05 Jun 2020 13:37:49 -0400 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]:42921) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jhGHs-0003vn-DR for qemu-devel@nongnu.org; Fri, 05 Jun 2020 13:37:48 -0400 Received: by mail-pl1-x643.google.com with SMTP id x11so3970325plv.9 for ; Fri, 05 Jun 2020 10:37:48 -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; bh=v6Twul2TWinr3wq/OK/PDzXQA1fcuJlgD8ranJI4BbA=; b=EBdON3YYo2xKvrGSBkHyEwTIAXa61zRQoHX8yCulu7uFXilzRYrcVWM9Dj1XeJV2OH dZ2faymKP5rnvE1O1bvGQUH8Qq/QqL89/F/HqqqMNeQ/dO4pJAlUkUG4ovAE90P+R0TF QogqOTUVIcCacRqHeMi5U3VPZ9ym2TkIODq1pCP/CeX9OE8DMY5qc9TIlsovpH6mL4+E JjoLdTMG0ijXuMtbUPf/7ifWt47C4IA2OkPYoNgnBQHxzDLLz89qtYl40dIRxyqFz+hl 4MArs8YLqh89qlM7ouspumwDrNtiqYp6t9QWGprph2ArY/KEqGuMbqDRms579/CpnLFh gw5A== 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; bh=v6Twul2TWinr3wq/OK/PDzXQA1fcuJlgD8ranJI4BbA=; b=fZHtlg/sZlxRe+SItfo2jV3SzOVdn3k33vIX/ShWYNc9VgZe3SdfW7KHbRlaEThBvC gpuZoEK0GGrgKcA9qlp+PZWrRph6gX+9EO0CmlzQaManr6bkHcgKf9E0MzW6WEdXVTo3 Zex1d2134nwhxQHNzuRVmfJzY/KNuttBsQ6XZ1uiYryBV90Vny9sEU1Q6qdA5/1A9LG3 CGBTQ/VJfARHvWu6sKBl1fYF2QTiL0gYnkBBshy/OScXVfrbRGqsVOVMo+BTqx9qGAjV xt/zpeIU9Tg2m6osc14LgqvySnP/10RwhCBdyH2yPdOLMKpLp6pdXL7BPklC6BQI7656 43iA== X-Gm-Message-State: AOAM5326tW9mrFXAewq2PWfMCqjKBK7Bv09PclQdfcsFdoxyTL8Wvnup SYm24c2B5SKN/29kSj8oc8RaPwDYPWbLAA== X-Received: by 2002:a17:902:c3cb:: with SMTP id j11mr2968816plj.171.1591378666868; Fri, 05 Jun 2020 10:37:46 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net (c-73-47-162-176.hsd1.ma.comcast.net. [73.47.162.176]) by smtp.gmail.com with ESMTPSA id a19sm188307pfd.165.2020.06.05.10.37.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 10:37:46 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v2 07/13] translate-all: call qemu_spin_destroy for PageDesc Date: Fri, 5 Jun 2020 13:34:16 -0400 Message-Id: <20200605173422.1490-8-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200605173422.1490-1-robert.foley@linaro.org> References: <20200605173422.1490-1-robert.foley@linaro.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::643; envelope-from=robert.foley@linaro.org; helo=mail-pl1-x643.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: 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" The radix tree is append-only, but we can fail to insert a PageDesc if the insertion races with another thread. Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- accel/tcg/translate-all.c | 9 +++++++++ 1 file changed, 9 insertions(+) -- 2.17.1 Reviewed-by: Alex Bennée diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 3708aab36b..3fb71a1503 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -547,6 +547,15 @@ static PageDesc *page_find_alloc(tb_page_addr_t index, int alloc) #endif existing = atomic_cmpxchg(lp, NULL, pd); if (unlikely(existing)) { +#ifndef CONFIG_USER_ONLY + { + int i; + + for (i = 0; i < V_L2_SIZE; i++) { + qemu_spin_destroy(&pd[i].lock); + } + } +#endif g_free(pd); pd = existing; }