Received: by 10.213.65.68 with SMTP id h4csp1069842imn; Wed, 21 Mar 2018 01:39:10 -0700 (PDT) X-Google-Smtp-Source: AG47ELsz6EKndYXxFrwdpZERKdAiCNg78vVx1m3jI9+/ONwVR4P1yN85Jo/RH9OrpUMPKnpoAosY X-Received: by 2002:a17:902:536c:: with SMTP id b99-v6mr12025767pli.399.1521621549971; Wed, 21 Mar 2018 01:39:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521621549; cv=none; d=google.com; s=arc-20160816; b=kSJtW7w3xS+a0sWVcGtdxfb8vuxAJq4yiNxXAT42e3vAVc5hLrWCcWIz86QDjQRgfA 2hijAxphM8YojVMaJ3Fq5y+51Mu10vDWp6+RPYDGwm7dG3PgsuVi5jRsIG4/BObSRT2e dOYPsQVOWN5Vo1KMgkTONFEaTTOuUNu2S5xgip9h4XEwMOLoRrtVWWISrnH8/TNQrxLc U/UhQIMyPlVc9UR/UvvVFQCko4mUNGFTVQLnye8CogNtTwWvT5F7lEQGNW1/3ogQ50UI y+/w8MBZcwp/op/ervxhK+oqPjZKFM14A8bGWOttXHQcifjmIgMQJVRGO/9KLXI00hJ/ QJ7g== 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:to:subject:dkim-signature :arc-authentication-results; bh=zdUO1KsxAH0UlKMTjAIculj+K5XNqhvmDRUB4vYgF4M=; b=Dn4iXOKw0esaAKInCc3VCV0xQS4PTs4M49O+oeH+FkbUShUJ2EL16kfLkxb+fJSAZi 4BCZCrrgFdDI0oHIQF7tyDAtRL0mgQOx6wC9pU+L1ai9OjkCM3PySQALhQ9yjWxXx/br gYOB4YQ5IArN/ksmYi2/rmdFdcanImHOS1twY7p0kViRNuR6JGo7HWTKVZ+BCZzsOF9W cuXCHqjFzorAPATGCO/jnsoc9rvliE9JoufJFGxu+0oF+4gxXSdLhXRBXeFCMgny0xoq Mg/0fwLuGp0uIR2+2gbPLoAwI/2OBP9jw4UvEWuwUn6EB7FqVtXAXldJSg8khUx+tCKg c6Og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BoU/0xws; 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 z19si2732600pfd.397.2018.03.21.01.38.55; Wed, 21 Mar 2018 01:39:09 -0700 (PDT) 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=BoU/0xws; 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 S1751625AbeCUIhy (ORCPT + 99 others); Wed, 21 Mar 2018 04:37:54 -0400 Received: from mail-lf0-f49.google.com ([209.85.215.49]:32950 "EHLO mail-lf0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751411AbeCUIhs (ORCPT ); Wed, 21 Mar 2018 04:37:48 -0400 Received: by mail-lf0-f49.google.com with SMTP id x205-v6so6608895lfa.0 for ; Wed, 21 Mar 2018 01:37:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=zdUO1KsxAH0UlKMTjAIculj+K5XNqhvmDRUB4vYgF4M=; b=BoU/0xwsX/cMrBlCkiwfUa6uU1npFFYJAZ07h/qZrj2VqL39R7cGFMxAd80cP5au1s Ej7AYiQL00V9lBlctCopY+cb40EEBdXD6hRgPy6eKodO2PNtdKRv7uylyEeIWsIBUK7A lC/HUTZcYvKy93kI4vdGU5Ihx1WVHi+mYV7e7kqE5N8wSX13EOciS0nM7DoB48oA8S0r ldXGgB2iBjItc3LWzwlVIdFpZiR/LJwE3/NuT0w15cD3KFlLzdS+fczdIHjTkbWPWQHD VD4NZa2YeK5D5ZlR4HPHYRlFvJGhCnSqxd/LGEOuwyc92B/WTrcfvxKBwPPnpFoaG9gq digQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=zdUO1KsxAH0UlKMTjAIculj+K5XNqhvmDRUB4vYgF4M=; b=CDxmJcyql4QuDZ9jSJhvGCzjaxLZalIe29Dg9zlgZGd4p/qvOYHd7iTu0qFH6L2+yQ A5a+i8UMFrQYZOzCzPElJt6rJU1zdHNLSc7PPcwt1cqAR+D+jYjTIHaGVCPXKSLxas6t WCwoo3+KhZifJxJGsCwFmE1ZmSasDFFUFVx9vnJZeD7JN/RMWwYgALqk40Y69Fp5F+bm J7GFEEA/KfMnIF/YOF69S1N+hw1+emth9YimIgMDQ05BF+D/SJqTrp1/4OHv/rkuj6Bn xAO++EcQxr9NLjwZDB823YD8Zgoys900AYA8wNxXZ2DXWKfeBvjNoU++HGA9PcY2blte NLyw== X-Gm-Message-State: AElRT7FkASC7JIbbZE6ldAT+SYfnTxL7LEgDu8/G2QaCfciQkzCBNcxy KpEnsX0dQ2otANesECOGixM= X-Received: by 10.46.144.214 with SMTP id o22mr3375275ljg.107.1521621466797; Wed, 21 Mar 2018 01:37:46 -0700 (PDT) Received: from [10.17.6.49] (ll-52.209.223.85.sovam.net.ua. [85.223.209.52]) by smtp.googlemail.com with ESMTPSA id d2sm758464lja.43.2018.03.21.01.37.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Mar 2018 01:37:45 -0700 (PDT) Subject: Re: [PATCH RESEND v2 1/2] drm/xen-front: Add support for Xen PV display frontend To: xen-devel@lists.xenproject.org, Linux Kernel Mailing List , dri-devel , Dave Airlie , Daniel Vetter , Sean Paul , Gustavo Padovan , Juergen Gross , boris.ostrovsky@oracle.com, Konrad Rzeszutek Wilk , "Oleksandr_Andrushchenko@epam.com" References: <1520958066-22875-1-git-send-email-andr2000@gmail.com> <1520958066-22875-2-git-send-email-andr2000@gmail.com> <20180316082330.GF25297@phenom.ffwll.local> <20180319135141.GK14155@phenom.ffwll.local> <0808bf3b-7301-cc28-1cb5-40a4c8aad5cc@gmail.com> <7c4e0f8f-9ec0-e38b-7b37-264241df4ba5@gmail.com> <20180320134715.GT14155@phenom.ffwll.local> From: Oleksandr Andrushchenko Message-ID: Date: Wed, 21 Mar 2018 10:37:44 +0200 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: <20180320134715.GT14155@phenom.ffwll.local> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/20/2018 03:47 PM, Daniel Vetter wrote: > On Tue, Mar 20, 2018 at 01:58:01PM +0200, Oleksandr Andrushchenko wrote: >> On 03/19/2018 05:28 PM, Daniel Vetter wrote: >>> There should be no difference between immediate removal and delayed >>> removal of the drm_device from the xenbus pov. The lifetimes of the >>> front-end (drm_device) and backend (the xen bus thing) are entirely >>> decoupled: >> Well, they are not decoupled for simplicity of handling, >> please see below >>> So for case 2 you only have 1 case: >>> >>> - drm_dev_unplug >>> - tear down the entire xenbus backend completely >>> - all xenbus access will be caught with drm_dev_entre/exit (well right >>> now drm_dev_is_unplugged) checks, including any access to your private >>> drm_device data >>> - once drm_device->open_count == 0 the core will tear down the >>> drm_device instance and call your optional drm_driver->release >>> callback. >>> >>> So past drm_dev_unplug the drm_device is in zombie state and the only >>> thing that will happen is a) it rejects all ioctls and anything else >>> userspace might ask it to do and b) gets releases once the last >>> userspace reference is gone. >> I have re-worked the driver with this in mind [1] >> So, I now use drm_dev_unplug and destroy the DRM device >> on drm_driver.release. >> In context of unplug work I also merged xen_drm_front_drv.c and >> xen_drm_front.c as these are too coupled together now. >> >> Could you please take a look and tell me if this is what you mean? >>> If the backend comes up again, you create a _new_ drm_device instance >>> (while the other one is still in the process of eventually getting >>> released). >> We only have a single xenbus instance, so this way I'll need >> to handle list of such zombies. For that reason I prefer to >> wait until the DRM device is destroyed, telling the backend >> to hold on until then (via going into XenbusStateReconfiguring state). > Why exactly do you need to keep track of your drm_devices from the xenbus? > Once unplugged, there should be no connection with the "hw" for your > device, in neither direction. Maybe I need to look again, but this still > smells funny and not like something you should ever do. Ok, probably new reworked code will make things cleaner and answer your concerns. I also removed some obsolete stuff, e.g. platform device, so this path became even cleaner now ;) >> Another drawback of such approach is that I'll have different >> minors at run-time, e.g. card0, card1, etc. >> For software which has /dev/dri/card0 hardcoded it may be a problem. >> But this is minor, IMO > Fix userspace :-) > > But yeah unlikely this is a problem, hotplugging is fairly old thing. > >>> In short, your driver code should never have a need to look at >>> drm_device->open_count. I hope this explains it a bit better. >>> -Daniel >>> >> Yes, you are correct: at [1] I am not touching drm_device->open_count >> anymore and everything just happens synchronously >> [1] https://github.com/andr2000/linux/commits/drm_tip_pv_drm_v3 > Please just resend, makes it easier to comment inline. I need to wait for Xen community reviewers before resending, so this is why I hoped you can take a look before that, so I have a chance to address more of your comments in v4 > -Daniel Thank you, Oleksandr