From: Maximilian Luz <luzmaximilian@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org, "Arnd Bergmann" <arnd@arndb.de>,
"Blaž Hrastnik" <blaz@mxxn.io>,
"Dorian Stoll" <dorian.stoll@tmsp.io>
Subject: Re: [RFC PATCH 8/9] surface_aggregator: Add DebugFS interface
Date: Thu, 24 Sep 2020 20:40:34 +0200 [thread overview]
Message-ID: <681bb644-5acc-b299-561a-757ac3db24b5@gmail.com> (raw)
In-Reply-To: <20200924064614.GA593984@kroah.com>
On 9/24/20 8:46 AM, Greg Kroah-Hartman wrote:
> On Thu, Sep 24, 2020 at 12:06:54AM +0200, Maximilian Luz wrote:
>> On 9/23/20 8:29 PM, Greg Kroah-Hartman wrote:
>>> On Wed, Sep 23, 2020 at 08:03:38PM +0200, Maximilian Luz wrote:
>>>> On 9/23/20 6:14 PM, Greg Kroah-Hartman wrote:
>>
>> [...]
>>
>>>> So the -EFAULT returned by put_user should have precedence? I was aiming
>>>> for "in case it fails, return with the first error".
>>>
>>> -EFAULT trumps everything :)
>>
>> Perfect, thanks!
>>
>>>>> Listen, I'm all for doing whatever you want in debugfs, but why are you
>>>>> doing random ioctls here? Why not just read/write a file to do what you
>>>>> need/want to do here instead?
>>>>
>>>> Two reasons, mostly: First, the IOCTL allows me to execute requests in
>>>> parallel with just one open file descriptor and not having to maintain
>>>> some sort of back-buffer to wait around until the reader gets to reading
>>>> the thing. I've used that for stress-testing the EC communication in the
>>>> past, which had some issues (dropping bytes, invalid CRCs, ...) under
>>>> heavy(-ish) load. Second, I'm considering adding support for events to
>>>> this device in the future by having user-space receive events by reading
>>>> from the device. Events would also be enabled or disabled via an IOCTL.
>>>> That could be implemented in a second device though. Events were also my
>>>> main reason for adding a version to this interface: Discerning between
>>>> one that has event support and one that has not.
>>>
>>> A misc device can also do this, much simpler, right? Why not use that?
>>
>> Sorry to ask so many questions, just want to make sure I understand you
>> correctly:
>>
>> - So you suggest I go with a misc device instead of putting this into
>> debugfs?
>
> Yes.
>
>> - And I keep the IOCTL?
>
> If you need it, although the interface Arnd says might be much simpler
> (read/write)
>
>> - Can I still tell people to not use it and that it's not my fault if a
>> change in the interface breaks their tools if it's not in debugfs?
>
> Yes :)
>
>> - Also load it via a separate module (module_misc_device, I assume)?
>
> That works.
>
>> One reason why the platform_device approach is practical in this
>> scenario is that I can leverage the driver core to defer probing and
>> thus defer creating the device if the controller isn't there yet.
>
> That's fine, and is a nice abuse of the platform driver interface. I
> say "abuse" because we really don't have a simpler way to do this at the
> moment, but this really isn't a platform device...
Yeah, it is a bit of a hack...
>> Similarly, the driver is automatically unbound if the controller goes
>> away and the device should be destroyed. All of this should currently be
>> handled via the device link created by ssam_client_bind() (unless I
>> really misunderstood those).
>
> That all is fine, just create the misc device when your driver binds to
> the device, just like you create the debugfs file entries today.
> There's no difference except you get a "real" char device node instead
> of a debugfs file.
>
>> I should be able to handle that by having the device refuse to open the
>> file if the controller isn't there. Holding the state-lock during the
>> request execution should ensure that the controller doesn't get shut
>> down.
>
> Nah, no need for that, again, keep the platform driver/device and then
> create the misc device (and remove it) where you are creating/removing
> the debugfs files.
Okay, I'll do that. Thank you!
>>> A simple misc device would make it very simple and easy to do instead,
>>> why not do that?
>>
>> Again, I considered the probe deferring of the platform driver fairly
>> handy (in addition to having the implicit debugfs warning of "don't rely
>> on this"), but if you prefer me implementing this as misc device, I'll
>> do that.
>
> The "joy" of creating a user api is that no matter how much you tell
> people "do not depend on this", they will, so no matter the file being
> in debugfs, or a misc device, you might be stuck with it for forever,
> sorry.
Hmm, true. I'm fairly confident that the request-IOCTL, as is right now,
should be sound (regarding to 5th and later gen. requests). It also can
be extended in a non-breaking way to handle events by reading from the
device in the future. So might as well commit to that.
Thanks,
Max
next prev parent reply other threads:[~2020-09-24 18:40 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-23 15:15 [RFC PATCH 0/9] Add support for Microsoft Surface System Aggregator Module Maximilian Luz
2020-09-23 15:15 ` [RFC PATCH 1/9] misc: Add Surface Aggregator subsystem Maximilian Luz
2020-09-23 16:57 ` Greg Kroah-Hartman
2020-09-23 20:34 ` Maximilian Luz
2020-09-24 6:48 ` Greg Kroah-Hartman
2020-09-24 18:16 ` Maximilian Luz
2020-09-23 15:15 ` [RFC PATCH 2/9] surface_aggregator: Add control packet allocation chaching Maximilian Luz
2020-09-23 15:15 ` [RFC PATCH 3/9] surface_aggregator: Add event item " Maximilian Luz
2020-09-23 15:15 ` [RFC PATCH 4/9] surface_aggregator: Add trace points Maximilian Luz
2020-09-23 20:07 ` Steven Rostedt
2020-09-23 23:43 ` Maximilian Luz
2020-09-23 15:15 ` [RFC PATCH 5/9] surface_aggregator: Add error injection capabilities Maximilian Luz
2020-09-23 17:45 ` Greg Kroah-Hartman
2020-09-23 21:28 ` Maximilian Luz
2020-09-23 15:15 ` [RFC PATCH 6/9] surface_aggregator: Add dedicated bus and device type Maximilian Luz
2020-09-23 17:33 ` Greg Kroah-Hartman
2020-09-23 21:12 ` Maximilian Luz
2020-09-24 7:12 ` Greg Kroah-Hartman
2020-09-24 18:15 ` Maximilian Luz
2020-09-23 15:15 ` [RFC PATCH 7/9] docs: driver-api: Add Surface Aggregator subsystem documentation Maximilian Luz
2020-09-23 15:15 ` [RFC PATCH 8/9] surface_aggregator: Add DebugFS interface Maximilian Luz
2020-09-23 16:14 ` Greg Kroah-Hartman
2020-09-23 18:03 ` Maximilian Luz
2020-09-23 18:29 ` Greg Kroah-Hartman
2020-09-23 22:06 ` Maximilian Luz
2020-09-24 6:46 ` Greg Kroah-Hartman
2020-09-24 18:40 ` Maximilian Luz [this message]
2020-09-23 16:48 ` Arnd Bergmann
2020-09-23 18:29 ` Maximilian Luz
2020-09-23 18:51 ` Arnd Bergmann
2020-09-23 22:23 ` Maximilian Luz
2020-09-24 7:41 ` Arnd Bergmann
2020-09-24 18:44 ` Maximilian Luz
2020-09-23 15:15 ` [RFC PATCH 9/9] surface_aggregator: Add Surface ACPI Notify client driver Maximilian Luz
2020-09-23 15:30 ` [RFC PATCH 0/9] Add support for Microsoft Surface System Aggregator Module Arnd Bergmann
2020-09-23 15:43 ` Maximilian Luz
2020-09-23 19:43 ` Arnd Bergmann
2020-09-23 23:28 ` Maximilian Luz
2020-09-24 8:26 ` Arnd Bergmann
2020-09-24 18:59 ` Maximilian Luz
2020-09-24 19:38 ` Arnd Bergmann
2020-09-24 21:07 ` Maximilian Luz
2020-09-25 14:53 ` Andy Shevchenko
2020-09-24 8:30 ` Andy Shevchenko
2020-09-24 19:17 ` Maximilian Luz
2020-09-25 14:58 ` Andy Shevchenko
2020-09-25 15:41 ` Maximilian Luz
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=681bb644-5acc-b299-561a-757ac3db24b5@gmail.com \
--to=luzmaximilian@gmail.com \
--cc=arnd@arndb.de \
--cc=blaz@mxxn.io \
--cc=dorian.stoll@tmsp.io \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.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