mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: Nico Pache <npache@redhat.com>,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org
Cc: matthew.auld@intel.com, arunpravin.paneerselvam@amd.com,
	arthurgrillo@riseup.net, davidgow@google.com, javierm@redhat.com,
	mairacanal@riseup.net, daniel@ffwll.ch, airlied@gmail.com,
	ddutile@redhat.com, kunit-dev@googlegroups.com
Subject: Re: [PATCH] kunit: drm: make DRM buddy test compatible with other pages sizes
Date: Wed, 19 Apr 2023 10:30:35 +0200	[thread overview]
Message-ID: <881c1f7e-6740-478d-2512-11a5a99563ec@amd.com> (raw)
In-Reply-To: <20230418171524.274386-1-npache@redhat.com>

Am 18.04.23 um 19:15 schrieb Nico Pache:
> The DRM buddy test uses a fixed 12 bit shift to covert from pages to
> bytes. This number is then used to confirm that (chunk_size < PAGE_SIZE)
> which can lead to a failing drm_buddy_init on systems with PAGE_SIZE > 4k.

Since the buddy allocator is used for resources which are independent of 
the CPU PAGE size the later check is actually the broken one.

E.g. neither in the buddy allocator nor in it's test cases we should 
have any of PAGE_SHIFT or PAGE_SIZE.

Otherwise the allocator wouldn't work correctly on systems with a 
PAGE_SIZE different than 4k.

Regards,
Christian.

>
> Fixes: 92937f170d3f ("drm/selftests: add drm buddy alloc range testcase")
> Signed-off-by: Nico Pache <npache@redhat.com>
> ---
>   drivers/gpu/drm/tests/drm_buddy_test.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/tests/drm_buddy_test.c b/drivers/gpu/drm/tests/drm_buddy_test.c
> index 09ee6f6af896..a62b2690d3c2 100644
> --- a/drivers/gpu/drm/tests/drm_buddy_test.c
> +++ b/drivers/gpu/drm/tests/drm_buddy_test.c
> @@ -318,8 +318,8 @@ static void mm_config(u64 *size, u64 *chunk_size)
>   	s &= -ms;
>   
>   	/* Convert from pages to bytes */
> -	*chunk_size = (u64)ms << 12;
> -	*size = (u64)s << 12;
> +	*chunk_size = (u64)ms << PAGE_SHIFT;
> +	*size = (u64)s << PAGE_SHIFT;
>   }
>   
>   static void drm_test_buddy_alloc_pathological(struct kunit *test)


  parent reply	other threads:[~2023-04-19  8:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-18 17:15 Nico Pache
2023-04-19  8:27 ` David Gow
2023-04-19  8:30 ` Christian König [this message]
2023-06-26 15:27   ` Nico Pache

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=881c1f7e-6740-478d-2512-11a5a99563ec@amd.com \
    --to=christian.koenig@amd.com \
    --cc=airlied@gmail.com \
    --cc=arthurgrillo@riseup.net \
    --cc=arunpravin.paneerselvam@amd.com \
    --cc=daniel@ffwll.ch \
    --cc=davidgow@google.com \
    --cc=ddutile@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=javierm@redhat.com \
    --cc=kunit-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mairacanal@riseup.net \
    --cc=matthew.auld@intel.com \
    --cc=npache@redhat.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

all inboxes | Powered by JetHome®