From patchwork Mon Oct 21 22:33:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Herrmann X-Patchwork-Id: 3080281 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DF3F89F2B7 for ; Mon, 21 Oct 2013 23:23:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 165CD20373 for ; Mon, 21 Oct 2013 23:23:58 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 4462820353 for ; Mon, 21 Oct 2013 23:23:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 21352E74CD for ; Mon, 21 Oct 2013 16:23:57 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ea0-f181.google.com (mail-ea0-f181.google.com [209.85.215.181]) by gabe.freedesktop.org (Postfix) with ESMTP id 42BDAE6C39 for ; Mon, 21 Oct 2013 15:33:53 -0700 (PDT) Received: by mail-ea0-f181.google.com with SMTP id d10so3752619eaj.26 for ; Mon, 21 Oct 2013 15:33:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xfDs7wKMT2eaoPwophTM+HvJ2AumlHuEoOqPNGP66YM=; b=qckapI3DzAqOK47Vy9WVlMQYOlRM951Gf+SxVdw4KWVFjCHWvHp1zktQTkigKCVbY7 UZWsVOrtviaksNFFJHcCmAHWPcZMI5XPO7CJMlbrQ5qw8DfkqJ8KLwZUVSj0ha6sUjON Y1kn2nXfmCmjF+Wn4f6wUc6sgv5PWPhbMMWLP3M+Qp9UreoeTHIdaAhypsDtk+yGxCGy w36sIwo7xbX3aWPD90kERoQDnWUhTAYhA8qoqR8E9NEbjENXthAVikzVXodniv+1VNaF bfltvVU1NXrnKEXl/5frVewIXSUfNbzx5R3slH0TYGqr4QqWRKLCSDse2+Hptiwvgyw2 xQRQ== X-Received: by 10.14.214.136 with SMTP id c8mr24914335eep.6.1382394832627; Mon, 21 Oct 2013 15:33:52 -0700 (PDT) Received: from localhost.localdomain (stgt-5f718b64.pool.mediaWays.net. [95.113.139.100]) by mx.google.com with ESMTPSA id e13sm48972229eeu.4.2013.10.21.15.33.51 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Oct 2013 15:33:51 -0700 (PDT) From: David Herrmann To: dri-devel@lists.freedesktop.org Subject: [RFC v2 1/6] percpu_rw_semaphore: export symbols for modules Date: Tue, 22 Oct 2013 00:33:23 +0200 Message-Id: <1382394808-20611-2-git-send-email-dh.herrmann@gmail.com> X-Mailer: git-send-email 1.8.4.1 In-Reply-To: <1382394808-20611-1-git-send-email-dh.herrmann@gmail.com> References: <1382394808-20611-1-git-send-email-dh.herrmann@gmail.com> Cc: linux-kernel@vger.kernel.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP DRM could make great use of percpu-rwsems to track active users and wait for them during hw hotplugging. Export symbols and allow using them in runtime loadable modules. Signed-off-by: David Herrmann --- lib/Makefile | 2 +- lib/percpu-rwsem.c | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/Makefile b/lib/Makefile index f3bb2cb..c1572be 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -45,7 +45,7 @@ obj-$(CONFIG_DEBUG_LOCKING_API_SELFTESTS) += locking-selftest.o obj-$(CONFIG_DEBUG_SPINLOCK) += spinlock_debug.o lib-$(CONFIG_RWSEM_GENERIC_SPINLOCK) += rwsem-spinlock.o lib-$(CONFIG_RWSEM_XCHGADD_ALGORITHM) += rwsem.o -lib-$(CONFIG_PERCPU_RWSEM) += percpu-rwsem.o +obj-$(CONFIG_PERCPU_RWSEM) += percpu-rwsem.o CFLAGS_hweight.o = $(subst $(quote),,$(CONFIG_ARCH_HWEIGHT_CFLAGS)) obj-$(CONFIG_GENERIC_HWEIGHT) += hweight.o diff --git a/lib/percpu-rwsem.c b/lib/percpu-rwsem.c index 652a8ee..893586c 100644 --- a/lib/percpu-rwsem.c +++ b/lib/percpu-rwsem.c @@ -7,6 +7,7 @@ #include #include #include +#include int __percpu_init_rwsem(struct percpu_rw_semaphore *brw, const char *name, struct lock_class_key *rwsem_key) @@ -22,12 +23,14 @@ int __percpu_init_rwsem(struct percpu_rw_semaphore *brw, init_waitqueue_head(&brw->write_waitq); return 0; } +EXPORT_SYMBOL(__percpu_init_rwsem); void percpu_free_rwsem(struct percpu_rw_semaphore *brw) { free_percpu(brw->fast_read_ctr); brw->fast_read_ctr = NULL; /* catch use after free bugs */ } +EXPORT_SYMBOL(percpu_free_rwsem); /* * This is the fast-path for down_read/up_read, it only needs to ensure @@ -87,6 +90,7 @@ void percpu_down_read(struct percpu_rw_semaphore *brw) /* avoid up_read()->rwsem_release() */ __up_read(&brw->rw_sem); } +EXPORT_SYMBOL(percpu_down_read); void percpu_up_read(struct percpu_rw_semaphore *brw) { @@ -99,6 +103,7 @@ void percpu_up_read(struct percpu_rw_semaphore *brw) if (atomic_dec_and_test(&brw->slow_read_ctr)) wake_up_all(&brw->write_waitq); } +EXPORT_SYMBOL(percpu_up_read); static int clear_fast_ctr(struct percpu_rw_semaphore *brw) { @@ -150,6 +155,7 @@ void percpu_down_write(struct percpu_rw_semaphore *brw) /* wait for all readers to complete their percpu_up_read() */ wait_event(brw->write_waitq, !atomic_read(&brw->slow_read_ctr)); } +EXPORT_SYMBOL(percpu_down_write); void percpu_up_write(struct percpu_rw_semaphore *brw) { @@ -163,3 +169,4 @@ void percpu_up_write(struct percpu_rw_semaphore *brw) /* the last writer unblocks update_fast_ctr() */ atomic_dec(&brw->write_ctr); } +EXPORT_SYMBOL(percpu_up_write);