From: Jerome Glisse <j.glisse@gmail.com>
To: KOSAKI Motohiro <kosaki.motohiro@gmail.com>
Cc: Minchan Kim <minchan@kernel.org>, Inki Dae <inki.dae@samsung.com>,
InKi Dae <daeinki@gmail.com>,
airlied@linux.ie, dri-devel@lists.freedesktop.org,
kyungmin.park@samsung.com, sw0312.kim@samsung.com,
linux-mm@kvack.org
Subject: Re: [PATCH 2/2 v3] drm/exynos: added userptr feature.
Date: Fri, 11 May 2012 18:22:41 -0400 [thread overview]
Message-ID: <CAH3drwYu_N5kOM1dSgJw8JNv2ScNkTPLZrRbzozrsF=D2=S=kA@mail.gmail.com> (raw)
In-Reply-To: <4FAD829E.2030707@gmail.com>
On Fri, May 11, 2012 at 5:20 PM, KOSAKI Motohiro
<kosaki.motohiro@gmail.com> wrote:
> (5/10/12 11:01 PM), Jerome Glisse wrote:
>>
>> On Thu, May 10, 2012 at 10:51 PM, KOSAKI Motohiro
>> <kosaki.motohiro@gmail.com> wrote:
>>>
>>> (5/10/12 8:50 PM), Minchan Kim wrote:
>>>>
>>>>
>>>> Hi KOSAKI,
>>>>
>>>> On 05/11/2012 02:53 AM, KOSAKI Motohiro wrote:
>>>>
>>>>>>>> let's assume that one application want to allocate user space memory
>>>>>>>> region using malloc() and then write something on the region. as you
>>>>>>>> may know, user space buffer doen't have real physical pages once
>>>>>>>> malloc() call so if user tries to access the region then page fault
>>>>>>>> handler would be triggered
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Understood.
>>>>>>>
>>>>>>>> and then in turn next process like swap in to fill physical frame
>>>>>>>> number
>>>>>>>
>>>>>>>
>>>>>>> into entry of the page faulted.
>>>>>>>
>>>>>>>
>>>>>>> Sorry, I can't understand your point due to my poor English.
>>>>>>> Could you rewrite it easiliy? :)
>>>>>>>
>>>>>>
>>>>>> Simply saying, handle_mm_fault would be called to update pte after
>>>>>> finding
>>>>>> vma and checking access right. and as you know, there are many cases
>>>>>> to
>>>>>> process page fault such as COW or demand paging.
>>>>>
>>>>>
>>>>>
>>>>> Hmm. If I understand correctly, you guys misunderstand mlock. it
>>>>> doesn't
>>>>> page pinning
>>>>> nor prevent pfn change. It only guarantee to don't make swap out. e.g.
>>>>
>>>>
>>>>
>>>>
>>>> Symantic point of view, you're right but the implementation makes sure
>>>> page pinning.
>>>>
>>>>> memory campaction
>>>>> feature may automatically change page physical address.
>>>>
>>>>
>>>>
>>>>
>>>> I tried it last year but decided drop by realtime issue.
>>>> https://lkml.org/lkml/2011/8/29/295
>>>>
>>>> so I think mlock is a kind of page pinning. If elsewhere I don't
>>>> realized
>>>> is doing, that place should be fixed.
>>>> Or my above patch should go ahead.
>>>
>>>
>>>
>>> Thanks pointing out. I didn't realized your patch didn't merged. I think
>>> it
>>> should go ahead. think autonuma case,
>>> if mlock disable autonuma migration, that's bug. I don't think we can
>>> promise mlock don't change physical page.
>>> I wonder if any realtime guys page migration is free lunch. they should
>>> disable both auto migration and compaction.
>>>
>>> And, think if application explictly use migrate_pages(2) or admins uses
>>> cpusets. driver code can't assume such scenario
>>> doesn't occur, yes?
>>>
>>>
>>
>> I am ok with patch being merge as is if you add restriction for the
>> ioctl to be root only and a big comment stating that user ptr thing is
>> just abusing the kernel API and that it should not be replicated by
>> other driver except if fully understanding that all hell might break
>> loose with it.
>
>
> Oh, apology. I didn't intend to assist as is merge. Basically I agree with
> minchan. Is should be replaced get_user_pages(). I only intended to clarify
> pros/cons and where is original author's intention. If I understand
> correctly,
> MADV_DONT_FORK is best solution for this case.
>
My point is this ioctl will be restricted to one user (Xserver if i
understand) and only this user, there is no fork in it so no need to
worry about fork, just setting the vma as locked will be enough.
But i don't want people reading this driver suddenly think that what
it's doing is ok, it's not, it's hack and can never make to work
properly on a general case, that's why it needs a big comment stating,
stressing that. I just wanted to make sure Inki and Kyungmin
understood that this kind of ioctl should be restricted to carefully
selected user and that there is no way to make it general or reliable
outside that.
Cheers,
Jerome
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2012-05-11 22:22 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1335188594-17454-4-git-send-email-inki.dae@samsung.com>
[not found] ` <1336544259-17222-1-git-send-email-inki.dae@samsung.com>
[not found] ` <1336544259-17222-3-git-send-email-inki.dae@samsung.com>
2012-05-09 14:45 ` Jerome Glisse
2012-05-09 18:32 ` Jerome Glisse
2012-05-10 2:44 ` Inki Dae
2012-05-10 15:05 ` Jerome Glisse
2012-05-10 15:31 ` Daniel Vetter
2012-05-10 15:52 ` Jerome Glisse
2012-05-11 1:47 ` Inki Dae
2012-05-11 2:08 ` Minchan Kim
2012-05-10 1:39 ` Inki Dae
2012-05-10 4:58 ` Minchan Kim
2012-05-10 6:53 ` KOSAKI Motohiro
2012-05-10 7:27 ` Minchan Kim
2012-05-10 7:31 ` Kyungmin Park
2012-05-10 7:56 ` Minchan Kim
2012-05-10 7:58 ` Minchan Kim
2012-05-10 6:57 ` Inki Dae
2012-05-10 7:05 ` Minchan Kim
2012-05-10 7:59 ` InKi Dae
2012-05-10 8:11 ` Minchan Kim
2012-05-10 8:44 ` Inki Dae
2012-05-10 17:53 ` KOSAKI Motohiro
2012-05-11 0:50 ` Minchan Kim
2012-05-11 2:51 ` KOSAKI Motohiro
2012-05-11 3:01 ` Jerome Glisse
2012-05-11 21:20 ` KOSAKI Motohiro
2012-05-11 22:22 ` Jerome Glisse [this message]
2012-05-11 22:59 ` KOSAKI Motohiro
2012-05-11 23:29 ` Jerome Glisse
2012-05-11 23:39 ` KOSAKI Motohiro
2012-05-12 4:48 ` InKi Dae
2012-05-14 4:29 ` Minchan Kim
[not found] ` <1336976268-14328-1-git-send-email-inki.dae@samsung.com>
2012-05-14 8:12 ` [PATCH 0/2 v4] " Inki Dae
[not found] ` <1336976268-14328-2-git-send-email-inki.dae@samsung.com>
2012-05-14 8:12 ` [PATCH 1/2 v4] drm/exynos: added userptr limit ioctl Inki Dae
[not found] ` <1336976268-14328-3-git-send-email-inki.dae@samsung.com>
[not found] ` <CAHGf_=qv45_uuO_JWMXOQp4VymyOxVq76rGXghoNMmDh7mURKQ@mail.gmail.com>
[not found] ` <003001cd319e$263c9230$72b5b690$%dae@samsung.com>
[not found] ` <4FB0AE87.60800@gmail.com>
2012-05-14 8:13 ` [PATCH 2/2 v4] drm/exynos: added userptr feature Inki Dae
[not found] ` <CAH3drwb13T2RXgEuauGchoZUDAgL+wrv3SR66sZNyGk_6tRTFw@mail.gmail.com>
2012-05-15 4:33 ` Inki Dae
2012-05-15 14:31 ` Jerome Glisse
2012-05-16 8:49 ` Inki Dae
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='CAH3drwYu_N5kOM1dSgJw8JNv2ScNkTPLZrRbzozrsF=D2=S=kA@mail.gmail.com' \
--to=j.glisse@gmail.com \
--cc=airlied@linux.ie \
--cc=daeinki@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=inki.dae@samsung.com \
--cc=kosaki.motohiro@gmail.com \
--cc=kyungmin.park@samsung.com \
--cc=linux-mm@kvack.org \
--cc=minchan@kernel.org \
--cc=sw0312.kim@samsung.com \
/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