From patchwork Tue Mar 28 08:36:19 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: 96122 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp1602884qgd; Tue, 28 Mar 2017 01:43:02 -0700 (PDT) X-Received: by 10.55.118.129 with SMTP id r123mr23253565qkc.151.1490690582203; Tue, 28 Mar 2017 01:43:02 -0700 (PDT) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 11si2920244qkg.149.2017.03.28.01.43.02 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 28 Mar 2017 01:43:02 -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]:51594 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1csmiT-00047P-SW for patch@linaro.org; Tue, 28 Mar 2017 04:43:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34167) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1csmc9-0008GP-9k for qemu-devel@nongnu.org; Tue, 28 Mar 2017 04:36:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1csmc8-00015L-GM for qemu-devel@nongnu.org; Tue, 28 Mar 2017 04:36:29 -0400 Received: from mail-wr0-x229.google.com ([2a00:1450:400c:c0c::229]:33595) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1csmc8-00014P-B9 for qemu-devel@nongnu.org; Tue, 28 Mar 2017 04:36:28 -0400 Received: by mail-wr0-x229.google.com with SMTP id w43so79528598wrb.0 for ; Tue, 28 Mar 2017 01:36:28 -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=k0LCM6/jBI8p+CjBFMpPRBkk39PeRiGE10e5oOJcXAM=; b=jjMrD8+Np8zWCdfTVi6t2uQDFSxIGzlF3G8nmpvCzyhFvFG8lvwVqj5M/bJ361R9XL 0a4vPKL8VYJFtUn9UH+pQx0kq1+lo1R6lg8qfZyfzbKOID86z8C57B7ZulaXiK8+ewEA wb7RxdSQzuwdn5loFldLAH9HSrfv9bCT7AcDk= 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=k0LCM6/jBI8p+CjBFMpPRBkk39PeRiGE10e5oOJcXAM=; b=rYE9WV4atVhMHE3dfvxJHIVeRWukgodj9toLc2LKHAo70pVR5nL7Z3FcDt01PrjVD4 nZpwS+Qx0HDg/YTcRyC899ke3KjdYbMSwEzYRuLnkb5EzUJvd6BqKudP6Cbot/kp1XKB hbzHnNOrq7olKyat/jRvf29bE12w1IxP2HNZo5gSfrPN3bxesfTgb4QP6HV71DAhsqMK 13MPmvBupTkDcMy5dvYA6VjFWfSlkTXpfsZP2YcjNoxthJ38f6EZ/TI1d+LneNEIZnsa 8ODvuLdlnKU50+svtMfgwQoWWTYcWSNyJ6R77jEh0/gzOTbnNsSqUN/9vtuEXLdeNiAQ 7jaw== X-Gm-Message-State: AFeK/H0QOOQjDcudWErsijI+elD6egKFpJkWez198EbD5x37P+O0a68LoC0BZ5KenDkWfJ/0 X-Received: by 10.28.20.70 with SMTP id 67mr13584522wmu.86.1490690186283; Tue, 28 Mar 2017 01:36:26 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id b82sm2639971wmh.4.2017.03.28.01.36.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Mar 2017 01:36:24 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 50B313E058D; Tue, 28 Mar 2017 09:36:23 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org, rth@twiddle.net, pbonzini@redhat.com, kraxel@redhat.com Date: Tue, 28 Mar 2017 09:36:19 +0100 Message-Id: <20170328083623.10396-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170328083623.10396-1-alex.bennee@linaro.org> References: <20170328083623.10396-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::229 Subject: [Qemu-devel] [PATCH v2 2/6] bsd-user: align use of mmap_lock to that of linux-user 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: mttcg@listserver.greensocs.com, nikunj@linux.vnet.ibm.com, a.rigo@virtualopensystems.com, qemu-devel@nongnu.org, cota@braap.org, bobby.prani@gmail.com, =?utf-8?q?Alex_Benn=C3=A9e?= , fred.konrad@greensocs.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The introduction of stricter mmap_lock checking in translate-all broke the BSD user build. The working mmap_lock functions were hidden behind CONFIG_USE_NPTL which is never defined. This patch brings them inline with linux-user. Despite the disapearence of the comment "We aren't threadsafe to start with..." this doesn't make bsd-user so. It will still need the rest of the fixes that have been done in linux-user ported over. Signed-off-by: Alex Bennée --- bsd-user/mmap.c | 13 +------------ bsd-user/qemu.h | 2 -- 2 files changed, 1 insertion(+), 14 deletions(-) -- 2.11.0 diff --git a/bsd-user/mmap.c b/bsd-user/mmap.c index 1ad018a127..7f2018ede0 100644 --- a/bsd-user/mmap.c +++ b/bsd-user/mmap.c @@ -24,8 +24,7 @@ //#define DEBUG_MMAP -#if defined(CONFIG_USE_NPTL) -pthread_mutex_t mmap_mutex; +static pthread_mutex_t mmap_mutex = PTHREAD_MUTEX_INITIALIZER; static int __thread mmap_lock_count; void mmap_lock(void) @@ -62,16 +61,6 @@ void mmap_fork_end(int child) else pthread_mutex_unlock(&mmap_mutex); } -#else -/* We aren't threadsafe to start with, so no need to worry about locking. */ -void mmap_lock(void) -{ -} - -void mmap_unlock(void) -{ -} -#endif /* NOTE: all the constants are the HOST ones, but addresses are target. */ int target_mprotect(abi_ulong start, abi_ulong len, int prot) diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h index 2b2b9184e0..b550cee0cb 100644 --- a/bsd-user/qemu.h +++ b/bsd-user/qemu.h @@ -209,10 +209,8 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size, abi_ulong new_addr); int target_msync(abi_ulong start, abi_ulong len, int flags); extern unsigned long last_brk; -#if defined(CONFIG_USE_NPTL) void mmap_fork_start(void); void mmap_fork_end(int child); -#endif /* main.c */ extern unsigned long x86_stack_size;