diff mbox

dax: Change return type to vm_fault_t

Message ID 20180414155059.GA18015@jordon-HP-15-Notebook-PC (mailing list archive)
State Changes Requested
Headers show

Commit Message

Souptick Joarder April 14, 2018, 3:50 p.m. UTC
Use new return type vm_fault_t for fault and
huge_fault handler.

Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
Reviewed-by: Matthew Wilcox <mawilcox@microsoft.com>
---
 drivers/dax/device.c | 26 +++++++++++---------------
 1 file changed, 11 insertions(+), 15 deletions(-)

Comments

Dan Williams April 16, 2018, 4:14 p.m. UTC | #1
On Sat, Apr 14, 2018 at 8:50 AM, Souptick Joarder <jrdr.linux@gmail.com> wrote:
> Use new return type vm_fault_t for fault and
> huge_fault handler.
>
> Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
> Reviewed-by: Matthew Wilcox <mawilcox@microsoft.com>
> ---
>  drivers/dax/device.c | 26 +++++++++++---------------
>  1 file changed, 11 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/dax/device.c b/drivers/dax/device.c
> index 2137dbc..a122701 100644
> --- a/drivers/dax/device.c
> +++ b/drivers/dax/device.c
> @@ -243,11 +243,11 @@ __weak phys_addr_t dax_pgoff_to_phys(struct dev_dax *dev_dax, pgoff_t pgoff,
>         return -1;
>  }
>
> -static int __dev_dax_pte_fault(struct dev_dax *dev_dax, struct vm_fault *vmf)
> +static vm_fault_t __dev_dax_pte_fault(struct dev_dax *dev_dax,
> +                               struct vm_fault *vmf)
>  {
>         struct device *dev = &dev_dax->dev;
>         struct dax_region *dax_region;
> -       int rc = VM_FAULT_SIGBUS;
>         phys_addr_t phys;
>         pfn_t pfn;
>         unsigned int fault_size = PAGE_SIZE;
> @@ -274,17 +274,11 @@ static int __dev_dax_pte_fault(struct dev_dax *dev_dax, struct vm_fault *vmf)
>
>         pfn = phys_to_pfn_t(phys, dax_region->pfn_flags);
>
> -       rc = vm_insert_mixed(vmf->vma, vmf->address, pfn);
> -
> -       if (rc == -ENOMEM)
> -               return VM_FAULT_OOM;
> -       if (rc < 0 && rc != -EBUSY)
> -               return VM_FAULT_SIGBUS;
> -
> -       return VM_FAULT_NOPAGE;
> +       return vmf_insert_mixed(vmf->vma, vmf->address, pfn);

Ugh, so this change to vmf_insert_mixed() went upstream without fixing
the users? This changelog is now misleading as it does not mention
that is now an urgent standalone fix. On first read I assumed this was
part of a wider effort for 4.18.

Grumble, we'll get this applied with a 'Fixes: 1c8f422059ae ("mm:
change return type to vm_fault_t")' tag.
Randy Dunlap April 16, 2018, 4:29 p.m. UTC | #2
On 04/16/2018 09:14 AM, Dan Williams wrote:
> On Sat, Apr 14, 2018 at 8:50 AM, Souptick Joarder <jrdr.linux@gmail.com> wrote:
>> Use new return type vm_fault_t for fault and
>> huge_fault handler.
>>
>> Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
>> Reviewed-by: Matthew Wilcox <mawilcox@microsoft.com>
>> ---
>>  drivers/dax/device.c | 26 +++++++++++---------------
>>  1 file changed, 11 insertions(+), 15 deletions(-)
>>
>> diff --git a/drivers/dax/device.c b/drivers/dax/device.c
>> index 2137dbc..a122701 100644
>> --- a/drivers/dax/device.c
>> +++ b/drivers/dax/device.c
>> @@ -243,11 +243,11 @@ __weak phys_addr_t dax_pgoff_to_phys(struct dev_dax *dev_dax, pgoff_t pgoff,
>>         return -1;
>>  }
>>
>> -static int __dev_dax_pte_fault(struct dev_dax *dev_dax, struct vm_fault *vmf)
>> +static vm_fault_t __dev_dax_pte_fault(struct dev_dax *dev_dax,
>> +                               struct vm_fault *vmf)
>>  {
>>         struct device *dev = &dev_dax->dev;
>>         struct dax_region *dax_region;
>> -       int rc = VM_FAULT_SIGBUS;
>>         phys_addr_t phys;
>>         pfn_t pfn;
>>         unsigned int fault_size = PAGE_SIZE;
>> @@ -274,17 +274,11 @@ static int __dev_dax_pte_fault(struct dev_dax *dev_dax, struct vm_fault *vmf)
>>
>>         pfn = phys_to_pfn_t(phys, dax_region->pfn_flags);
>>
>> -       rc = vm_insert_mixed(vmf->vma, vmf->address, pfn);
>> -
>> -       if (rc == -ENOMEM)
>> -               return VM_FAULT_OOM;
>> -       if (rc < 0 && rc != -EBUSY)
>> -               return VM_FAULT_SIGBUS;
>> -
>> -       return VM_FAULT_NOPAGE;
>> +       return vmf_insert_mixed(vmf->vma, vmf->address, pfn);
> 
> Ugh, so this change to vmf_insert_mixed() went upstream without fixing
> the users? This changelog is now misleading as it does not mention
> that is now an urgent standalone fix. On first read I assumed this was
> part of a wider effort for 4.18.
> 
> Grumble, we'll get this applied with a 'Fixes: 1c8f422059ae ("mm:
> change return type to vm_fault_t")' tag.
> 

Thanks for that explanation. The patch description is missing any kind
of "why" (justification).
Souptick Joarder April 16, 2018, 4:38 p.m. UTC | #3
On Mon, Apr 16, 2018 at 9:59 PM, Randy Dunlap <rdunlap@infradead.org> wrote:
> On 04/16/2018 09:14 AM, Dan Williams wrote:
>> On Sat, Apr 14, 2018 at 8:50 AM, Souptick Joarder <jrdr.linux@gmail.com> wrote:
>>> Use new return type vm_fault_t for fault and
>>> huge_fault handler.
>>>
>>> Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
>>> Reviewed-by: Matthew Wilcox <mawilcox@microsoft.com>
>>> ---
>>>  drivers/dax/device.c | 26 +++++++++++---------------
>>>  1 file changed, 11 insertions(+), 15 deletions(-)
>>>
>>> diff --git a/drivers/dax/device.c b/drivers/dax/device.c
>>> index 2137dbc..a122701 100644
>>> --- a/drivers/dax/device.c
>>> +++ b/drivers/dax/device.c
>>> @@ -243,11 +243,11 @@ __weak phys_addr_t dax_pgoff_to_phys(struct dev_dax *dev_dax, pgoff_t pgoff,
>>>         return -1;
>>>  }
>>>
>>> -static int __dev_dax_pte_fault(struct dev_dax *dev_dax, struct vm_fault *vmf)
>>> +static vm_fault_t __dev_dax_pte_fault(struct dev_dax *dev_dax,
>>> +                               struct vm_fault *vmf)
>>>  {
>>>         struct device *dev = &dev_dax->dev;
>>>         struct dax_region *dax_region;
>>> -       int rc = VM_FAULT_SIGBUS;
>>>         phys_addr_t phys;
>>>         pfn_t pfn;
>>>         unsigned int fault_size = PAGE_SIZE;
>>> @@ -274,17 +274,11 @@ static int __dev_dax_pte_fault(struct dev_dax *dev_dax, struct vm_fault *vmf)
>>>
>>>         pfn = phys_to_pfn_t(phys, dax_region->pfn_flags);
>>>
>>> -       rc = vm_insert_mixed(vmf->vma, vmf->address, pfn);
>>> -
>>> -       if (rc == -ENOMEM)
>>> -               return VM_FAULT_OOM;
>>> -       if (rc < 0 && rc != -EBUSY)
>>> -               return VM_FAULT_SIGBUS;
>>> -
>>> -       return VM_FAULT_NOPAGE;
>>> +       return vmf_insert_mixed(vmf->vma, vmf->address, pfn);
>>
>> Ugh, so this change to vmf_insert_mixed() went upstream without fixing
>> the users? This changelog is now misleading as it does not mention
>> that is now an urgent standalone fix. On first read I assumed this was
>> part of a wider effort for 4.18.
>>
>> Grumble, we'll get this applied with a 'Fixes: 1c8f422059ae ("mm:
>> change return type to vm_fault_t")' tag.
>>
>
> Thanks for that explanation. The patch description is missing any kind
> of "why" (justification).

ok, I will send v2 with description.

>
>
> --
> ~Randy
Matthew Wilcox (Oracle) April 16, 2018, 5:47 p.m. UTC | #4
On Mon, Apr 16, 2018 at 09:14:48AM -0700, Dan Williams wrote:
> > -       rc = vm_insert_mixed(vmf->vma, vmf->address, pfn);
> > -
> > -       if (rc == -ENOMEM)
> > -               return VM_FAULT_OOM;
> > -       if (rc < 0 && rc != -EBUSY)
> > -               return VM_FAULT_SIGBUS;
> > -
> > -       return VM_FAULT_NOPAGE;
> > +       return vmf_insert_mixed(vmf->vma, vmf->address, pfn);
> 
> Ugh, so this change to vmf_insert_mixed() went upstream without fixing
> the users? This changelog is now misleading as it does not mention
> that is now an urgent standalone fix. On first read I assumed this was
> part of a wider effort for 4.18.

You read too quickly.  vmf_insert_mixed() is a *new* function which
*replaces* vm_insert_mixed() and
awful-mangling-of-return-values-done-per-driver.

Eventually vm_insert_mixed() will be deleted.  But today is not that day.
Dan Williams April 16, 2018, 6 p.m. UTC | #5
On Mon, Apr 16, 2018 at 10:47 AM, Matthew Wilcox <willy@infradead.org> wrote:
> On Mon, Apr 16, 2018 at 09:14:48AM -0700, Dan Williams wrote:
>> > -       rc = vm_insert_mixed(vmf->vma, vmf->address, pfn);
>> > -
>> > -       if (rc == -ENOMEM)
>> > -               return VM_FAULT_OOM;
>> > -       if (rc < 0 && rc != -EBUSY)
>> > -               return VM_FAULT_SIGBUS;
>> > -
>> > -       return VM_FAULT_NOPAGE;
>> > +       return vmf_insert_mixed(vmf->vma, vmf->address, pfn);
>>
>> Ugh, so this change to vmf_insert_mixed() went upstream without fixing
>> the users? This changelog is now misleading as it does not mention
>> that is now an urgent standalone fix. On first read I assumed this was
>> part of a wider effort for 4.18.
>
> You read too quickly.  vmf_insert_mixed() is a *new* function which
> *replaces* vm_insert_mixed() and
> awful-mangling-of-return-values-done-per-driver.
>
> Eventually vm_insert_mixed() will be deleted.  But today is not that day.

Ah, ok, thanks for the clarification. Then this patch should
definitely be re-titled to "dax: convert to the new vmf_insert_mixed()
helper". The vm_fault_t conversion is just a minor side-effect of that
larger change. I assume this can wait for v4.18.
Matthew Wilcox (Oracle) April 16, 2018, 6:21 p.m. UTC | #6
On Mon, Apr 16, 2018 at 11:00:26AM -0700, Dan Williams wrote:
> On Mon, Apr 16, 2018 at 10:47 AM, Matthew Wilcox <willy@infradead.org> wrote:
> > On Mon, Apr 16, 2018 at 09:14:48AM -0700, Dan Williams wrote:
> >> > -       rc = vm_insert_mixed(vmf->vma, vmf->address, pfn);
> >> > -
> >> > -       if (rc == -ENOMEM)
> >> > -               return VM_FAULT_OOM;
> >> > -       if (rc < 0 && rc != -EBUSY)
> >> > -               return VM_FAULT_SIGBUS;
> >> > -
> >> > -       return VM_FAULT_NOPAGE;
> >> > +       return vmf_insert_mixed(vmf->vma, vmf->address, pfn);
> >>
> >> Ugh, so this change to vmf_insert_mixed() went upstream without fixing
> >> the users? This changelog is now misleading as it does not mention
> >> that is now an urgent standalone fix. On first read I assumed this was
> >> part of a wider effort for 4.18.
> >
> > You read too quickly.  vmf_insert_mixed() is a *new* function which
> > *replaces* vm_insert_mixed() and
> > awful-mangling-of-return-values-done-per-driver.
> >
> > Eventually vm_insert_mixed() will be deleted.  But today is not that day.
> 
> Ah, ok, thanks for the clarification. Then this patch should
> definitely be re-titled to "dax: convert to the new vmf_insert_mixed()
> helper". The vm_fault_t conversion is just a minor side-effect of that
> larger change. I assume this can wait for v4.18.

Yes, no particular hurry.
Souptick Joarder April 16, 2018, 6:28 p.m. UTC | #7
On Mon, Apr 16, 2018 at 11:51 PM, Matthew Wilcox <willy@infradead.org> wrote:
> On Mon, Apr 16, 2018 at 11:00:26AM -0700, Dan Williams wrote:
>> On Mon, Apr 16, 2018 at 10:47 AM, Matthew Wilcox <willy@infradead.org> wrote:
>> > On Mon, Apr 16, 2018 at 09:14:48AM -0700, Dan Williams wrote:
>> >> > -       rc = vm_insert_mixed(vmf->vma, vmf->address, pfn);
>> >> > -
>> >> > -       if (rc == -ENOMEM)
>> >> > -               return VM_FAULT_OOM;
>> >> > -       if (rc < 0 && rc != -EBUSY)
>> >> > -               return VM_FAULT_SIGBUS;
>> >> > -
>> >> > -       return VM_FAULT_NOPAGE;
>> >> > +       return vmf_insert_mixed(vmf->vma, vmf->address, pfn);
>> >>
>> >> Ugh, so this change to vmf_insert_mixed() went upstream without fixing
>> >> the users? This changelog is now misleading as it does not mention
>> >> that is now an urgent standalone fix. On first read I assumed this was
>> >> part of a wider effort for 4.18.
>> >
>> > You read too quickly.  vmf_insert_mixed() is a *new* function which
>> > *replaces* vm_insert_mixed() and
>> > awful-mangling-of-return-values-done-per-driver.
>> >
>> > Eventually vm_insert_mixed() will be deleted.  But today is not that day.
>>
>> Ah, ok, thanks for the clarification. Then this patch should
>> definitely be re-titled to "dax: convert to the new vmf_insert_mixed()
>> helper". The vm_fault_t conversion is just a minor side-effect of that
>> larger change. I assume this can wait for v4.18.

The primary objective is to change the return type to
vm_fault_t in all fault handlers and to support that
we have replace vm_insert_mixed() with vmf_insert_
mixed() within one fault handler function.

Do I really need to change the patch title ?
Dan Williams April 16, 2018, 6:35 p.m. UTC | #8
On Mon, Apr 16, 2018 at 11:28 AM, Souptick Joarder <jrdr.linux@gmail.com> wrote:
> On Mon, Apr 16, 2018 at 11:51 PM, Matthew Wilcox <willy@infradead.org> wrote:
>> On Mon, Apr 16, 2018 at 11:00:26AM -0700, Dan Williams wrote:
>>> On Mon, Apr 16, 2018 at 10:47 AM, Matthew Wilcox <willy@infradead.org> wrote:
>>> > On Mon, Apr 16, 2018 at 09:14:48AM -0700, Dan Williams wrote:
>>> >> > -       rc = vm_insert_mixed(vmf->vma, vmf->address, pfn);
>>> >> > -
>>> >> > -       if (rc == -ENOMEM)
>>> >> > -               return VM_FAULT_OOM;
>>> >> > -       if (rc < 0 && rc != -EBUSY)
>>> >> > -               return VM_FAULT_SIGBUS;
>>> >> > -
>>> >> > -       return VM_FAULT_NOPAGE;
>>> >> > +       return vmf_insert_mixed(vmf->vma, vmf->address, pfn);
>>> >>
>>> >> Ugh, so this change to vmf_insert_mixed() went upstream without fixing
>>> >> the users? This changelog is now misleading as it does not mention
>>> >> that is now an urgent standalone fix. On first read I assumed this was
>>> >> part of a wider effort for 4.18.
>>> >
>>> > You read too quickly.  vmf_insert_mixed() is a *new* function which
>>> > *replaces* vm_insert_mixed() and
>>> > awful-mangling-of-return-values-done-per-driver.
>>> >
>>> > Eventually vm_insert_mixed() will be deleted.  But today is not that day.
>>>
>>> Ah, ok, thanks for the clarification. Then this patch should
>>> definitely be re-titled to "dax: convert to the new vmf_insert_mixed()
>>> helper". The vm_fault_t conversion is just a minor side-effect of that
>>> larger change. I assume this can wait for v4.18.
>
> The primary objective is to change the return type to
> vm_fault_t in all fault handlers and to support that
> we have replace vm_insert_mixed() with vmf_insert_
> mixed() within one fault handler function.
>
> Do I really need to change the patch title ?

At this point, yes, or at least mention the vm_insert_mixed -->
vmf_insert_mixed conversion in the changelog.
Souptick Joarder April 16, 2018, 6:37 p.m. UTC | #9
On Tue, Apr 17, 2018 at 12:05 AM, Dan Williams <dan.j.williams@intel.com> wrote:
> On Mon, Apr 16, 2018 at 11:28 AM, Souptick Joarder <jrdr.linux@gmail.com> wrote:
>> On Mon, Apr 16, 2018 at 11:51 PM, Matthew Wilcox <willy@infradead.org> wrote:
>>> On Mon, Apr 16, 2018 at 11:00:26AM -0700, Dan Williams wrote:
>>>> On Mon, Apr 16, 2018 at 10:47 AM, Matthew Wilcox <willy@infradead.org> wrote:
>>>> > On Mon, Apr 16, 2018 at 09:14:48AM -0700, Dan Williams wrote:
>>>> >> > -       rc = vm_insert_mixed(vmf->vma, vmf->address, pfn);
>>>> >> > -
>>>> >> > -       if (rc == -ENOMEM)
>>>> >> > -               return VM_FAULT_OOM;
>>>> >> > -       if (rc < 0 && rc != -EBUSY)
>>>> >> > -               return VM_FAULT_SIGBUS;
>>>> >> > -
>>>> >> > -       return VM_FAULT_NOPAGE;
>>>> >> > +       return vmf_insert_mixed(vmf->vma, vmf->address, pfn);
>>>> >>
>>>> >> Ugh, so this change to vmf_insert_mixed() went upstream without fixing
>>>> >> the users? This changelog is now misleading as it does not mention
>>>> >> that is now an urgent standalone fix. On first read I assumed this was
>>>> >> part of a wider effort for 4.18.
>>>> >
>>>> > You read too quickly.  vmf_insert_mixed() is a *new* function which
>>>> > *replaces* vm_insert_mixed() and
>>>> > awful-mangling-of-return-values-done-per-driver.
>>>> >
>>>> > Eventually vm_insert_mixed() will be deleted.  But today is not that day.
>>>>
>>>> Ah, ok, thanks for the clarification. Then this patch should
>>>> definitely be re-titled to "dax: convert to the new vmf_insert_mixed()
>>>> helper". The vm_fault_t conversion is just a minor side-effect of that
>>>> larger change. I assume this can wait for v4.18.
>>
>> The primary objective is to change the return type to
>> vm_fault_t in all fault handlers and to support that
>> we have replace vm_insert_mixed() with vmf_insert_
>> mixed() within one fault handler function.
>>
>> Do I really need to change the patch title ?
>
> At this point, yes, or at least mention the vm_insert_mixed -->
> vmf_insert_mixed conversion in the changelog.

Ok, I will add this in change log and send v2.
Randy Dunlap April 16, 2018, 6:41 p.m. UTC | #10
On 04/16/2018 11:37 AM, Souptick Joarder wrote:
> On Tue, Apr 17, 2018 at 12:05 AM, Dan Williams <dan.j.williams@intel.com> wrote:
>> On Mon, Apr 16, 2018 at 11:28 AM, Souptick Joarder <jrdr.linux@gmail.com> wrote:
>>> On Mon, Apr 16, 2018 at 11:51 PM, Matthew Wilcox <willy@infradead.org> wrote:
>>>> On Mon, Apr 16, 2018 at 11:00:26AM -0700, Dan Williams wrote:
>>>>> On Mon, Apr 16, 2018 at 10:47 AM, Matthew Wilcox <willy@infradead.org> wrote:
>>>>>> On Mon, Apr 16, 2018 at 09:14:48AM -0700, Dan Williams wrote:
>>>>>>>> -       rc = vm_insert_mixed(vmf->vma, vmf->address, pfn);
>>>>>>>> -
>>>>>>>> -       if (rc == -ENOMEM)
>>>>>>>> -               return VM_FAULT_OOM;
>>>>>>>> -       if (rc < 0 && rc != -EBUSY)
>>>>>>>> -               return VM_FAULT_SIGBUS;
>>>>>>>> -
>>>>>>>> -       return VM_FAULT_NOPAGE;
>>>>>>>> +       return vmf_insert_mixed(vmf->vma, vmf->address, pfn);
>>>>>>>
>>>>>>> Ugh, so this change to vmf_insert_mixed() went upstream without fixing
>>>>>>> the users? This changelog is now misleading as it does not mention
>>>>>>> that is now an urgent standalone fix. On first read I assumed this was
>>>>>>> part of a wider effort for 4.18.
>>>>>>
>>>>>> You read too quickly.  vmf_insert_mixed() is a *new* function which
>>>>>> *replaces* vm_insert_mixed() and
>>>>>> awful-mangling-of-return-values-done-per-driver.
>>>>>>
>>>>>> Eventually vm_insert_mixed() will be deleted.  But today is not that day.
>>>>>
>>>>> Ah, ok, thanks for the clarification. Then this patch should
>>>>> definitely be re-titled to "dax: convert to the new vmf_insert_mixed()
>>>>> helper". The vm_fault_t conversion is just a minor side-effect of that
>>>>> larger change. I assume this can wait for v4.18.
>>>
>>> The primary objective is to change the return type to
>>> vm_fault_t in all fault handlers and to support that
>>> we have replace vm_insert_mixed() with vmf_insert_
>>> mixed() within one fault handler function.
>>>
>>> Do I really need to change the patch title ?
>>
>> At this point, yes, or at least mention the vm_insert_mixed -->
>> vmf_insert_mixed conversion in the changelog.
> 
> Ok, I will add this in change log and send v2.
> 

and please try to use more columns per line of text.

E.g. from the uio: patch:

Use new return type vm_fault_t for fault handler
in struct vm_operations_struct. For now, this is
just documenting that the function returns a VM_
FAULT value rather than an errno.  Once all inst
ances are converted, vm_fault_t will become a di
stinct type


Several of those lines are chopped at odd places.
Theodore Ts'o April 17, 2018, 12:14 a.m. UTC | #11
On Mon, Apr 16, 2018 at 09:14:48AM -0700, Dan Williams wrote:
> Ugh, so this change to vmf_insert_mixed() went upstream without fixing
> the users? This changelog is now misleading as it does not mention
> that is now an urgent standalone fix. On first read I assumed this was
> part of a wider effort for 4.18.

Why is this an urgent fix?  I thought all the return type change was
did something completely innocuous that would not cause any real
difference.

Otherwise there are a dozen plus "fixups" to change the users that
will now become urgent fixes, which I did *not* expect to be the case.
(Where two are in ext2 and ext4, and where I planned to take my time
and get them fixed in the next merge window, precisely becuase I did
not *think* they were urgent.)

    	    	 			- Ted
Matthew Wilcox (Oracle) April 17, 2018, 12:19 a.m. UTC | #12
On Mon, Apr 16, 2018 at 08:14:22PM -0400, Theodore Y. Ts'o wrote:
> On Mon, Apr 16, 2018 at 09:14:48AM -0700, Dan Williams wrote:
> > Ugh, so this change to vmf_insert_mixed() went upstream without fixing
> > the users? This changelog is now misleading as it does not mention
> > that is now an urgent standalone fix. On first read I assumed this was
> > part of a wider effort for 4.18.
> 
> Why is this an urgent fix?  I thought all the return type change was
> did something completely innocuous that would not cause any real
> difference.

Keep reading the thread; Dan is mistaken.
Dan Williams April 17, 2018, 4:08 a.m. UTC | #13
On Mon, Apr 16, 2018 at 5:19 PM, Matthew Wilcox <willy@infradead.org> wrote:
> On Mon, Apr 16, 2018 at 08:14:22PM -0400, Theodore Y. Ts'o wrote:
>> On Mon, Apr 16, 2018 at 09:14:48AM -0700, Dan Williams wrote:
>> > Ugh, so this change to vmf_insert_mixed() went upstream without fixing
>> > the users? This changelog is now misleading as it does not mention
>> > that is now an urgent standalone fix. On first read I assumed this was
>> > part of a wider effort for 4.18.
>>
>> Why is this an urgent fix?  I thought all the return type change was
>> did something completely innocuous that would not cause any real
>> difference.
>
> Keep reading the thread; Dan is mistaken.

Yes, false alarm, sorry. But we at least got a better changelog for the trouble.
diff mbox

Patch

diff --git a/drivers/dax/device.c b/drivers/dax/device.c
index 2137dbc..a122701 100644
--- a/drivers/dax/device.c
+++ b/drivers/dax/device.c
@@ -243,11 +243,11 @@  __weak phys_addr_t dax_pgoff_to_phys(struct dev_dax *dev_dax, pgoff_t pgoff,
 	return -1;
 }
 
-static int __dev_dax_pte_fault(struct dev_dax *dev_dax, struct vm_fault *vmf)
+static vm_fault_t __dev_dax_pte_fault(struct dev_dax *dev_dax,
+				struct vm_fault *vmf)
 {
 	struct device *dev = &dev_dax->dev;
 	struct dax_region *dax_region;
-	int rc = VM_FAULT_SIGBUS;
 	phys_addr_t phys;
 	pfn_t pfn;
 	unsigned int fault_size = PAGE_SIZE;
@@ -274,17 +274,11 @@  static int __dev_dax_pte_fault(struct dev_dax *dev_dax, struct vm_fault *vmf)
 
 	pfn = phys_to_pfn_t(phys, dax_region->pfn_flags);
 
-	rc = vm_insert_mixed(vmf->vma, vmf->address, pfn);
-
-	if (rc == -ENOMEM)
-		return VM_FAULT_OOM;
-	if (rc < 0 && rc != -EBUSY)
-		return VM_FAULT_SIGBUS;
-
-	return VM_FAULT_NOPAGE;
+	return vmf_insert_mixed(vmf->vma, vmf->address, pfn);
 }
 
-static int __dev_dax_pmd_fault(struct dev_dax *dev_dax, struct vm_fault *vmf)
+static vm_fault_t __dev_dax_pmd_fault(struct dev_dax *dev_dax,
+				struct vm_fault *vmf)
 {
 	unsigned long pmd_addr = vmf->address & PMD_MASK;
 	struct device *dev = &dev_dax->dev;
@@ -335,7 +329,8 @@  static int __dev_dax_pmd_fault(struct dev_dax *dev_dax, struct vm_fault *vmf)
 }
 
 #ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD
-static int __dev_dax_pud_fault(struct dev_dax *dev_dax, struct vm_fault *vmf)
+static vm_fault_t __dev_dax_pud_fault(struct dev_dax *dev_dax,
+				struct vm_fault *vmf)
 {
 	unsigned long pud_addr = vmf->address & PUD_MASK;
 	struct device *dev = &dev_dax->dev;
@@ -386,13 +381,14 @@  static int __dev_dax_pud_fault(struct dev_dax *dev_dax, struct vm_fault *vmf)
 			vmf->flags & FAULT_FLAG_WRITE);
 }
 #else
-static int __dev_dax_pud_fault(struct dev_dax *dev_dax, struct vm_fault *vmf)
+static vm_fault_t __dev_dax_pud_fault(struct dev_dax *dev_dax,
+				struct vm_fault *vmf)
 {
 	return VM_FAULT_FALLBACK;
 }
 #endif /* !CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD */
 
-static int dev_dax_huge_fault(struct vm_fault *vmf,
+static vm_fault_t dev_dax_huge_fault(struct vm_fault *vmf,
 		enum page_entry_size pe_size)
 {
 	int rc, id;
@@ -423,7 +419,7 @@  static int dev_dax_huge_fault(struct vm_fault *vmf,
 	return rc;
 }
 
-static int dev_dax_fault(struct vm_fault *vmf)
+static vm_fault_t dev_dax_fault(struct vm_fault *vmf)
 {
 	return dev_dax_huge_fault(vmf, PE_SIZE_PTE);
 }