Received: by 10.223.164.202 with SMTP id h10csp4391820wrb; Wed, 29 Nov 2017 05:46:48 -0800 (PST) X-Google-Smtp-Source: AGs4zMYP3yYJGqQwHqeK9oMYD5A8UjXt+iUO0XJvkW2tEyaATSIA2GvanJzf1Iw88erzaJhT5ofj X-Received: by 10.99.97.23 with SMTP id v23mr2930780pgb.210.1511963208236; Wed, 29 Nov 2017 05:46:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511963208; cv=none; d=google.com; s=arc-20160816; b=GDeounKvBD4ogiUVzOTgMoeKZdoSxRQFkPBc4fhXLWDEr+UNiU9zxCwoOdf/nnaIs4 DdZj58EraOtnkN4rhUsWMUrr6PreYONteXN+7XvYpaxOPYDTEFrIJ77Fq3cx5BabWECt uzEI5g0fz7HTlWE3bPTbTQAToA5/lHyV8Xr2leH3Uuh8RvpFX1IaAwGZor4xeXiXDENk IffU6BTpROFgBcuM+X9bVD6EElFHsayeFIs9Ce9ZOX9/t3gim3VUgPhVvYgaPaB30//K gDIVgkNEzpyp3Luu8HUsRorm/bAirHb3gtG8H7W1ZmqxcvAaMNAeo4f05ga8lBiKK+22 2cyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject:dkim-signature:arc-authentication-results; bh=n0Z+jJd7Tgm4wADJG9n5EXP8tP36XgghsFLqNptIsyA=; b=YSuZmF5uq5pFDSqlvz58pEz6yIz5Y9EjQIjlNkjtJPtBiDUWN8nXnAkeatDFNWIDZY MJ3MRLNqMWr80VbCKllvMayG92ZvoZsIvuQgbY7zeclxJZIYyglt+otgC+AyNvvirxKR aGXi/G7uVcfXJY6JTtmmj2mJZpfE+81EsozZB1WBDu7/2mtm4QukS4X+hFuJrcwrTeEG BfDq7obW0HaXbWOm4sQ6LzvMIw2/nVgtNi0dHLtF4i43kloHf2d+cjj1OZvbyc6blYGe qpC8oe6iHaEe0Eu1zwtcO1XDrVmzp7zS6QsFSsx5QPe92GDxRt4UvBcU1IJlqHgEQEuD DD1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kapsi.fi header.s=20161220 header.b=TEYyldCt; 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 m23si1296767pgc.165.2017.11.29.05.46.38; Wed, 29 Nov 2017 05:46:48 -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=@kapsi.fi header.s=20161220 header.b=TEYyldCt; 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 S1754686AbdK2MZV (ORCPT + 70 others); Wed, 29 Nov 2017 07:25:21 -0500 Received: from mail.kapsi.fi ([91.232.154.25]:37009 "EHLO mail.kapsi.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751673AbdK2MZT (ORCPT ); Wed, 29 Nov 2017 07:25:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kapsi.fi; s=20161220; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From:Cc:References:To:Subject; bh=n0Z+jJd7Tgm4wADJG9n5EXP8tP36XgghsFLqNptIsyA=; b=TEYyldCtwGFCFrKs8FRvTROs9xmwMVsU+iITcKvhSiFjin/avHjnmNle5+jGDkQPG76lT3p7KGJ7BskbvaQY+ek0KjdpQY5y4Q/cXIm0OO8ZENc48sge8DWgMNVpoXKhCJ5Lc0ZM68PKgrzdbw7aeELBgEocNM4Be6QUW/G/7BmgRVdAwzPopXW1LG4l7V/G2QMh7NWD7DaUirXnn1k3O0MR2RupjMrNOF3PDyCq0T/REBsyNAZL24nVhDYCCV0v6DLticr+cHb8KoGXfZugLmJKSrlkuHXooETBgA8VusIWyuGp1iGpXIhXj9ZXUc5f0iPxN3n1N0sirU7IOrU0bg==; Received: from [62.209.167.43] (helo=[10.21.26.144]) by mail.kapsi.fi with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1eK1QT-0003qs-TI; Wed, 29 Nov 2017 14:25:17 +0200 Subject: Re: [PATCH 10/10] gpu: host1x: Optionally block when acquiring channel To: Dmitry Osipenko , Mikko Perttunen , thierry.reding@gmail.com, jonathanh@nvidia.com References: <20171105110118.15142-1-mperttunen@nvidia.com> <20171105110118.15142-11-mperttunen@nvidia.com> <9c5676eb-ba6f-c187-29e4-7b331bd3962f@gmail.com> <38340901-7016-3444-5ace-64159b32f1c7@kapsi.fi> <1b35ec93-167b-3436-0ff2-5e2e0886aea7@gmail.com> <775a2536-b225-2d96-3954-7efab6bc5c3e@gmail.com> <794b713e-e4f9-0b71-d9eb-168d002ab6a2@kapsi.fi> <07e28b40-dd2b-774f-2d07-3b5d6cf08c46@gmail.com> Cc: dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org From: Mikko Perttunen Message-ID: Date: Wed, 29 Nov 2017 14:25:17 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <07e28b40-dd2b-774f-2d07-3b5d6cf08c46@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 62.209.167.43 X-SA-Exim-Mail-From: cyndis@kapsi.fi X-SA-Exim-Scanned: No (on mail.kapsi.fi); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 29.11.2017 14:18, Dmitry Osipenko wrote: > On 29.11.2017 12:10, Mikko Perttunen wrote: >> On 12.11.2017 13:23, Dmitry Osipenko wrote: >>> On 11.11.2017 00:15, Dmitry Osipenko wrote: >>>> On 07.11.2017 18:29, Dmitry Osipenko wrote: >>>>> On 07.11.2017 16:11, Mikko Perttunen wrote: >>>>>> On 05.11.2017 19:14, Dmitry Osipenko wrote: >>>>>>> On 05.11.2017 14:01, Mikko Perttunen wrote: >>>>>>>> Add an option to host1x_channel_request to interruptibly wait for a >>>>>>>> free channel. This allows IOCTLs that acquire a channel to block >>>>>>>> the userspace. >>>>>>>> >>>>>>> >>>>>>> Wouldn't it be more optimal to request channel and block after job's pining, >>>>>>> when all patching and checks are completed? Note that right now we have >>>>>>> locking >>>>>>> around submission in DRM, which I suppose should go away by making locking >>>>>>> fine >>>>>>> grained. >>>>>> >>>>>> That would be possible, but I don't think it should matter much since >>>>>> contention >>>>>> here should not be the common case. >>>>>> >>>>>>> >>>>>>> Or maybe it would be more optimal to just iterate over channels, like I >>>>>>> suggested before [0]? >>>>>> >>>>>> Somehow I hadn't noticed this before, but this would break the invariant of >>>>>> having one client/class per channel. >>>>>> >>>>> >>>>> Yes, currently there is a weak relation of channel and clients device, but >>>>> seems >>>>> channels device is only used for printing dev_* messages and device could be >>>>> borrowed from the channels job. I don't see any real point of hardwiring >>>>> channel >>>>> to a specific device or client. >>>> >>>> Although, it won't work with syncpoint assignment to channel. >>> >>> On the other hand.. it should work if one syncpoint could be assigned to >>> multiple channels, couldn't it? >> >> A syncpoint can only be mapped to a single channel, so unfortunately this won't >> work. > Okay, in DRM we are requesting syncpoint on channels 'open' and syncpoint > assignment happens on jobs submission. So firstly submitted job will assign > syncpoint to the first channel and second job would re-assign syncpoint to a > second channel while first job is still in-progress, how is it going to work? > When a context is created, it's assigned both a syncpoint and channel and this pair stays for as long as the context is alive (i.e. as long as there are jobs), so even if the syncpoint is reassigned to a channel at every submit, it is always assigned to the same channel, so nothing breaks. Multiple contexts cannot share syncpoints so things work out. Obviously this is not ideal as we currently never unassign syncpoints but at least it is not broken. Mikko From 1585404838221135186@xxx Wed Nov 29 12:51:15 +0000 2017 X-GM-THRID: 1583223808868552366 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread