From: Abhinav Kumar <quic_abhinavk@quicinc.com>
To: Johannes Berg <johannes@sipsolutions.net>,
<linux-kernel@vger.kernel.org>
Cc: <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>, <gregkh@linuxfoundation.org>,
<dmitry.baryshkov@linaro.org>, <aravindh@codeaurora.org>,
<freedreno@lists.freedesktop.org>
Subject: Re: [PATCH] devcoredump: increase the device delete timeout to 10 mins
Date: Tue, 8 Feb 2022 17:55:18 -0800 [thread overview]
Message-ID: <b60d30cf-e435-49c4-a251-b910bc2e94ae@quicinc.com> (raw)
In-Reply-To: <c2a6e29063793eecc5c65d32af9d826544404ecc.camel@sipsolutions.net>
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);
+}
+
/*
* Reads on sysfs are handled through seq_file, which takes care of hairy
* details like buffering and seeking. The following function pipes
@@ -211,6 +227,8 @@ static const struct kernfs_ops sysfs_file_kfops_wo = {
};
static const struct kernfs_ops sysfs_file_kfops_rw = {
+ .open = sysfs_kf_open;
+ .release = sysfs_kf_release;
.seq_show = sysfs_kf_seq_show,
.write = sysfs_kf_write,
};
If so, dont you think this will be a more intrusive change just for the
sake of devcoredump? Any other way to keep the changes limited to
devcoredump?
Thanks
Abhinav
next prev parent reply other threads:[~2022-02-09 2:42 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-08 19:44 [PATCH] devcoredump: increase the device delete timeout to 10 mins Abhinav Kumar
2022-02-08 20:35 ` Johannes Berg
2022-02-08 21:04 ` Abhinav Kumar
2022-02-08 21:12 ` Johannes Berg
2022-02-08 21:40 ` Abhinav Kumar
2022-02-08 21:54 ` Johannes Berg
2022-02-09 1:55 ` Abhinav Kumar [this message]
2022-02-09 7:50 ` Johannes Berg
2022-02-09 16:29 ` Abhinav Kumar
2022-02-11 11:09 ` Greg KH
2022-02-11 11:09 ` Greg KH
2022-02-11 18:59 ` Abhinav Kumar
2022-02-12 7:04 ` Greg KH
2022-02-12 7:52 ` Abhinav Kumar
2022-02-12 8:24 ` Johannes Berg
2022-02-12 8:35 ` Abhinav Kumar
2022-02-28 21:38 ` Abhinav Kumar
2022-03-01 6:48 ` David Laight
2022-03-01 17:45 ` Rob Clark
2022-03-11 11:53 ` Johannes Berg
2022-02-12 8:29 ` Greg KH
2022-02-12 8:33 ` Abhinav Kumar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b60d30cf-e435-49c4-a251-b910bc2e94ae@quicinc.com \
--to=quic_abhinavk@quicinc.com \
--cc=aravindh@codeaurora.org \
--cc=dmitry.baryshkov@linaro.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=gregkh@linuxfoundation.org \
--cc=johannes@sipsolutions.net \
--cc=khsieh@codeaurora.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nganji@codeaurora.org \
--cc=rafael@kernel.org \
--cc=seanpaul@chromium.org \
--cc=swboyd@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox