Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1035770AbdD2GHQ (ORCPT ); Sat, 29 Apr 2017 02:07:16 -0400 Received: from home.keithp.com ([63.227.221.253]:44233 "EHLO elaine.keithp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S937208AbdD2GHH (ORCPT ); Sat, 29 Apr 2017 02:07:07 -0400 From: Keith Packard To: linux-kernel@vger.kernel.org, Dave Airlie , Daniel Vetter Cc: Keith Packard , dri-devel@lists.freedesktop.org Subject: [PATCH 0/5] drm: Add mode resource leasing [v2] Date: Fri, 28 Apr 2017 23:06:57 -0700 Message-Id: <20170429060702.6656-1-keithp@keithp.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170401170841.2643-1-keithp@keithp.com> References: <20170401170841.2643-1-keithp@keithp.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1605 Lines: 32 Here's a second try at mode resource leasing. The differences from v1 are mostly deleting functionality that isn't currently useful. There are no more sub-leases; there's the owner, the owner is the only lessor and so the only one who can create leases and hand those out. The lessor can now manipulate all of the resources without restriction. It's up to user space to enforce whatever access control it wants. The lessee can no longer see any resources other than those in the lease. This was a bit tricky as there are various indices into the reported arrays of objects in the form of masks. The query ioctls no longer take lessor or lessee ids; you can query the leases you have granted or query the list of resources in your own lease. The X server uses the former to figure out when lessees close their DRM file and terminate a lease. As I write this, I'm wondering if that latter operation is actually useful though. If not, we can rip that ioctl out easily enough. As suggested by Daniel Vetter, the first patch changes the API to __drm_mode_object_find to include a relevant struct drm_file * pointer so that function can perform any necessary per-file access control. When there isn't a suitable pointer, NULL is passed instead, which is a proxy for the origin DRM master. For leases, this means that no lease permissions checking is done. This is why there are now 5 patches instead of the original 4. Thanks again to everyone who commented on the mailing list or on IRC; I'm pretty happy with the current functionality; I've got kmscube leasing resources from the X server this evening.