From patchwork Thu Nov 9 08:59:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_K=C3=B6nig?= X-Patchwork-Id: 10050515 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D502060381 for ; Thu, 9 Nov 2017 08:59:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C4F112ABF3 for ; Thu, 9 Nov 2017 08:59:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B8BD32ABF6; Thu, 9 Nov 2017 08:59:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 84CDC2ABF3 for ; Thu, 9 Nov 2017 08:59:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A8C616E87E; Thu, 9 Nov 2017 08:59:19 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr0-x244.google.com (mail-wr0-x244.google.com [IPv6:2a00:1450:400c:c0c::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id F1BB16E87F; Thu, 9 Nov 2017 08:59:17 +0000 (UTC) Received: by mail-wr0-x244.google.com with SMTP id l8so4854112wre.12; Thu, 09 Nov 2017 00:59:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=1/jvwe8xvHksBGTwMV+ziZs6IUbP/oLiWVOT70LZeE4=; b=hARJT4jMF4RWxmvmpk9KGS9DNYj3wfjisrC+TXft3zcNvy3mM5Z+mgMjqx2ATpfsUt X4zW3UFEsbQgiYRbx0uP4yYYmHW44n/O1L9Md2/hRI+zc9bnOjjvQtpd3OSploW3T5Wk wQR8tJmf03ruMi6lvTFp8ocu6jYsfMcvqM+M6jPpOLVOlTaiMpWqMamu92eX+u8WtJub r+pGgVmUsDJwbMMmNGOBJy+jKsoI2io9Lk+1xaRHiWjx2T6q/eGSnN5J2vCujiVDshXm q4e7i9+LgeLZwhQmiE1kTjynY14nXzy6RVD+hZLEV8Lm/Lpy0uEdA3gX7Pj1wj4/UNqO HaXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1/jvwe8xvHksBGTwMV+ziZs6IUbP/oLiWVOT70LZeE4=; b=Vt5gM7knrf0yBFa8BTp+ybq0bRlQgIOWPB17QCqLXB9YUvM680uSsIjAJNdnNGWI87 mZBzqAuHv7A46eYX66UKZ/asp5oWdWj5Rp0iiA6s1VmoflPn45YhRS2vsDf56fyM9FyZ J3+j0quzbFP0xx8rjlIc5Mpl5BR/cGEIUwv+Lyp+LmVN8+yhhJe+lPPiLtXPH0zVRFBB Hm3LfoBVUfJit2FQy7qokst14UKql4pXdOKHpMGbwsNv+SsuedjGr7s0wXYGSbUFvnoF Qd5vJUpQi1GHtQxvytaYOc6SAJhtgjoeHQ2PPId70pVrVkNcu6ioAIMUBx9rKjOlf9cy +mAQ== X-Gm-Message-State: AJaThX7lBEc0N1Kjcyu11i5cHiHdqOfl0qT6BkKhLQ/blTJ9i1A3dx/H oRP/BlG9QoHcAEmNAb1YNKAUGA== X-Google-Smtp-Source: ABhQp+RtD3Yr7zkkIXPRv+6dYt0Hj0j9+01LihGGiLmqAd02+Rcj+dZbDpvGiL/OZ5Yxt9CmHXZSAA== X-Received: by 10.223.164.206 with SMTP id h14mr2577189wrb.25.1510217956198; Thu, 09 Nov 2017 00:59:16 -0800 (PST) Received: from localhost.localdomain ([2a02:908:1251:7981:61f0:1658:ce3b:16a3]) by smtp.gmail.com with ESMTPSA id 69sm8893723wmp.37.2017.11.09.00.59.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Nov 2017 00:59:15 -0800 (PST) From: "=?UTF-8?q?Christian=20K=C3=B6nig?=" X-Google-Original-From: =?UTF-8?q?Christian=20K=C3=B6nig?= To: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Hongbo.He@amd.com, michel@daenzer.net Subject: [PATCH 3/7] dma-buf: add reservation_object_lock_interruptible() Date: Thu, 9 Nov 2017 09:59:05 +0100 Message-Id: <20171109085909.1653-3-christian.koenig@amd.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171109085909.1653-1-christian.koenig@amd.com> References: <20171109085909.1653-1-christian.koenig@amd.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP That's the only wrapper function missing and necessary to cleanup TTM. Signed-off-by: Christian König --- include/linux/reservation.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/include/linux/reservation.h b/include/linux/reservation.h index 21fc84d82d41..02166e815afb 100644 --- a/include/linux/reservation.h +++ b/include/linux/reservation.h @@ -167,6 +167,29 @@ reservation_object_lock(struct reservation_object *obj, } /** + * reservation_object_lock_interruptible - lock the reservation object + * @obj: the reservation object + * @ctx: the locking context + * + * Locks the reservation object interruptible for exclusive access and + * modification. Note, that the lock is only against other writers, readers + * will run concurrently with a writer under RCU. The seqlock is used to + * notify readers if they overlap with a writer. + * + * As the reservation object may be locked by multiple parties in an + * undefined order, a #ww_acquire_ctx is passed to unwind if a cycle + * is detected. See ww_mutex_lock() and ww_acquire_init(). A reservation + * object may be locked by itself by passing NULL as @ctx. + */ +static inline int +reservation_object_lock_interruptible(struct reservation_object *obj, + struct ww_acquire_ctx *ctx) +{ + return ww_mutex_lock_interruptible(&obj->lock, ctx); +} + + +/** * reservation_object_trylock - trylock the reservation object * @obj: the reservation object *