On 2/2/21 11:42 AM, Siddons, David wrote:
> At least I still have the root fallback 😉 But I'll try the gpio driver approach.
> Do you have any feeling about the relative speed of mmap and ioctl?
mmap() will be as fast as program I/O can be. However, it requires dealing with
the potential gotchas of access width, alignment, ordering, and optimizer magic
in a user space program. It has the benefit though of not needing to manages
a whole bunch of ioctl() flags.
My devlib2 module provides a set of macros for portable MMIO operations in userspace.
These are analogous (and hopefully equivalent) to the Linux kernel ioread*/iowrite*().
http://epics.sourceforge.net/devlib2/group__mmio.html
If you're truly looking for speed, then move straight along to DMA engines.
Program I/O will not come close to the theoretical speeds of modern hardware.
Of course DMA engines come with a long list of complications, and a zoo of
different features sets.
> Pete.
>
>
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> *From:* Michael Davidsaver <mdavidsaver at gmail.com>
> *Sent:* Tuesday, February 2, 2021 2:39 PM
> *To:* Siddons, David <siddons at bnl.gov>
> *Cc:* EPICS Tech-Talk <tech-talk at aps.anl.gov>
> *Subject:* Re: setcap and nosuid
>
> On 2/2/21 10:49 AM, Siddons, David wrote:
>> Well, everything works fine when running as root.
>
> Ah, this is an important data point. This brings us around to Linux capabilities.
> It might be sufficient if you were able to set a file capability of CAP_SYS_RAWIO.
>
>> I am just being encouraged to stop doing that 🙂
>
> Sage advice. And I should probably stop encouraging you to keep trying with /dev/mem then :)
>
>
>> Pete.
>>
>> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>> *From:* Michael Davidsaver <mdavidsaver at gmail.com>
>> *Sent:* Tuesday, February 2, 2021 1:48 PM
>> *To:* Siddons, David <siddons at bnl.gov>
>> *Cc:* EPICS Tech-Talk <tech-talk at aps.anl.gov>
>> *Subject:* Re: setcap and nosuid
>>
>> On 2/2/21 10:09 AM, Siddons, David wrote:
>>> Hi Michael,
>>> Setting 0666 doesn't help.
>>
>> Maybe your kernel doesn't have /dev/mem enabled either?
>>
>>> $ grep DEVMEM /boot/config-5.9.0-0.bpo.5-amd64
>>> CONFIG_DEVMEM=y
>>> CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y
>>> CONFIG_STRICT_DEVMEM=y
>>> CONFIG_IO_STRICT_DEVMEM=y
>>
>>
>>
>>> THanks for the link. I missed that before. It looks like the right way to go. I'll dig into it.
>>>
>>> Pete.
>>>
>>>
>>> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>>> *From:* Michael Davidsaver <mdavidsaver at gmail.com>
>>> *Sent:* Tuesday, February 2, 2021 12:13 PM
>>> *To:* Siddons, David <siddons at bnl.gov>
>>> *Cc:* EPICS Tech-Talk <tech-talk at aps.anl.gov>
>>> *Subject:* Re: setcap and nosuid
>>>
>>> On 2/2/21 8:57 AM, Siddons, David wrote:
>>>> Hi David,
>>>> Yes, I saw that. Changing it doesn't seem to help:
>>>>
>>>> sudo chmod g+w /dev/mem
>>>> ls -l /dev/mem
>>>> crw-rw---- 1 root kmem 1, 1 Feb 1 21:05 /dev/mem
>>>>
>>>> ./regrw R 1 ( a program which maps the FPGA registers to userspace)
>>>> Reading Register 1
>>>> Can't open /dev/mem
>>>
>>> Have you tried chmod 0666 to make sure this is really a permission problem?
>>> The "Can't open" could also print 'errno'.
>>>
>>> Also, I feel obligated to repeat myself in recommending against using
>>> /dev/mem in any kind of long term solution. There are safer ways
>>> to grant access to specific MMIO ranges.
>>>
>>> https://epics.anl.gov/tech-talk/2020/msg02201.php <https://epics.anl.gov/tech-talk/2020/msg02201.php> <https://epics.anl.gov/tech-talk/2020/msg02201.php <https://epics.anl.gov/tech-talk/2020/msg02201.php>> <https://epics.anl.gov/tech-talk/2020/msg02201.php <https://epics.anl.gov/tech-talk/2020/msg02201.php <https://epics.anl.gov/tech-talk/2020/msg02201.php>>>
>>
>
- References:
- setcap and nosuid Michael Davidsaver via Tech-talk
- Re: setcap and nosuid Siddons, David via Tech-talk
- Re: setcap and nosuid Michael Davidsaver via Tech-talk
- Re: setcap and nosuid Siddons, David via Tech-talk
- Re: setcap and nosuid Michael Davidsaver via Tech-talk
- Re: setcap and nosuid Siddons, David via Tech-talk
- Re: setcap and nosuid Michael Davidsaver via Tech-talk
- Re: setcap and nosuid Siddons, David via Tech-talk
- Re: setcap and nosuid Michael Davidsaver via Tech-talk
- Re: setcap and nosuid Siddons, David via Tech-talk
- Navigate by Date:
- Prev:
Re: setcap and nosuid Siddons, David via Tech-talk
- Next:
motor R7-2-2 released Kevin Peterson via Tech-talk
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
<2021>
2022
2023
2024
- Navigate by Thread:
- Prev:
Re: setcap and nosuid Siddons, David via Tech-talk
- Next:
Channel connection performance Axel Terfloth via Tech-talk
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
<2021>
2022
2023
2024
|