Received: by 10.223.185.116 with SMTP id b49csp737953wrg; Tue, 20 Feb 2018 07:06:50 -0800 (PST) X-Google-Smtp-Source: AH8x224WHCsYOab7kLotP2e17XItOYFW4I6lxrKBveIuZAjrQoBliH3MHan+07GcnJlRJcCeIMmJ X-Received: by 2002:a17:902:8484:: with SMTP id c4-v6mr1442934plo.271.1519139209973; Tue, 20 Feb 2018 07:06:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519139209; cv=none; d=google.com; s=arc-20160816; b=HYcfvRcBV3utmIWSlheeGPaltiG6/68x3Gwlk9nCskqfGE/hKv2uP/DvahT0kOZUHO UD9dcpNz+mxrNrrumVeBbnlnwP8HceUTFtza6UjuI8r3bgjWDP6bysXRBaY2q1TWdwNO JHFs4s/7eeovJKpcELXE6uaHUQxgl2Fadtp0vhU3E3coxhf/jMjH26MwgELOK04jyBMn kdteh6iBAqtqx4CaPUdCbzPXOikmLSPVTe1HAi6q/R6G2hzivM4CM4CrDNT9Lai6Skon B5LVfh8Fjr9KuF+XQIYnZzjXV5miB6wyNnC6DEqAOEqQo6E1yiJQB27w9uuT0r3T6qTj TvZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:reply-to:dkim-signature :arc-authentication-results; bh=8cI/joWTfWhhRWkGVm7IyXzkJ2XvoebxVf6Sd+puCqc=; b=QzQ/5zBd0Baalzk2L7iZw3PQImJ9g/qPJo4Yk4VZIyLDZ+wM/SCIZqEVJH+JERlGiv BM83QTK0S4KFBJwKRjy6FIIPKVyoomYZ9XkgunvyufCkjQag5jBPuMbIyG0KNjiTMz7e nvmfV0ubRSZyc/uXFlbu/SzUL8WwTxTf8tbI6r4TbiCgO/4b5/+TzkJRSfI98dkC8cBZ 8TnWkz0zKdyba3AE8JilFmXoaT8UYzTEyMzEeksR52s0EDPYGEanCX+JsfgQWqIbjkOy OWgBheX+ftd9QGb+bgLukJhuEe7rVRQT1oT50bCaSyGs/TSFn0DZ2pyq78+Jaj2nsaRG Y2ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=aUL4p0Pq; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3-v6si7780975pll.585.2018.02.20.07.06.35; Tue, 20 Feb 2018 07:06:49 -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=pass header.i=@gmail.com header.s=20161025 header.b=aUL4p0Pq; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752194AbeBTPFy (ORCPT + 99 others); Tue, 20 Feb 2018 10:05:54 -0500 Received: from mail-wr0-f169.google.com ([209.85.128.169]:44389 "EHLO mail-wr0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751554AbeBTPFw (ORCPT ); Tue, 20 Feb 2018 10:05:52 -0500 Received: by mail-wr0-f169.google.com with SMTP id v65so15268820wrc.11 for ; Tue, 20 Feb 2018 07:05:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=reply-to:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=8cI/joWTfWhhRWkGVm7IyXzkJ2XvoebxVf6Sd+puCqc=; b=aUL4p0PqFbVth6Gs9NeVHSiQgUzaiYb3RWw5Iol8zcIjM7T2RNg0CzlthgunXxwVa2 tDtxnPILl0DX3uNnenEiyhhzIpmHEnlNJj26LC3A4fVyzgYDQbfrwWHOyhgu5bEJQ+We 8ZpYDsk1oweO75sY8PQFVN7svRlvFj0s3+MFSJor3PQ6CLEKFiM8VRZvse4BfyPSU/TJ e6QP2tg+Mfyb2e57d1RUXyhnH2U11P0jhWRcBE8TXXQxFor9Fit76rxxCzaxTjfm998f Hb2rPFjGIaKUNUSJHSB3T67wyJOjLoqnb3DmpzZ8CG6HuJIgsaFxbFbJAvzv1ssb3AzH SgOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:reply-to:subject:to:cc:references:from :message-id:date:user-agent:mime-version:in-reply-to :content-transfer-encoding:content-language; bh=8cI/joWTfWhhRWkGVm7IyXzkJ2XvoebxVf6Sd+puCqc=; b=hSw7OdYUYcYpN2l33BscOBP+c8ojhs/RK9AxIZCOyuFIjhZdM4xWJ/hzuiOt1k20TO Alvre/tEJ6FeS8wkMJ1RfChM3/hlkW/HMA55Ss8VGA8UwmrMjPoy2A9YdoZ4HwGZbk9/ +dnNUkJUT7HUdZT5lwIWsbvdb1Vx6TqMv7r7qZtNrRRpir2gc7S7dLRXJ9clIMGuYwfw zDzfzt8XmfMdzSVyI+HZehZhMnppqAqgtuMHEByYal7GoNieQCxOG7b5qK5ex5t7bMUO 5ZTC/KseLfMRlhokr++Mm2ObINBGHkp34uYCXOdRNnwaLECKCcQMqCcKD053OoC83t7K ghEw== X-Gm-Message-State: APf1xPCEwPDnMRSieQvGyZK7TOoRM39ENrFkGZF0dINL1CaAOfRnQRKc V7R4aHzT31Gb+Y/kqp0d/Zj5lBRN X-Received: by 10.223.172.167 with SMTP id o36mr4307099wrc.34.1519139151337; Tue, 20 Feb 2018 07:05:51 -0800 (PST) Received: from ?IPv6:2a02:908:1251:8fc0:4c6d:7233:b7e1:3b88? ([2a02:908:1251:8fc0:4c6d:7233:b7e1:3b88]) by smtp.gmail.com with ESMTPSA id y23sm15753614wra.9.2018.02.20.07.05.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Feb 2018 07:05:50 -0800 (PST) Reply-To: christian.koenig@amd.com Subject: Re: [PATCH 1/4] locking/ww_mutex: add ww_mutex_is_owned_by function v3 To: Peter Zijlstra , =?UTF-8?Q?Christian_K=c3=b6nig?= Cc: dev@mblankhorst.nl, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org 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> From: =?UTF-8?Q?Christian_K=c3=b6nig?= Message-ID: <2dac8ec9-c54a-7dd1-af4e-62f2bc1a959c@gmail.com> Date: Tue, 20 Feb 2018 16:05:49 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180220145413.GF25201@hirez.programming.kicks-ass.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. In other words when the amdgpu does it's checking if userspace sends nonsense to the kernel it should only get a green signal when the lock was intentionally locked using the context. If the lock was just taken because TTM trylocked it because TTM had to evict the BO to make room then the check should fail and we need to tell userspace that it did something wrong. Regards, Christian. > 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. > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel