Received: by 10.223.185.116 with SMTP id b49csp755939wrg; Tue, 20 Feb 2018 07:23:10 -0800 (PST) X-Google-Smtp-Source: AH8x226aaidf0NQHRXWoRwIWIW+tQ9rlo08tc+UIy3TGkXpduDVfgqAftE9geARk63Urm1IcCIOy X-Received: by 10.101.93.82 with SMTP id e18mr7166530pgt.371.1519140190386; Tue, 20 Feb 2018 07:23:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519140190; cv=none; d=google.com; s=arc-20160816; b=RyuWNGg9lvklPb8BYuGm+2FoTKrf/udc/YlTn5AmLY6PyMcVJpwER8CHrf4dvjtbNw +j2RT5UpoiyxItXW+H6wWCrsroB/PyKm1u3IqIhduHt8Rh+L/+yOQQ0Z1DNZnzHUpZ7M 8forwl8bSUM6qUsG7PJozGxKbs1XVf5eFG0e9le04r9TbJWudFE6b4xdnda0pe1q72Ts niNoaFADFsm9JossWGjXd0YHb/BjPq3Ehgoqxx4WSkTmGpG8S/7xdAmm+neojjldenjP 4FIX85yS895todsI2afhHJmdx1sV4RuhTcsm4gEFJ2cad5RWOR3xnwgqbTI7I5D4Hcl1 8gJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=cZIKPfK1ObbwCl4n0TJtV6PjWHVFAB1CVOj7pQrwI/M=; b=D/vLvc4nR9a/zPMSuI1x/CwXd98sfFmsAhvDQx/cymDsji3R1xe18mu8mTm+hoDuQL xThqx+z6yhegw3LZDQIrp3GieJDkAwSY24DP4ypUUwExOKcx6H3M/tSAJPTwH9wOGj8T D6TwvAFx99tSTnvnxnFHYdrB2tTtGM2phwonoNyrFMfxCjMgAxdcr3mn6n7bjj2LVEPl fi6kxqMrM9GGKAlH3f0iJQ5BpSMQYIbww9Q/e/ATZeEKcPogFaob9BkKdi08VclhYTDt En/kRoLE503KIc9Sl1AggOfKMwjcP6E7YXGiztXfNKmjQKUEd6u8KIE6bRkuP+2VygmE 2tCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=QIkEEfTA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b10-v6si2470836plz.69.2018.02.20.07.22.55; Tue, 20 Feb 2018 07:23:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=QIkEEfTA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752507AbeBTPWK (ORCPT + 99 others); Tue, 20 Feb 2018 10:22:10 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:50576 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752339AbeBTPWG (ORCPT ); Tue, 20 Feb 2018 10:22:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.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:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=cZIKPfK1ObbwCl4n0TJtV6PjWHVFAB1CVOj7pQrwI/M=; b=QIkEEfTApkYOwsNGH05xNuEugF nqn17noB3aIn/H2L68RUBT8cB6RKPYKAL9wnrrYLRwfSqhZC6cCXGrIRXL8/TS2QOg7EZ+H3qbyXo YRkIvRp0D4KmhrYZ4+0ezjpHNPxwNnt2ir4KAGUhp7JEQUgsibQrjmUcdNiOIpkZrlumhB8Brbm8R 75LfGTfvlhAgC449iFuklI0lQMbTPGm4sas3m98Q8tcfLIrzsNjENJ/kE356OH6bxypKLFv6Tz90t pd5BEwi7QOnbeg/n3rZT0p9LA3olEeApy/2JZeuDkklWV5ckndEk7Uw6UVRkgc8PGwq3TATWLDpda sBtoa7UA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.89 #1 (Red Hat Linux)) id 1eo9k0-0008Tb-0s; Tue, 20 Feb 2018 15:22:00 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 58D402027217D; Tue, 20 Feb 2018 16:21:58 +0100 (CET) Date: Tue, 20 Feb 2018 16:21:58 +0100 From: Peter Zijlstra To: christian.koenig@amd.com Cc: dev@mblankhorst.nl, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/4] locking/ww_mutex: add ww_mutex_is_owned_by function v3 Message-ID: <20180220152158.GH25201@hirez.programming.kicks-ass.net> References: <20180220125829.27060-1-christian.koenig@amd.com> <20180220131253.GF25314@hirez.programming.kicks-ass.net> <8fd80334-4d0e-8ed0-8a09-02a7e36a0eae@gmail.com> <20180220135709.GD25201@hirez.programming.kicks-ass.net> <20180220145413.GF25201@hirez.programming.kicks-ass.net> <2dac8ec9-c54a-7dd1-af4e-62f2bc1a959c@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <2dac8ec9-c54a-7dd1-af4e-62f2bc1a959c@gmail.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 20, 2018 at 04:05:49PM +0100, Christian K?nig wrote: > Am 20.02.2018 um 15:54 schrieb Peter Zijlstra: > > On Tue, Feb 20, 2018 at 03:34:07PM +0100, Christian K?nig wrote: > > > > OK, but neither case would in fact need the !ctx case right? That's just > > > > there for completeness sake? > > > Unfortunately not. TTM uses trylock to lock BOs which are about to be > > > evicted to make room for all the BOs locked with a ctx. > > > > > > I need to be able to distinct between the BOs which are trylocked and those > > > which are locked with a ctx. > > > > > > Writing this I actually noticed the current version is buggy, cause even > > > when we check the mutex owner we still need to make sure that the ctx in the > > > lock is NULL. > > Hurm... I can't remember why trylocks behave like that, and it seems > > rather unfortunate / inconsistent. > > Actually for me that is rather fortunate, cause I need to distinct between > the locks acquired through trylock and lock. I suppose that would always be possible using: ww_mutex_trylock(.ctx=NULL), and it could be that there simply weren't any immediate uses for a !NULL trylock and it was thus not implemented. But that is all very long ago..