Skip to contentSkip to conversation

mm: Handle prefault for size >= 2GB

PATCH In review Sagar Arun Kamble 4 participants 11 messages Feb 13, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 mm: Handle prefault for size >= 2GB

From: "[email protected]" <[email protected]>

i915 gem_exec_reloc subtests *-31 exercise relocation entries object that is of size >=2GB. This patch will allow prefaulting >=2GB size.

Cc Daniel Vetter <[email protected]>
Cc Chris Wilson <[email protected]>
---
 include/linux/pagemap.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
include/linux/pagemap.h +4 -2
index 324c8dba..ec27ba2 100644
@@ -538,7 +538,8 @@ static inline void wait_on_page_writeback(struct page *page)
 /*
  * Fault everything in given userspace address range in.
  */
-static inline int fault_in_pages_writeable(char __user *uaddr, int size)
+static inline int fault_in_pages_writeable(char __user *uaddr,
+					   unsigned long size)
 {
 	char __user *end = uaddr + size - 1;
 
@@ -565,7 +566,8 @@ static inline int fault_in_pages_writeable(char __user *uaddr, int size)
 	return 0;
 }
 
-static inline int fault_in_pages_readable(const char __user *uaddr, int size)
+static inline int fault_in_pages_readable(const char __user *uaddr,
+					  unsigned long size)
 {
 	volatile char c;
 	const char __user *end = uaddr + size - 1;
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH 2/2 drm/i915: Handle validation of relocation object with length >=2GB

From: "[email protected]" <[email protected]>

With prefaulting extended to support >=2GB, i915 can handle relocation objects >=2GB. type conversion of length from int to unsigned long in access_ok was making the validation bail out with -EFAULT.

Testcase: igt/gem_exec_reloc/wc-31

Cc Daniel Vetter <[email protected]>
Cc Chris Wilson <[email protected]>
---
 drivers/gpu/drm/i915/i915_gem_execbuffer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem_execbuffer.c +1 -1
index 111b7f8..53a8cc7 100644
@@ -1172,7 +1172,7 @@ static bool only_mappable_for_reloc(unsigned int flags)
 
 	for (i = 0; i < count; i++) {
 		char __user *ptr = u64_to_user_ptr(exec[i].relocs_ptr);
-		int length; /* limited by fault_in_pages_readable() */
+		unsigned long length;
 
 		if (exec[i].flags & invalid_flags)
 			return -EINVAL;
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
maintainer Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] drm/i915: Handle validation of relocation object with length >=2GB

Quoted 11 lines · Sagar Arun Kamble

From: "[email protected]" <[email protected]>

With prefaulting extended to support >=2GB, i915 can handle relocation objects >=2GB. type conversion of length from int to unsigned long in access_ok was making the validation bail out with -EFAULT.

Testcase: igt/gem_exec_reloc/wc-31

Cc Daniel Vetter <[email protected]>
Cc Chris Wilson <[email protected]>

With the correct "From:" and with "size_t" as type, this is;

Regards, Joonas
--
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

Re: [PATCH 2/2] drm/i915: Handle validation of relocation object with length >=2GB

Quoted 8 lines · Joonas Lahtinen
Quoted 7 lines · Sagar Arun Kamble

From: "[email protected]" <[email protected]>

With prefaulting extended to support >=2GB, i915 can handle relocation objects >=2GB. type conversion of length from int to unsigned long in access_ok was making the validation bail out with -EFAULT.

Quoted 8 lines
Quoted 4 lines

Testcase: igt/gem_exec_reloc/wc-31

Cc Daniel Vetter <[email protected]>
Cc Chris Wilson <[email protected]>

With the correct "From:" and with "size_t" as type, this is;

My earlier comments still apply in that this is not how I fixed this years ago, and I still much prefer my fix.
-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
maintainer
#4 lore raw

Re: [PATCH 2/2] drm/i915: Handle validation of relocation object with length >=2GB

Quoted 16 lines · Chris Wilson
Quoted 15 lines · Joonas Lahtinen
Quoted 12 lines · Sagar Arun Kamble

From: "[email protected]" <[email protected]>

With prefaulting extended to support >=2GB, i915 can handle relocation objects >=2GB. type conversion of length from int to unsigned long in access_ok was making the validation bail out with -EFAULT.

Testcase: igt/gem_exec_reloc/wc-31

Cc Daniel Vetter <[email protected]>
Cc Chris Wilson <[email protected]>
Quoted 6 lines
Quoted 3 lines

With the correct "From:" and with "size_t" as type, this is;

My earlier comments still apply in that this is not how I fixed this years ago, and I still much prefer my fix.

Where are the earlier comments? I must have missed them.

Regards, Joonas

Signature · 7 lines
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw

Re: [PATCH 2/2] drm/i915: Handle validation of relocation object with length >=2GB

Quoted 17 lines · Joonas Lahtinen
Quoted 16 lines · Chris Wilson
Quoted 15 lines · Joonas Lahtinen
Quoted 12 lines · Sagar Arun Kamble

From: "[email protected]" <[email protected]>

With prefaulting extended to support >=2GB, i915 can handle relocation objects >=2GB. type conversion of length from int to unsigned long in access_ok was making the validation bail out with -EFAULT.

Testcase: igt/gem_exec_reloc/wc-31

Cc Daniel Vetter <[email protected]>
Cc Chris Wilson <[email protected]>
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

With the correct "From:" and with "size_t" as type, this is;

My earlier comments still apply in that this is not how I fixed this years ago, and I still much prefer my fix.

Where are the earlier comments? I must have missed them.

I replied to the first time this patch landed in my inbox, which might have been trybotted.
-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw

Re: [PATCH 2/2] drm/i915: Handle validation of relocation object with length >=2GB

Quoted 17 lines · Chris Wilson
Quoted 16 lines · Joonas Lahtinen
Quoted 15 lines · Chris Wilson
Quoted 14 lines · Joonas Lahtinen
Quoted 11 lines · Sagar Arun Kamble

From: "[email protected]" <[email protected]>

With prefaulting extended to support >=2GB, i915 can handle relocation objects >=2GB. type conversion of length from int to unsigned long in access_ok was making the validation bail out with -EFAULT.

Testcase: igt/gem_exec_reloc/wc-31

Cc Daniel Vetter <[email protected]>
Cc Chris Wilson <[email protected]>

With the correct "From:" and with "size_t" as type, this is;

Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
Quoted 1 line

My earlier comments still apply in that this is not how I fixed this years ago, and I still much prefer my fix.

Where are the earlier comments? I must have missed them.

I replied to the first time this patch landed in my inbox, which might have been trybotted.
-Chris

Chris, I thought those comments were about relocs_total and relocs_max values. Pasting below inputs from trybot.
------------

The abi is limited to 32b max relocs.

Please see
https://cgit.freedesktop.org/~ickle/linux-2.6/commit/?h=prescheduler&id=bcf3bca07f21a4c0c754ccecca81228c28437906
(a patch that is years overdue) in which this just evaporates. -Chris
---------

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#7 lore raw

✓ Fi.CI.BAT: success for series starting with [1/2] mm: Handle prefault for size >= 2GB

In reply to Sagar Arun Kamble
== Series Details ==

== Series Details ==

Series: series starting with [1/2] mm: Handle prefault for size >= 2GB
URL : https://patchwork.freedesktop.org/series/19533/
State : success

== Summary ==

Series 19533v1 Series without cover letter
https://patchwork.freedesktop.org/api/1.0/series/19533/revisions/1/mbox/

fi-bdw-5557u     total:252  pass:241  dwarn:0   dfail:0   fail:0   skip:11 
fi-bsw-n3050     total:252  pass:213  dwarn:0   dfail:0   fail:0   skip:39 
fi-bxt-j4205     total:252  pass:233  dwarn:0   dfail:0   fail:0   skip:19 
fi-bxt-t5700     total:83   pass:70   dwarn:0   dfail:0   fail:0   skip:12 
fi-byt-j1900     total:252  pass:225  dwarn:0   dfail:0   fail:0   skip:27 
fi-byt-n2820     total:252  pass:221  dwarn:0   dfail:0   fail:0   skip:31 
fi-hsw-4770      total:252  pass:236  dwarn:0   dfail:0   fail:0   skip:16 
fi-hsw-4770r     total:252  pass:236  dwarn:0   dfail:0   fail:0   skip:16 
fi-ilk-650       total:252  pass:202  dwarn:0   dfail:0   fail:0   skip:50 
fi-ivb-3520m     total:252  pass:234  dwarn:0   dfail:0   fail:0   skip:18 
fi-ivb-3770      total:252  pass:234  dwarn:0   dfail:0   fail:0   skip:18 
fi-kbl-7500u     total:252  pass:234  dwarn:0   dfail:0   fail:0   skip:18 
fi-skl-6260u     total:252  pass:242  dwarn:0   dfail:0   fail:0   skip:10 
fi-skl-6700hq    total:252  pass:235  dwarn:0   dfail:0   fail:0   skip:17 
fi-skl-6700k     total:252  pass:230  dwarn:4   dfail:0   fail:0   skip:18 
fi-skl-6770hq    total:252  pass:242  dwarn:0   dfail:0   fail:0   skip:10 
fi-snb-2520m     total:252  pass:224  dwarn:0   dfail:0   fail:0   skip:28 
fi-snb-2600      total:252  pass:223  dwarn:0   dfail:0   fail:0   skip:29 

f48164e93e75dbbe0bb9dac254779eeea08c0657 drm-tip: 2017y-02m-12d-11h-10m-28s UTC integration manifest 9db795c drm/i915: Handle validation of relocation object with length >=2GB
60e32db mm: Handle prefault for size >= 2GB

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3786/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

maintainer Reviewed-by on v1 1/2
#8 lore raw
In reply to Sagar Arun Kamble
Quoted 1 line · Sagar Arun Kamble

From: "[email protected]" <[email protected]>

https://kernel.org/doc/html/latest/process/submitting-patches.html#the-
canonical-patch-format

# git config --global user.name "Sagar Arun Kamble"
Quoted 6 lines

i915 gem_exec_reloc subtests *-31 exercise relocation entries object that is of size >=2GB. This patch will allow prefaulting >=2GB size.

Cc Daniel Vetter <[email protected]>
Cc Chris Wilson <[email protected]>

<SNIP>

include/linux/pagemap.h static inline void wait_on_page_writeback(struct page *page) · line 544

Quoted 9 lines
include/linux/pagemap.h +2 -1
@@ -538,7 +538,8 @@ static inline void wait_on_page_writeback(struct page *page)
  /*
   * Fault everything in given userspace address range in.
   */
-static inline int fault_in_pages_writeable(char __user *uaddr, int size)
+static inline int fault_in_pages_writeable(char __user *uaddr,
+					   unsigned long size)
  {
  	char __user *end = uaddr + size - 1;

ptrdiff_t would be more appropriate for both functions. With those and correct "From:", this is;

Regards, Joonas

Signature · 7 lines
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
maintainer
#9 lore raw
Quoted 9 lines · Joonas Lahtinen
Quoted 5 lines · Sagar Arun Kamble
include/linux/pagemap.h +2 -1
-static inline int fault_in_pages_writeable(char __user *uaddr, int size)
+static inline int fault_in_pages_writeable(char __user *uaddr,
+					   unsigned long size)

 {
  char __user *end = uaddr + size - 1;

ptrdiff_t would be more appropriate for both functions. With those and correct "From:", this is;

Actually, size_t would be more appropriate, I don't think anybody is using those negative values.

Regards, Joonas

Signature · 7 lines
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#10 lore raw
In reply to Joonas Lahtinen
Quoted 6 lines · Joonas Lahtinen
Quoted 1 line · Sagar Arun Kamble

From: "[email protected]" <[email protected]>

https://kernel.org/doc/html/latest/process/submitting-patches.html#the-
canonical-patch-format

# git config --global user.name "Sagar Arun Kamble"

Thanks Joonas. Even though ~/.gitconfig has user.name set properly "From" is not getting set properly. Will find out the problem.

Quoted 21 lines
Quoted 7 lines

i915 gem_exec_reloc subtests *-31 exercise relocation entries object that is of size >=2GB. This patch will allow prefaulting >=2GB size.

Cc Daniel Vetter <[email protected]>
Cc Chris Wilson <[email protected]>

<SNIP>

include/linux/pagemap.h static inline void wait_on_page_writeback(struct page *page) · line 544

Quoted 9 lines
include/linux/pagemap.h +2 -1
@@ -538,7 +538,8 @@ static inline void wait_on_page_writeback(struct page *page)
  /*
   * Fault everything in given userspace address range in.
   */
-static inline int fault_in_pages_writeable(char __user *uaddr, int size)
+static inline int fault_in_pages_writeable(char __user *uaddr,
+					   unsigned long size)
  {
  	char __user *end = uaddr + size - 1;

ptrdiff_t would be more appropriate for both functions. With those and correct "From:", this is;

Quoted 3 lines

Regards, Joonas

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx