Received: by 10.223.185.116 with SMTP id b49csp723943wrg; Tue, 20 Feb 2018 06:55:21 -0800 (PST) X-Google-Smtp-Source: AH8x227YlZ4CbwzcUqp/Z9AGlpfWOUbM7HQPHLth/eb9ZPzWtrBFbyUOchXnfL8/klmvCWbTsnGm X-Received: by 10.99.107.200 with SMTP id g191mr15100934pgc.165.1519138521331; Tue, 20 Feb 2018 06:55:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519138521; cv=none; d=google.com; s=arc-20160816; b=O6859ZwEVCkcvBQoIJttkytP6iDMyDxYY8Il9X6YjoGshWrhd+JELh37poDviwLLKV qWnM3QvG8Smj2FWMaKpahF48NAisY7O2a4PjKBS1LmYzEZu057/f8teKOZ0RmPGLhQ4n I82mzZPRmgwLL697OkK7FNKozxTvdOzuK9KXII2c4Mxd8HvXVzWVSuPsr6NZ0N8AWEIt W/Gauv5UV5icK92fiDFpqDZjX8IacPtFbNWO4hF4KHkaeSdclovCJXao35vjYIkE7Qw8 mWEw6QBeLlmFJn7FKZJXpZC/EMuEEkNVFCU/7ZrwyWLbN1bbgggclfpJpL87u4yo/o7Y V1ow== 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=2wKMqk01RWOrxM/ZpNoEsBNE3PlR9BpK15BcicwUAlI=; b=D9H1Z812CVf9C4YIGRng9Yb9cTJlIduggHx4nZM7NU8n/32WEmSNdl7TPJi/sqdlTz Zvk47HCZBYvAHRQ5p5s4EzXi/P2wLU+h9ToEhT0SIVwjNdQfg+Riz1F3UKZCdFnG/SJV RSut53PkvDlx92T9RP+Wlq/Rod8fMG1RdKtb6JYhHl0ydPTli7zMWd8qoK3HEaQHVtEa ZkQMDn+o7RRsVY2hU+pKKvcTjl0mt+VZjwSQM97vlnJPjxw+BxZZEfsO4s4LM9fIPtGf ekjyyYSvv7lLlp30NlvrkYutXYgmrydZ1K7x7pM+x38obiS9fLaiCyRyzMyWM7NMyE69 QmXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=n+xMcvFZ; 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 s11-v6si5527193plj.701.2018.02.20.06.55.06; Tue, 20 Feb 2018 06:55:21 -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=merlin.20170209 header.b=n+xMcvFZ; 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 S1751806AbeBTOyZ (ORCPT + 99 others); Tue, 20 Feb 2018 09:54:25 -0500 Received: from merlin.infradead.org ([205.233.59.134]:56290 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751000AbeBTOyY (ORCPT ); Tue, 20 Feb 2018 09:54:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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=2wKMqk01RWOrxM/ZpNoEsBNE3PlR9BpK15BcicwUAlI=; b=n+xMcvFZPF2meh4Q5Y5kbre3VT AQ64v8/HQJ3KJINWWSTcJ3XNLSWkvKjkRCsYGv6lHUFVscdEHs7k5iDu2didUu7WFjVwfX/LVqicL 7W6WD7vAD8ZHdesQv4eeHKzFsm0kpS1svHI95Z+kWNAZeEyFSWiTwFooO6e5WPg6YlnIDRe+uYEA2 m1TnWOT1nOYReEZDNLg237n7FAHHPBbHyd/RqvcJqbhep5EYv6LnlAnuPptuzbp/K3LMtn0QkS9kM 28ka9UYyiPgiovMOQYF9t0MZZU2vcxlYTF7QzzhbtJpoUBC31hGqumlirMzPBnvd3amkPgSfEjXYi nNkpGERw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.89 #1 (Red Hat Linux)) id 1eo9J8-0000EV-Q7; Tue, 20 Feb 2018 14:54:14 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 517D7203895C6; Tue, 20 Feb 2018 15:54:13 +0100 (CET) Date: Tue, 20 Feb 2018 15:54:13 +0100 From: Peter Zijlstra To: Christian =?iso-8859-1?Q?K=F6nig?= Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, dev@mblankhorst.nl, chris@chris-wilson.co.uk Subject: Re: [PATCH 1/4] locking/ww_mutex: add ww_mutex_is_owned_by function v3 Message-ID: <20180220145413.GF25201@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> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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 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. Chris, Maarten, do either one of you remember? I'm thinking that if we do acquire the trylock, the thing should join the ctx such that a subsequent contending mutex_lock() can ww right.