All of lore.kernel.org
 help / color / mirror / Atom feed
* mmap - post/pre actions
@ 2015-09-15 19:40 Ran Shalit
  2015-09-15 19:51 ` Valdis.Kletnieks at vt.edu
  2015-09-16  9:02 ` Pranay Srivastava
  0 siblings, 2 replies; 3+ messages in thread
From: Ran Shalit @ 2015-09-15 19:40 UTC (permalink / raw)
  To: kernelnewbies

Hello,

I need to implement mmap for non-volatile memory chip (NVRAM).
I already did something simple, but now I understand that it is not complete:
The nvram need to be unlock and locked after finishing the memory task
of read/write.

Does mmap can handle such post/pre actions or not ( I guess that if
not -  I will need to use read/write alternatives) ?

Thank you,
Ran

^ permalink raw reply	[flat|nested] 3+ messages in thread

* mmap - post/pre actions
  2015-09-15 19:40 mmap - post/pre actions Ran Shalit
@ 2015-09-15 19:51 ` Valdis.Kletnieks at vt.edu
  2015-09-16  9:02 ` Pranay Srivastava
  1 sibling, 0 replies; 3+ messages in thread
From: Valdis.Kletnieks at vt.edu @ 2015-09-15 19:51 UTC (permalink / raw)
  To: kernelnewbies

On Tue, 15 Sep 2015 22:40:50 +0300, Ran Shalit said:
> Hello,
>
> I need to implement mmap for non-volatile memory chip (NVRAM).
> I already did something simple, but now I understand that it is not complete:
> The nvram need to be unlock and locked after finishing the memory task
> of read/write.
>
> Does mmap can handle such post/pre actions or not ( I guess that if
> not -  I will need to use read/write alternatives) ?

Not sure if it does or not.  But the unlock should be done when the mmap
segment is first created, and locked when the last reference to the segment
is removed.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 848 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20150915/3e8a7a8d/attachment.bin 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* mmap - post/pre actions
  2015-09-15 19:40 mmap - post/pre actions Ran Shalit
  2015-09-15 19:51 ` Valdis.Kletnieks at vt.edu
@ 2015-09-16  9:02 ` Pranay Srivastava
  1 sibling, 0 replies; 3+ messages in thread
From: Pranay Srivastava @ 2015-09-16  9:02 UTC (permalink / raw)
  To: kernelnewbies

Hi Ran

On Wed, Sep 16, 2015 at 1:10 AM, Ran Shalit <ranshalit@gmail.com> wrote:
> Hello,
>
> I need to implement mmap for non-volatile memory chip (NVRAM).
> I already did something simple, but now I understand that it is not complete:
> The nvram need to be unlock and locked after finishing the memory task
> of read/write.

I guess you are better off with an ioctl call to the driver and be
done with the read/write. You won't get
faults once you've mapped it. So I don't think you can do locking via
your driver after that.

If you are thinking of doing something like below

P1--->mmap--->driver [OK]
P2-->mmap--->driver[OK]

You won't be able to get the faults for the below cases as you would've already
filled the vma for that in your vm_fault handler.

P1--->writes to mmaped [No fault]
P2--->writes to mmaped [No fault]

You can't lock once both have mapped. What you can do is provide a
different mapping[?] and then
sync that mapping I guess? But that's just insane.

If you say that subsequent mmap would fail then again you'll have to
code user-space to work with this.

Better off with ioctl rather than mmap.
>
> Does mmap can handle such post/pre actions or not ( I guess that if
> not -  I will need to use read/write alternatives) ?
>
> Thank you,
> Ran
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



-- 
        ---P.K.S

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-09-16  9:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-15 19:40 mmap - post/pre actions Ran Shalit
2015-09-15 19:51 ` Valdis.Kletnieks at vt.edu
2015-09-16  9:02 ` Pranay Srivastava

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.