From patchwork Thu Oct 4 13:12:45 2018 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: 10626147 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2F48215A6 for ; Thu, 4 Oct 2018 13:13:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2098C28BB8 for ; Thu, 4 Oct 2018 13:13:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 14DB128BC6; Thu, 4 Oct 2018 13:13:05 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 C24E028BB8 for ; Thu, 4 Oct 2018 13:13:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 588466E259; Thu, 4 Oct 2018 13:12:57 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by gabe.freedesktop.org (Postfix) with ESMTPS id 766836E259; Thu, 4 Oct 2018 13:12:56 +0000 (UTC) Received: by mail-wr1-x444.google.com with SMTP id 63-v6so9852957wra.11; Thu, 04 Oct 2018 06:12:56 -0700 (PDT) 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=FPI34kbboLqqBj8PFjdbunymERKLPHQg1wp8Czq8gqw=; b=ad92KnhU1KIDtoptRtQBWEucBfFWUKpy2ace5x/y6ci3w9JsSmApwpvZP9Aq3DoRju 0QNE79Jjs5DQmOZOIpjWyL+ZpEOCfPFHOn36FGIjUaqE4c15ywhC2XZ2A6ziew88aRk4 5rQ0XRaKtbwcoYesynzNdYay86WoTyTCNdaMGKe2Tzv/hWo2AULPoPKmYkYuabYPQ/PG sq9bvysPQCRfYUS6+c2XkaImuOzpxeuPsLQZG8XQ+fGXROfNuUZsYukzsviJ33XgQB8l fFbR7tuSoGiyq/DeE4TTkEOPg3Dplsv5E8LjkYhhzuoco4M8jgjAPOpXlV4rAQ7S4wqe bwCA== X-Gm-Message-State: ABuFfoi80Alv6ZQz/yyEpkSu7pFqe9z+/kbsP6+xx/7hs/pPPt7tdtgz lYRbopcPIbS+XLRRrF9RlbgVCzp8 X-Google-Smtp-Source: ACcGV60BMuiyWDOIw+Ly3lw9JX49OzYyGIeEoQUGNGaaKe3MWD5KxDSxht0zhuNyoMwKWPdZ1GzvCg== X-Received: by 2002:adf:9dc9:: with SMTP id q9-v6mr4572162wre.12.1538658774712; Thu, 04 Oct 2018 06:12:54 -0700 (PDT) Received: from baker.fritz.box ([2a02:908:1257:4460:2d2f:ac8e:6b85:b5e9]) by smtp.gmail.com with ESMTPSA id b139-v6sm9755457wmd.36.2018.10.04.06.12.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Oct 2018 06:12:53 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH 3/8] dma-buf: test shared slot allocation when mutex debugging is active Date: Thu, 4 Oct 2018 15:12:45 +0200 Message-Id: <20181004131250.2373-3-christian.koenig@amd.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20181004131250.2373-1-christian.koenig@amd.com> References: <20181004131250.2373-1-christian.koenig@amd.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 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 Set shared_max to the number of shared fences right before we release the lock. This way every attempt to add a shared fence without previously reserving a slot will cause an error. Signed-off-by: Christian König --- include/linux/reservation.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/reservation.h b/include/linux/reservation.h index 5ddb0e143721..2f0ffca35780 100644 --- a/include/linux/reservation.h +++ b/include/linux/reservation.h @@ -214,6 +214,11 @@ reservation_object_trylock(struct reservation_object *obj) static inline void reservation_object_unlock(struct reservation_object *obj) { +#ifdef CONFIG_DEBUG_MUTEXES + /* Test shared fence slot reservation */ + if (obj->fence) + obj->fence->shared_max = obj->fence->shared_count; +#endif ww_mutex_unlock(&obj->lock); }