From: Andrey Ryabinin <aryabinin@virtuozzo.com>
To: Souptick Joarder <jrdr.linux@gmail.com>
Cc: Matthew Wilcox <willy@infradead.org>,
Andrew Morton <akpm@linux-foundation.org>,
Mark Rutland <mark.rutland@arm.com>,
Dmitry Vyukov <dvyukov@google.com>,
Thomas Gleixner <tglx@linutronix.de>,
Greg KH <gregkh@linuxfoundation.org>,
tchibo@google.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kernel/kcov: Replace vm_insert_page with vmf_insert_page
Date: Fri, 21 Sep 2018 17:45:15 +0300 [thread overview]
Message-ID: <0c3d2ba2-29dc-ed02-0919-54d1d76a1eb1@virtuozzo.com> (raw)
In-Reply-To: <CAFqt6za6VJ7vmWEqg4JGWqRiqbfc6GYDnpUeBQ+03xdY51-GQA@mail.gmail.com>
On 09/21/2018 04:25 PM, Souptick Joarder wrote:
> On Fri, Sep 21, 2018 at 5:22 PM Andrey Ryabinin <aryabinin@virtuozzo.com> wrote:
>> On 09/21/2018 01:03 PM, Souptick Joarder wrote:
>>> On Fri, Sep 21, 2018 at 3:06 PM Andrey Ryabinin <aryabinin@virtuozzo.com> wrote:
>>>>
>>>> On 09/20/2018 10:12 PM, Souptick Joarder wrote:
>>>>> @@ -293,8 +293,9 @@ static int kcov_mmap(struct file *filep, struct vm_area_struct *vma)
>>>>> spin_unlock(&kcov->lock);
>>>>> for (off = 0; off < size; off += PAGE_SIZE) {
>>>>> page = vmalloc_to_page(kcov->area + off);
>>>>> - if (vm_insert_page(vma, vma->vm_start + off, page))
>>>>> - WARN_ONCE(1, "vm_insert_page() failed");
>>>>> + if (vmf_insert_page(vma, vma->vm_start + off, page)
>>>>> + != VM_FAULT_NOPAGE)
>>>>> + WARN_ONCE(1, "vmf_insert_page() failed");
>>>>
>>>> Nack, don't see the reason for such change, it only makes code worse.
>>>
>>> Yes, it needed.
>>
>> No, it's not needed. vm_insert_page() works perfectly fine here.
>>
>>> Going forward vm_insert_page will be converted to
>>> vmf_insert_page. As part of it, this code has to be converted to use
>>> vmf_insert_page().
>>
>> This doesn't explain why such conversion would make sense for kcov_mmap().
>
> vm_insert_page used to return errno which individual drivers have to
> map to VM_FAULT_CODE.
> There were also places where return value of vm_insert_page was
> ignored and return a
> TRUE value.
>
> As part of vm_fault_t migration patches, we have identified and clean
> up all these.
> The plan was to introduce inline wrapper vmf_insert_page(), convert all
> the page fault handlers to use it and then convert vm_insert_page to
> vmf_insert_page. By now we have converted all the page fault handlers
> to use this API.
>
> Still their are few places where vm_insert_page is called outside fault handlers
> context to map kernel page to user vma and kernel/kcov.c is one of them.
>
> Now removing vm_insert_page from those few places one by one.
>
> Going forward vm_insert_page will be removed from kernel permanently,
> so that new drivers can't use this API and create new errno to VM_FAULT_CODE
> mapping code.
>
So, to avoid addition of new code that converts errno->VM_FAULT_* you propose to add
new code that does the opposite - converts VM_FAULT_* to errno? How is that better?
And what function is going to be next? pte_none()? It is also used in fault handlers.
Are there going to be vmf_pte_none() and complete removal of pte_none() "so that new drivers
can't use pte_none() and create new pte_none() to VM_FAULT_CODE mapping code"?
Don't you see that how that doesn't make any sense?
Want vmf_insert_page() for easier error handling in fault handlers? - fine, use it in fault handlers.
But leave the vm_insert_page() for the code that has nothing to do with fault handling.
next prev parent reply other threads:[~2018-09-21 14:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-20 19:12 Souptick Joarder
2018-09-21 9:37 ` Andrey Ryabinin
2018-09-21 10:03 ` Souptick Joarder
2018-09-21 11:53 ` Andrey Ryabinin
2018-09-21 13:25 ` Souptick Joarder
2018-09-21 14:45 ` Andrey Ryabinin [this message]
2018-09-21 16:20 ` Souptick Joarder
2018-09-22 14:22 ` Matthew Wilcox
2018-09-24 7:53 ` Souptick Joarder
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=0c3d2ba2-29dc-ed02-0919-54d1d76a1eb1@virtuozzo.com \
--to=aryabinin@virtuozzo.com \
--cc=akpm@linux-foundation.org \
--cc=dvyukov@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=jrdr.linux@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=tchibo@google.com \
--cc=tglx@linutronix.de \
--cc=willy@infradead.org \
/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
all inboxes | Powered by JetHome®