Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp3727718pxb; Fri, 11 Feb 2022 06:32:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJwWWWcpshBvtmRz+kyXSDPBws2HcJwSMDJk+gBx3D8MrlL2qNxY9n1D9oW+a5JueYQiDfl/ X-Received: by 2002:a05:6830:12cf:: with SMTP id a15mr675146otq.262.1644589955658; Fri, 11 Feb 2022 06:32:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644589955; cv=none; d=google.com; s=arc-20160816; b=b0P0Ggsi70lh5BquPAfcBBRwHHccxiD25VXmGUj9TV3NpZLk6nZyYIpsimYYDqnjN+ aS/kzobYmup6eCE3/bB9MkHju99txNQGQKOoghwaTTP5wW1lvz5Ta9BcSP/v/PGvPDTm 3u6xOIQZC+7NugmpMlunIOyXg2iY9W1+eT2ZknLAtsjb2bLjsMWvFSWNq3NkwFopWVDr 1zgx8ykr/1pCio8UyfCpBzHS9hDlz/LXY9onqDyn6dB+yO5S3D/ZT08VNLx9W73i2Fk7 goHB4HkddtKIBIM/4+jU/nWD3WcuWqX3tpy9YAzot3AMlf1DlCFe4hRWwc3S62PHZ70M 5jXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=1g+B9fTAzY+6LZAT9Xswvi4vxDK7Hyp005w6da1R7GM=; b=YIRlnai7xqj7Hrkq0lyh9HnN6XmVnKU3xdFT6biLvMaS014opsm9faS3sExyZDbByO FJyMCxiqaG5/93dYvoHMdevE9kcuE75CVKzEj3R1MH/uXXk4XwL1iN4bcY8dycpR8nZZ UAXVElwDy3yP2KUEslBCjjOsvqIajqElepig4Jj9nJp9y5V11IXW9pzze4sV3OgexInY ftYV2EuKiCNFICFQvQZrBh6BLwW85qI1x4cgJPvYoC/MrbbijoeIfZVchKC0TOyORXEW +tQqdKVc5tWlAiINtzSN6PDH2hDd2+csdhprhsuRw+g6CUKZg7O4KvqqsVslk88JWxXV he0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Vn+Huk6Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p7si10164088oiv.21.2022.02.11.06.32.20; Fri, 11 Feb 2022 06:32:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Vn+Huk6Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343674AbiBKLKE (ORCPT + 99 others); Fri, 11 Feb 2022 06:10:04 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:37452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234880AbiBKLKD (ORCPT ); Fri, 11 Feb 2022 06:10:03 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6980AE58; Fri, 11 Feb 2022 03:10:02 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0461361451; Fri, 11 Feb 2022 11:10:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CFC18C340E9; Fri, 11 Feb 2022 11:10:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644577801; bh=33FdS46stfzSs/sG/CxUDAEbJjCWo6GD2sOd4EcXOk0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Vn+Huk6YEfMew3bvWssowMlIcmOA7tf8jOwQ31FhgmXiFSouMARkQeAMHVJam4X1S 09ykEZLx8MmWMycmtIynxtrXvIk+jIZGxSykk1Mr7fMeletbxxDqnSO2DNqnJEvQaU LnadcQl3M76G9ujUWirc9m8fPYwC/pOchdqElDFk= Date: Fri, 11 Feb 2022 12:09:58 +0100 From: Greg KH To: Abhinav Kumar Cc: Johannes Berg , linux-kernel@vger.kernel.org, rafael@kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, swboyd@chromium.org, khsieh@codeaurora.org, nganji@codeaurora.org, seanpaul@chromium.org, dmitry.baryshkov@linaro.org, aravindh@codeaurora.org, freedreno@lists.freedesktop.org Subject: Re: [PATCH] devcoredump: increase the device delete timeout to 10 mins Message-ID: References: <1644349472-31077-1-git-send-email-quic_abhinavk@quicinc.com> <8d67484c7e4b9fb4560d2eca1f71c75fde8bae0d.camel@sipsolutions.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 08, 2022 at 05:55:18PM -0800, Abhinav Kumar wrote: > Hi Johannes > > On 2/8/2022 1:54 PM, Johannes Berg wrote: > > On Tue, 2022-02-08 at 13:40 -0800, Abhinav Kumar wrote: > > > > > > > I am checking what usermode sees and will get back ( I didnt see an > > > error do most likely it was EOF ). I didnt follow the second part. > > > > I think probably it got -ENODEV, looking at kernfs_file_read_iter(). > > > > > If the file descriptor read returns EOF, even if we consider them > > > separate how will it resolve this issue? > > > > > > My earlier questions were related to fixing it in devcoredump to detect > > > and fix it there. Are you suggesting to fix in usermode instead? How? > > > > > > > Yeah, no, you cannot fix it in userspace. > > > > But I just followed the rabbit hole down kernfs and all, and it looks > > like indeed the read would be cut short with -ENODEV, sorry. > > > > It doesn't look like there's good API for this, but it seems at least > > from the underlying kernfs POV it should be possible to get_device() in > > open and put_device() in release, so that the device sticks around while > > somebody has the file open? It's entirely virtual, so this should be OK? > > > > johannes > > Are you suggesting something like below? > > diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c > index 42dcf96..14203d0 100644 > --- a/fs/sysfs/file.c > +++ b/fs/sysfs/file.c > @@ -32,6 +32,22 @@ static const struct sysfs_ops *sysfs_file_ops(struct > kernfs_node *kn) > return kobj->ktype ? kobj->ktype->sysfs_ops : NULL; > } > > +static int sysfs_kf_open(struct kernfs_open_file *of) > +{ > + struct kobject *kobj = of->kn->parent->priv; > + struct device *dev = kobj_to_dev(kobj); > + > + get_device(dev); > +} > + > +static void sysfs_kf_release(struct kernfs_open_file *of) > +{ > + struct kobject *kobj = of->kn->parent->priv; > + struct device *dev = kobj_to_dev(kobj); > + > + put_device(dev); > +} That obviously does not work as not everything in sysfs is a struct device :(