From patchwork Mon Dec 10 17:05:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Maximets X-Patchwork-Id: 1010533 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=samsung.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=samsung.com header.i=@samsung.com header.b="R1cIk7dA"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43D8dv4392z9s3Z for ; Tue, 11 Dec 2018 04:07:47 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id CE966C86; Mon, 10 Dec 2018 17:05:48 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 8CF51C83 for ; Mon, 10 Dec 2018 17:05:47 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 1C7DC84D for ; Mon, 10 Dec 2018 17:05:47 +0000 (UTC) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20181210170545euoutp021b289f1419f6b2d0c11a9d01187889df~vB5fRIrD31394713947euoutp02W for ; Mon, 10 Dec 2018 17:05:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20181210170545euoutp021b289f1419f6b2d0c11a9d01187889df~vB5fRIrD31394713947euoutp02W DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1544461545; bh=dbSbfsHKVdJ1AVvVtnXLVfy4PCYoAA+NRHEAwUYU9I8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R1cIk7dAxJzMbT7DdsXZiBLhbrBrJPS60FStHYHQiq5b1zutAIuywCE2ym+phCqm3 6b6ZN13SZsbZvFRyKRW+CUpZ1JfnaEkYXX/rN3f9eX2SfGV3Y5kfgGxvu2np7CGtAg E2awa5K1s/lL9hZ8HjgMwb5DsGVKX0zp0LVlIxVo= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20181210170545eucas1p2963de72d77725b9b018b4b0ca7a26e2e~vB5eiS6lb1589015890eucas1p2g; Mon, 10 Dec 2018 17:05:45 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id C1.7C.04806.8EC9E0C5; Mon, 10 Dec 2018 17:05:44 +0000 (GMT) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20181210170543eucas1p2000b196af3c5dfe321c947c326fc2e7f~vB5dNZgR11589515895eucas1p2h; Mon, 10 Dec 2018 17:05:43 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20181210170543eusmtrp2c1ac744bc0d3ac9be4a314be68eb30d4~vB5c-Kn9h1418314183eusmtrp2T; Mon, 10 Dec 2018 17:05:43 +0000 (GMT) X-AuditID: cbfec7f5-34dff700000012c6-fd-5c0e9ce88c5e Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 28.73.04128.7EC9E0C5; Mon, 10 Dec 2018 17:05:43 +0000 (GMT) Received: from imaximets.rnd.samsung.ru (unknown [106.109.129.180]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20181210170543eusmtip26adf8c92e3e5133ccdadf74089d3b855~vB5csBr1m2710727107eusmtip2D; Mon, 10 Dec 2018 17:05:43 +0000 (GMT) From: Ilya Maximets To: ovs-dev@openvswitch.org Date: Mon, 10 Dec 2018 20:05:23 +0300 Message-Id: <20181210170523.2279-5-i.maximets@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181210170523.2279-1-i.maximets@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrNIsWRmVeSWpSXmKPExsWy7djPc7ov5vDFGMzYp2vxanIDo8WV9p/s FnM/PWd0YPZ4dvM/o8fzaz0sHn1bVjEGMEdx2aSk5mSWpRbp2yVwZTz5u5614BVPxfVTaxgb GM9wdTFycEgImEgs+hjXxcjFISSwglFi96QGNgjnC6PE6xVLWCGcz4wSF89OZoXpeD/dsYuR Eyi+nFFi1XE5CPsHo0TLP2cQm01AR+LU6iOMILaIgLTE6943rCA2s4CzxLaLM8DiwgLeEn1d m9lAbBYBVYkr256A2bwCVhKf130Bq5EQkJdYveEAM4jNKWAtsXvFf7DjJASOsEl8mHuXCaLI ReLn1ttQtrDEq+Nb2CFsGYn/O+dDxesl7re8ZIRo7mCUmH7oH1TCXmLL63PsII8xC2hKrN+l DxF2lOhYBnIQyL98EjfeCkLczycxadt0Zogwr0RHmxBEtYrE74PLmSFsKYmb7z5DXeAhserO RBZIEPYxShx7cZ1pAqP8LIRlCxgZVzGKp5YW56anFhvnpZbrFSfmFpfmpesl5+duYgRG+el/ x7/uYNz3J+kQowAHoxIPr0ILX4wQa2JZcWXuIUYJDmYlEV7dNN4YId6UxMqq1KL8+KLS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000b196af3c5dfe321c947c326fc2e7f X-Msg-Generator: CA X-RootMTR: 20181210170543eucas1p2000b196af3c5dfe321c947c326fc2e7f X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181210170543eucas1p2000b196af3c5dfe321c947c326fc2e7f References: <20181210170523.2279-1-i.maximets@samsung.com> X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Ilya Maximets Subject: [ovs-dev] [PATCH 4/4] ovs-thread: Add thread safety annotation to cond_wait. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org This fixes build with clang on FreeBSD: lib/ovs-thread.c:266:13: error: calling function 'pthread_cond_wait' requires holding mutex \ 'mutex->lock' exclusively [-Werror,-Wthread-safety-analysis] error = pthread_cond_wait(cond, &mutex->lock); ^ Fixes: 97be153858b4 ("clang: Add annotations for thread safety check.") Signed-off-by: Ilya Maximets --- include/openvswitch/thread.h | 3 ++- lib/ovs-thread.c | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/openvswitch/thread.h b/include/openvswitch/thread.h index 5ffc29067..2987db37c 100644 --- a/include/openvswitch/thread.h +++ b/include/openvswitch/thread.h @@ -68,7 +68,8 @@ int ovs_mutex_trylock_at(const struct ovs_mutex *mutex, const char *where) #define ovs_mutex_trylock(mutex) \ ovs_mutex_trylock_at(mutex, OVS_SOURCE_LOCATOR) -void ovs_mutex_cond_wait(pthread_cond_t *, const struct ovs_mutex *); +void ovs_mutex_cond_wait(pthread_cond_t *, const struct ovs_mutex *mutex) + OVS_REQUIRES(mutex); /* Convenient once-only execution. * diff --git a/lib/ovs-thread.c b/lib/ovs-thread.c index b5f7424b7..c8d92bc1b 100644 --- a/lib/ovs-thread.c +++ b/lib/ovs-thread.c @@ -257,6 +257,7 @@ ovs_rwlock_init(const struct ovs_rwlock *l_) * call with calls to ovsrcu_quiesce_start() and ovsrcu_quiesce_end(). */ void ovs_mutex_cond_wait(pthread_cond_t *cond, const struct ovs_mutex *mutex_) + OVS_NO_THREAD_SAFETY_ANALYSIS { struct ovs_mutex *mutex = CONST_CAST(struct ovs_mutex *, mutex_); int error;