Skip to contentSkip to conversation

drm/xe: Align size to PAGE_SIZE

PATCH In review Pallavi Mishra 3 participants 4 messages Sep 20, 2023

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

PATCH 1/1 drm/xe: Align size to PAGE_SIZE

Ensure alignment with PAGE_SIZE for the size parameter passed to __xe_bo_create_locked()

---
 drivers/gpu/drm/xe/xe_bo.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/xe/xe_bo.c +3 -0
index 1ab682d61e3c..014d084632f2 100644
@@ -1199,6 +1199,9 @@ struct xe_bo *__xe_bo_create_locked(struct xe_device *xe, struct xe_bo *bo,
 	/* Only kernel objects should set GT */
 	XE_WARN_ON(tile && type != ttm_bo_type_kernel);
 
+	if ((size & (PAGE_SIZE - 1)) != 0)
+		size = (size + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1);
+
 	if (XE_WARN_ON(!size)) {
 		xe_bo_free(bo);
 		return ERR_PTR(-EINVAL);
Signature · 1 line
2.25.1
#1 lore raw

[Intel-xe] ✗ CI.Patch_applied: failure for drm/xe: Align size to PAGE_SIZE

== Series Details ==

== Series Details ==

Series: drm/xe: Align size to PAGE_SIZE
URL : https://patchwork.freedesktop.org/series/123997/
State : failure

== Summary ==

=== Applying kernel patches on branch 'drm-xe-next' with base: === Base commit: 805557401 fixup! drm/xe/display: Implement display support === git am output follows ===
error: patch failed: drivers/gpu/drm/xe/xe_bo.c:1199
error: drivers/gpu/drm/xe/xe_bo.c: patch does not apply
hint: Use 'git am --show-current-patch' to see the failed patch
Applying: drm/xe: Align size to PAGE_SIZE
Patch failed at 0001 drm/xe: Align size to PAGE_SIZE
When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".

#2 lore raw
In reply to Pallavi Mishra
Quoted 13 lines · Pallavi Mishra

Ensure alignment with PAGE_SIZE for the size parameter passed to __xe_bo_create_locked()

---
drivers/gpu/drm/xe/xe_bo.c | 3 +++

1 file changed, 3 insertions(+)
drivers/gpu/drm/xe/xe_bo.c +0 -0
index 1ab682d61e3c..014d084632f2 100644

drivers/gpu/drm/xe/xe_bo.c struct xe_bo *__xe_bo_create_locked(struct xe_device *xe, struct xe_bo *bo, · line 1202

Quoted 4 lines
drivers/gpu/drm/xe/xe_bo.c +1 -0
@@ -1199,6 +1199,9 @@ struct xe_bo *__xe_bo_create_locked(struct xe_device *xe, struct xe_bo *bo,
 	/* Only kernel objects should set GT */
 	XE_WARN_ON(tile && type != ttm_bo_type_kernel);
 
+	if ((size & (PAGE_SIZE - 1)) != 0)

ALIGN()... but note that there is already a call to ALIGN() a few lines below this hunk. Probably missing the size = ALIGN(size, PAGE_SIZE) in the else condition?

Lucas De Marchi

Quoted 8 lines
drivers/gpu/drm/xe/xe_bo.c +2 -0
+		size = (size + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1);
+
 	if (XE_WARN_ON(!size)) {
 		xe_bo_free(bo);
 		return ERR_PTR(-EINVAL);
Signature · 1 line
2.25.1
#3 lore raw
Quoted 26 lines

-----Original Message-----
From: De Marchi, Lucas <[email protected]>
Sent: Wednesday, September 20, 2023 12:25 PM
To: Mishra, Pallavi <[email protected]>
Cc: [email protected]; Summers, Stuart <[email protected]>; Roper, Matthew D <[email protected]>
Subject: Re: [Intel-xe] [PATCH] drm/xe: Align size to PAGE_SIZE

drivers/gpu/drm/xe/xe_bo.c struct xe_bo *__xe_bo_create_locked(struct

Quoted 13 lines · Pallavi Mishra

Ensure alignment with PAGE_SIZE for the size parameter passed to __xe_bo_create_locked()

---
drivers/gpu/drm/xe/xe_bo.c | 3 +++

1 file changed, 3 insertions(+)
drivers/gpu/drm/xe/xe_bo.c +0 -0
index 1ab682d61e3c..014d084632f2 100644
@@ -1199,6 +1199,9 @@ struct xe_bo *__xe_bo_create_locked(struct

xe_device *xe, struct xe_bo *bo,

Quoted 9 lines

drivers/gpu/drm/xe/xe_bo.c struct xe_bo *__xe_bo_create_locked(struct xe_device *xe, struct xe_bo *bo, · line 1202

Quoted 4 lines
drivers/gpu/drm/xe/xe_bo.c +1 -0
 	/* Only kernel objects should set GT */
 	XE_WARN_ON(tile && type != ttm_bo_type_kernel);
 
+	if ((size & (PAGE_SIZE - 1)) != 0)

ALIGN()... but note that there is already a call to ALIGN() a few lines below this hunk. Probably missing the size = ALIGN(size, PAGE_SIZE) in the else condition?

Yes. Let me add that under else.

Thanks!

Quoted 10 lines

Lucas De Marchi

Quoted 8 lines
drivers/gpu/drm/xe/xe_bo.c +2 -1
+		size = (size + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1);
+
 	if (XE_WARN_ON(!size)) {
 		xe_bo_free(bo);
 		return ERR_PTR(-EINVAL);
--

2.25.1