Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2645824pxb; Tue, 19 Jan 2021 02:27:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJzTGhmUukk7+6PdCKghdTfvDPYQdTP9NYTyCh/anfIs+H/ppwafVNXoEfdxXx2qrOkQEePd X-Received: by 2002:a17:906:5285:: with SMTP id c5mr2645494ejm.17.1611052057464; Tue, 19 Jan 2021 02:27:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611052057; cv=none; d=google.com; s=arc-20160816; b=s+Ans7q17+lWw4p8bIDHVszoqCNl35y2COE3yctWjIi6Y8bV1Lvivk9oQFzLk5mPwL k1xgniXkkbhgPU44Jn3QwSjfD9z2f0DHeqSRFiSDH/0+0V08mP9mebqZdiKFEcSB+Jwn rtiXZYtcqQnonPJr4mzNcjsH8c8aG/ZbJLju0S/ER2/rdW9peON1aE4Rr2WfK8loOqfR rkcFNBshu1GjSlyzThfmYRA9b4QeZFS1IiEmy2qB1pJphmSODDQ+KUgZVJG6qyzAU5Lm zbVpeCfTMXJuyeZBwNPSEht4BHQaTYExex5RMIU4kJHVixweDErlegZLQlMoe7sU1XoY BY+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=hvDZ+fxryuq539HgDjOUrQrHbe7h9X7Wa0ctGASWN10=; b=ZrZLr25Ye5Glo8pP1iTKNhWg0qayo5bUQG4iBfv7kiIEfXFMmEao5vq6UugoBbBT4W n4qJohSmPuYD+a9QhZ7JxEYdw7JCl1h0+SovbD/YrnPXGLfEQuJhOtGjMk5RYOEm2jcx Nx1bq1TT5gwhGfZOiuPXFRd40wpgxZQsKVbhkDaPaZfSmOIULaBEXzlqWAYskBN30why Y3ZhsTbBzBIeJMI5u4MhHWY10iTjYQxEu9Rcrtp9fuA/mKh88F6lc7/yZPnbHIdorfMg 6TdWlwck+gLLeQaX4BmgxsHFfWcvHD1pmWvBOkoAlZr23ZWKfWeS06wV1s2adSd4LzSV gOow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=OgKqJ+MG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a8si2060100edu.340.2021.01.19.02.27.10; Tue, 19 Jan 2021 02:27:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=OgKqJ+MG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389050AbhASJuw (ORCPT + 99 others); Tue, 19 Jan 2021 04:50:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387645AbhASJgt (ORCPT ); Tue, 19 Jan 2021 04:36:49 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF362C061573 for ; Tue, 19 Jan 2021 01:36:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=hvDZ+fxryuq539HgDjOUrQrHbe7h9X7Wa0ctGASWN10=; b=OgKqJ+MG9z0OBm+QeKncoVH6nk XENt9FT49QZ7pXyt0d/n9FCFplAji+NLya51furZxTzehV6KnCjtX9ae0RtvONsRPkKSt+o9omq+U FqAOa+4lAGL1GK7J5qRWeOv0HSEmmQhb3jSClOJas3LIDEHty4ow3qb7IiLIhAf7oOx6jOc8Uk42y I3J7opZCXmmgirRPi/bx4/lj0qCTKK5BzVCI49Lves81lga7JsIGfXw8D/nw+cSK1pvJrh4vNGpau 26o//HwgrWsjnJfpFQtBxmJY1RfIYA16Ra9tyMh35SuIy3WC6pxRLpjfebbYXgt3c5D6sYUQdzmUf gPDlYEsw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1l1nQN-00E7lm-FO; Tue, 19 Jan 2021 09:35:51 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 84BB7304D28; Tue, 19 Jan 2021 10:35:38 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 392A12023AA22; Tue, 19 Jan 2021 10:35:38 +0100 (CET) Date: Tue, 19 Jan 2021 10:35:38 +0100 From: Peter Zijlstra To: Christian =?iso-8859-1?Q?K=F6nig?= Cc: daniel@ffwll.ch, mingo@redhat.com, will@kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] drm/syncobj: make lockdep complain on WAIT_FOR_SUBMIT v2 Message-ID: References: <20210118180334.43714-1-christian.koenig@amd.com> <20210118180334.43714-2-christian.koenig@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210118180334.43714-2-christian.koenig@amd.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 18, 2021 at 07:03:34PM +0100, Christian K?nig wrote: > diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c > index 6e74e6745eca..f51458615158 100644 > --- a/drivers/gpu/drm/drm_syncobj.c > +++ b/drivers/gpu/drm/drm_syncobj.c > @@ -387,6 +387,13 @@ int drm_syncobj_find_fence(struct drm_file *file_private, > if (!syncobj) > return -ENOENT; > > + /* Waiting for userspace with locks help is illegal cause that can > + * trivial deadlock with page faults for example. Make lockdep complain > + * about it early on. > + */ Egads, the cursed comment style is spreading :/ > + if (flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT) > + lockdep_assert_none_held_once(); > + Should this not be part of drm_syncobj_fence_add_wait() instead? Also, do you want to sprinkle might_sleep() around ? > *fence = drm_syncobj_fence_get(syncobj); > drm_syncobj_put(syncobj); > > diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h