Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1740474

Re: kernFS/sysfs: mmap and vm_operations close

From Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Newsgroups linux.kernel
Subject Re: kernFS/sysfs: mmap and vm_operations close
Date 2017-09-27 09:50 +0200
Message-ID <uufgu-7Sm-11@gated-at.bofh.it> (permalink)
References <uu0r7-6G9-5@gated-at.bofh.it> <uu5K9-1HA-17@gated-at.bofh.it> <uuekp-7cU-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Sep 27, 2017 at 08:41:12AM +0200, Federico Vaga wrote:
> On Tuesday, 26 September 2017 23:31:29 CEST Greg Kroah-Hartman wrote:
> > On Tue, Sep 26, 2017 at 05:50:55PM +0200, Federico Vaga wrote:
> > > Hello,
> > > 
> > > I'm writing a sysfs binary attribute that makes use of the `mmap`
> > > operation.
> > Eeek, why?  What are you using that for?
> 
> I have a bus (VME) and we are not using the the VME subsystem provided by the 
> kernel (why? Historical reasons, we had our own implementation before the 
> kernel one appeared and we cannot port hundreds of drivers so easily in our 
> environment).

As the vme subsystem has been in the kernel for a long time (8 years?),
I don't have much sympathy for this, sorry :)

> I want to make our VME interface "as PCI as possible", so I want to re-create 
> resources that users can `mmap` to access the device memory.

Have you looked at the UIO interface?

> This abstraction will allow us to write utilities that works on PCI and VME 
> devices without dealing with the peculiarity of each interface. This is 
> particularly useful when you have FPGAs that can run the "same" code on 
> different buses, but it is true as well when you have the same hardware (the 
> same memory map) installed on VME cards or PCI cards.
> 
> That's why a sysfs VME resource seems to me the easiest and clean way to 
> achieve this. I do not want to create yet another layer that hides the 
> differences between the two buses when mmap is so straight forward and easy to 
> implement. Another point is that adding a new layer add complexity in the 
> architecture and for the developers; they have to learn yet another non-
> standard interface that I invent, while the concept of resource is something 
> that everybody know.

Or if you use the VME kernel interface, everything will "just work"...

> > sysfs binary attributes are for dumping binary data that the kernel
> > doesn't touch/parse, through to hardware.  Why use mmap for this?  Do
> > you have a pointer to your code somewhere?
> 
> No pointer :S

Sorry, I can't help out much then.

Best of luck!

greg k-h

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

kernFS/sysfs: mmap and vm_operations close Federico Vaga <federico.vaga@vaga.pv.it> - 2017-09-26 18:00 +0200
  Re: kernFS/sysfs: mmap and vm_operations close Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-09-26 23:40 +0200
    Re: kernFS/sysfs: mmap and vm_operations close Federico Vaga <federico.vaga@vaga.pv.it> - 2017-09-27 08:50 +0200
      Re: kernFS/sysfs: mmap and vm_operations close Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-09-27 09:50 +0200
        Re: kernFS/sysfs: mmap and vm_operations close Federico Vaga <federico.vaga@vaga.pv.it> - 2017-09-27 11:40 +0200

csiph-web