Re: [PATCH v10 0/7] Add Fieldbus subsystem + support HMS Profinet card

From: Sven Van Asbroeck
Date: Tue Apr 16 2019 - 17:49:37 EST

On Tue, Apr 16, 2019 at 5:21 PM Enrico Weigelt, metux IT consult
<lkml@xxxxxxxxx> wrote:
> Yeah, that sounds logical. By the way: could we also mmap() that device?

AFAIK mmap only makes sense if you have actual device memory, accessible
through some memory controller. The process memory on anybus-s devices
is accessed through many layers of indirection, which includes a handshaking/
synchronization protocol over anybus-s.

In addition, you'd lose timing information about writes. The current API blocks
until the write to the remote PLC's process memory has been
successfully completed.

Perhaps if someone ever adds a fieldbus_dev driver for a device with mappable
process memory, we can consider mmap() as an optional extension ?

> Okay that's just a purely academical idea here, but I'm curious whether
> that would make a notable difference in performance.

Perhaps on a device with memory-mappable process memory.
But it would have to be an incredibly fast fieldbus device for the
difference between read()/write() and mmap() to matter...

> Yet another question: does each fieldbus_dev instance talk to exactly
> one plc process memory, or can there be many ?
> Having separate device nodes per plc process memory seems a good idea
> for finer access control (via chown+friends).

Good question ! I'll have to get back to you on that...