From patchwork Tue Mar 28 11:09:32 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: 96138 Delivered-To: patch@linaro.org Received: by 10.182.246.10 with SMTP id xs10csp266925obc; Tue, 28 Mar 2017 04:10:09 -0700 (PDT) X-Received: by 10.55.164.151 with SMTP id n145mr14653885qke.202.1490699409008; Tue, 28 Mar 2017 04:10:09 -0700 (PDT) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id s29si3147678qks.309.2017.03.28.04.10.08 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 28 Mar 2017 04:10:08 -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]:52410 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1csp0q-0004Jb-A7 for patch@linaro.org; Tue, 28 Mar 2017 07:10:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48420) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1csp0S-0004Gz-4K 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 1csp0O-000378-S1 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]:34507) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1csp0O-00035a-Ko for qemu-devel@nongnu.org; Tue, 28 Mar 2017 07:09:40 -0400 Received: by mail-wr0-x22c.google.com with SMTP id l43so98993064wre.1 for ; Tue, 28 Mar 2017 04:09:40 -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=BhWN+GJg6vfhONv8167YrJB0RZpP0V7q5wYdDw1Y4cU=; b=JuOXkvWYMyLYNH/bBRroreZRXhgIg3a5/7evLLi1EDUrpTBRh/mScgV1O4bUD1hlI0 GDOUhB1gLHPIjuav9G7/oTHnUKj5VG92D5DRlBs9/Ox2DDwCs+W+0F3Fxmo9TSonD6Kw Yn5Dcp8VQ8rDTIYdT91PgeCpGNe8f87Faad6c= 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=BhWN+GJg6vfhONv8167YrJB0RZpP0V7q5wYdDw1Y4cU=; b=Ge4YY4OyLfVtlZkns1miyZZPez7tQIjdsycqOAal2O792xeB5mChoT67D+/fvw0LPp fjID+IyaT2a0m/h623lxf8QljixP+KGWseKJPkrK1VP1OT/n7oeBjykApNKYOd6C635Y TtvFcU2ilKNvFhnSQED865g2wyGHYWCbUClITNek9zLr0RJGx/V+d4z2lIgsDHAKqkcQ 3wSjIotlw8Gea5XuIBOxbZfGgHkui3KQjIs5Bb+bFlWS+WgsIirNVlZAeFHobhNSm1MD 9iMSZqRZZ7jRAzvCwdnHI4fYPio9buByMZKJKP7UEqueBYsGeDspRElxxeEEyE6BoLtA iL2g== X-Gm-Message-State: AFeK/H2vgTJchArODuZNThnOqichtFSjOehvpGqdN/pqiaDLuv1Xu0JqzIT1YJSqg4sD7BLC X-Received: by 10.28.37.3 with SMTP id l3mr14004639wml.100.1490699379473; Tue, 28 Mar 2017 04:09:39 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id u145sm3187822wmu.1.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 705A63E058D; 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:32 +0100 Message-Id: <20170328110936.24806-3-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 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: =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org 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 Reviewed-by: Paolo Bonzini --- 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;