From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8E8EAC43460 for ; Thu, 29 Apr 2021 11:54:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 57FE761405 for ; Thu, 29 Apr 2021 11:54:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233643AbhD2Lzh (ORCPT ); Thu, 29 Apr 2021 07:55:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:45218 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230148AbhD2Lzg (ORCPT ); Thu, 29 Apr 2021 07:55:36 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id DD9976100C; Thu, 29 Apr 2021 11:54:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1619697288; bh=EFuIJ2kGdn+wTnQa+8XZmr6F/jtLE+EI8uAIIF5uiT4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=rNp7vun3lmDpJmVvZcBq7yxtklzexyKbWAMkm7XDgGoE4/mGw4OHLJNJgU0J/CfX7 hlQ2V9WudP37kQLy9r6FsuocGapSgVp/pdm8zFrFxq74741n1L2o00gmNvmvKfyDXy nRw0lsXft2z+GtQ994efP6bEK7GjFA8mWjmQD2fQ= Date: Thu, 29 Apr 2021 13:54:46 +0200 From: Greg Kroah-Hartman To: Daniel Vetter Cc: Hans de Goede , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Guenter Roeck , Heikki Krogerus , intel-gfx , dri-devel@lists.freedesktop.org, platform-driver-x86@vger.kernel.org, linux-usb@vger.kernel.org Subject: Re: [PATCH 1/9] drm/connector: Make the drm_sysfs connector->kdev device hold a reference to the connector Message-ID: References: <20210428215257.500088-1-hdegoede@redhat.com> <20210428215257.500088-2-hdegoede@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org On Thu, Apr 29, 2021 at 01:40:28PM +0200, Daniel Vetter wrote: > On Wed, Apr 28, 2021 at 11:52:49PM +0200, Hans de Goede wrote: > > Userspace could hold open a reference to the connector->kdev device, > > through e.g. holding a sysfs-atrtribute open after > > drm_sysfs_connector_remove() has been called. In this case the connector > > could be free-ed while the connector->kdev device's drvdata is still > > pointing to it. > > > > Give drm_connector devices there own device type, which allows > > us to specify our own release function and make drm_sysfs_connector_add() > > take a reference on the connector object, and have the new release > > function put the reference when the device is released. > > > > Giving drm_connector devices there own device type, will also allow > > checking if a device is a drm_connector device with a > > "if (device->type == &drm_sysfs_device_connector)" check. > > > > Note that the setting of the name member of the device_type struct will > > cause udev events for drm_connector-s to now contain DEVTYPE=drm_connector > > as extra info. So this extends the uevent part of the userspace API. > > > > Signed-off-by: Hans de Goede > > Are you sure? I thought sysfs is supposed to flush out any pending > operations (they complete fast) and handle open fd internally? Yes, it "should" :) From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CFCB0C433B4 for ; Thu, 29 Apr 2021 11:54:50 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5718361447 for ; Thu, 29 Apr 2021 11:54:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5718361447 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9A3D66EE42; Thu, 29 Apr 2021 11:54:49 +0000 (UTC) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by gabe.freedesktop.org (Postfix) with ESMTPS id 154CD6EE42; Thu, 29 Apr 2021 11:54:49 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id DD9976100C; Thu, 29 Apr 2021 11:54:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1619697288; bh=EFuIJ2kGdn+wTnQa+8XZmr6F/jtLE+EI8uAIIF5uiT4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=rNp7vun3lmDpJmVvZcBq7yxtklzexyKbWAMkm7XDgGoE4/mGw4OHLJNJgU0J/CfX7 hlQ2V9WudP37kQLy9r6FsuocGapSgVp/pdm8zFrFxq74741n1L2o00gmNvmvKfyDXy nRw0lsXft2z+GtQ994efP6bEK7GjFA8mWjmQD2fQ= Date: Thu, 29 Apr 2021 13:54:46 +0200 From: Greg Kroah-Hartman To: Daniel Vetter Subject: Re: [PATCH 1/9] drm/connector: Make the drm_sysfs connector->kdev device hold a reference to the connector Message-ID: References: <20210428215257.500088-1-hdegoede@redhat.com> <20210428215257.500088-2-hdegoede@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Heikki Krogerus , dri-devel@lists.freedesktop.org, David Airlie , intel-gfx , platform-driver-x86@vger.kernel.org, Hans de Goede , linux-usb@vger.kernel.org, Thomas Zimmermann , Rodrigo Vivi , Guenter Roeck Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Thu, Apr 29, 2021 at 01:40:28PM +0200, Daniel Vetter wrote: > On Wed, Apr 28, 2021 at 11:52:49PM +0200, Hans de Goede wrote: > > Userspace could hold open a reference to the connector->kdev device, > > through e.g. holding a sysfs-atrtribute open after > > drm_sysfs_connector_remove() has been called. In this case the connector > > could be free-ed while the connector->kdev device's drvdata is still > > pointing to it. > > > > Give drm_connector devices there own device type, which allows > > us to specify our own release function and make drm_sysfs_connector_add() > > take a reference on the connector object, and have the new release > > function put the reference when the device is released. > > > > Giving drm_connector devices there own device type, will also allow > > checking if a device is a drm_connector device with a > > "if (device->type == &drm_sysfs_device_connector)" check. > > > > Note that the setting of the name member of the device_type struct will > > cause udev events for drm_connector-s to now contain DEVTYPE=drm_connector > > as extra info. So this extends the uevent part of the userspace API. > > > > Signed-off-by: Hans de Goede > > Are you sure? I thought sysfs is supposed to flush out any pending > operations (they complete fast) and handle open fd internally? Yes, it "should" :) _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76753C433B4 for ; Thu, 29 Apr 2021 11:54:54 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0F54B6144E for ; Thu, 29 Apr 2021 11:54:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0F54B6144E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F30E46EE4D; Thu, 29 Apr 2021 11:54:49 +0000 (UTC) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by gabe.freedesktop.org (Postfix) with ESMTPS id 154CD6EE42; Thu, 29 Apr 2021 11:54:49 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id DD9976100C; Thu, 29 Apr 2021 11:54:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1619697288; bh=EFuIJ2kGdn+wTnQa+8XZmr6F/jtLE+EI8uAIIF5uiT4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=rNp7vun3lmDpJmVvZcBq7yxtklzexyKbWAMkm7XDgGoE4/mGw4OHLJNJgU0J/CfX7 hlQ2V9WudP37kQLy9r6FsuocGapSgVp/pdm8zFrFxq74741n1L2o00gmNvmvKfyDXy nRw0lsXft2z+GtQ994efP6bEK7GjFA8mWjmQD2fQ= Date: Thu, 29 Apr 2021 13:54:46 +0200 From: Greg Kroah-Hartman To: Daniel Vetter Message-ID: References: <20210428215257.500088-1-hdegoede@redhat.com> <20210428215257.500088-2-hdegoede@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Subject: Re: [Intel-gfx] [PATCH 1/9] drm/connector: Make the drm_sysfs connector->kdev device hold a reference to the connector X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Heikki Krogerus , dri-devel@lists.freedesktop.org, David Airlie , intel-gfx , platform-driver-x86@vger.kernel.org, linux-usb@vger.kernel.org, Maxime Ripard , Thomas Zimmermann , Guenter Roeck Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On Thu, Apr 29, 2021 at 01:40:28PM +0200, Daniel Vetter wrote: > On Wed, Apr 28, 2021 at 11:52:49PM +0200, Hans de Goede wrote: > > Userspace could hold open a reference to the connector->kdev device, > > through e.g. holding a sysfs-atrtribute open after > > drm_sysfs_connector_remove() has been called. In this case the connector > > could be free-ed while the connector->kdev device's drvdata is still > > pointing to it. > > > > Give drm_connector devices there own device type, which allows > > us to specify our own release function and make drm_sysfs_connector_add() > > take a reference on the connector object, and have the new release > > function put the reference when the device is released. > > > > Giving drm_connector devices there own device type, will also allow > > checking if a device is a drm_connector device with a > > "if (device->type == &drm_sysfs_device_connector)" check. > > > > Note that the setting of the name member of the device_type struct will > > cause udev events for drm_connector-s to now contain DEVTYPE=drm_connector > > as extra info. So this extends the uevent part of the userspace API. > > > > Signed-off-by: Hans de Goede > > Are you sure? I thought sysfs is supposed to flush out any pending > operations (they complete fast) and handle open fd internally? Yes, it "should" :) _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx