From patchwork Mon Mar 20 15:34:41 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: 95562 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp996666qgd; Mon, 20 Mar 2017 08:35:49 -0700 (PDT) X-Received: by 10.55.167.148 with SMTP id q142mr28117013qke.72.1490024148975; Mon, 20 Mar 2017 08:35:48 -0700 (PDT) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id o41si13167007qtc.216.2017.03.20.08.35.48 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 20 Mar 2017 08:35:48 -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]:33579 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cpzLY-0003uD-BM for patch@linaro.org; Mon, 20 Mar 2017 11:35:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35977) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cpzKA-0003tv-9q for qemu-devel@nongnu.org; Mon, 20 Mar 2017 11:34:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cpzK9-0005pq-E4 for qemu-devel@nongnu.org; Mon, 20 Mar 2017 11:34:22 -0400 Received: from mail-wr0-x229.google.com ([2a00:1450:400c:c0c::229]:33563) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cpzK9-0005nr-8S for qemu-devel@nongnu.org; Mon, 20 Mar 2017 11:34:21 -0400 Received: by mail-wr0-x229.google.com with SMTP id u48so94964172wrc.0 for ; Mon, 20 Mar 2017 08:34:21 -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=gU9N3j+f0IwO9hiXQErQZfyUj2ZzIBMHY6CzCkZYOP8=; b=AuWT699vOxH7aSr/v0CYkz7lTfZEg7OI7AC8b82pCzk4baIe2xyvoLNTfuuoce1g3c ifBr2Q6p5qsbKghVVVCa1H66FGXaIs+knCbtVcus/9KR264krnMMOh+27Pgy2Ibwc6+g Yk7iJCP5kl28d9pS1AmiM7hl2L1ER1bzOg0aU= 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=gU9N3j+f0IwO9hiXQErQZfyUj2ZzIBMHY6CzCkZYOP8=; b=ecapamzZLggK7p1ISNPmi/lvzN3Phl1Qs7iFw2Ln+jIZ3eG7J3I+f0n5RFPVUyXKBM zdmj8Oj4Ww5KgKf6MhfDviW6u4MH8zbobvgpzLVAFYOlgIZRTzjslQDzmC1k04gwGJGw EQ3ZEovppukYtz1iSfjjcZGtylCtG5GQ2huLYFcmzAVJ6qSvGDYaSRE1/Q+cJOQVzN2z qVug9+Kvj5oXGMw1B9W58FCdlvNo5E/iBqnzPnxbunilT+DF7HSeaBQK79yMqFSu0Adz h0bXBZH30XBc5O1EkgNSTb0iKpRlOynUkKX6Ty8nldmoWphX1hvsMoXHopCU2rjiCfKT 1n6A== X-Gm-Message-State: AFeK/H0iqYBRVvPfZ3mOgZbZMzuROP2MpZgUflX0tFv6MT798URcWVrMWjCiiiRh1UC1REBz X-Received: by 10.223.172.135 with SMTP id o7mr24213398wrc.121.1490024060127; Mon, 20 Mar 2017 08:34:20 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id x69sm13902572wma.15.2017.03.20.08.34.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Mar 2017 08:34:18 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id AE18D3E018C; Mon, 20 Mar 2017 15:34:41 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org, rth@twiddle.net, pbonzini@redhat.com Date: Mon, 20 Mar 2017 15:34:41 +0000 Message-Id: <20170320153441.2181-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170320153441.2181-1-alex.bennee@linaro.org> References: <20170320153441.2181-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 v1 3/3] 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 ee5907330f..9182a8ef39 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;