Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Bernatowicz, Marcin" <marcin.bernatowicz@linux.intel.com>
To: Michal Wajdeczko <michal.wajdeczko@intel.com>,
	Kamil Konieczny <kamil.konieczny@linux.intel.com>,
	igt-dev@lists.freedesktop.org,
	Tvrtko Ursulin <tursulin@ursulin.net>,
	Tvrtko Ursulin <tursulin@igalia.com>,
	zbigniew.kempczynski@intel.com, lukasz.laguna@intel.com
Subject: Re: [PATCH v2 i-g-t 2/2] benchmarks/gem_wsim: Fix mmap for discrete graphics cards
Date: Thu, 25 Jul 2024 11:52:14 +0200	[thread overview]
Message-ID: <1d9377cd-0608-4bce-a3b7-2f0c0116bfdb@linux.intel.com> (raw)
In-Reply-To: <2b651d12-6a40-43b2-bff1-92dfce927099@intel.com>



On 7/25/2024 11:06 AM, Michal Wajdeczko wrote:
> 
> 
> On 25.07.2024 09:26, Bernatowicz, Marcin wrote:
>> Hi Kamil,
>>
>> On 7/23/2024 12:36 PM, Kamil Konieczny wrote:
>>> Hi Marcin,
>>> On 2023-12-14 at 21:13:02 +0100, Marcin Bernatowicz wrote:
>>>> It appears that 'gem_mmap__wc' doesn't work for discrete graphics cards
>>>> and 'I915_MMAP_OFFSET_FIXED' is needed instead.
>>>> Adopt the mapping approach from 'lib/igt_dummyload'.
>>>>
>>>> Signed-off-by: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
>>>> ---
>>>>    benchmarks/gem_wsim.c | 11 ++++++++++-
>>>>    1 file changed, 10 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c
>>>> index a1db37d4e..eafd9cab8 100644
>>>> --- a/benchmarks/gem_wsim.c
>>>> +++ b/benchmarks/gem_wsim.c
>>>> @@ -1502,7 +1502,16 @@ static unsigned int create_bb(struct w_step
>>>> *w, int self)
>>>>        gem_set_domain(fd, w->bb_handle,
>>>>                   I915_GEM_DOMAIN_WC, I915_GEM_DOMAIN_WC);
>>>>    -    cs = ptr = gem_mmap__wc(fd, w->bb_handle, 0, w->bb_size,
>>>> PROT_WRITE);
>>>> +    if (__gem_set_caching(fd, w->bb_handle,
>>>> +                  I915_CACHING_CACHED) == 0) {
>>>> +        cs = ptr = gem_mmap__cpu(fd, w->bb_handle,
>>>> +                       0, w->bb_size,
>>>> +                       PROT_READ | PROT_WRITE);
>>>> +    } else
>>>
>>> Be consistent, use brace after 'else':
>>>      } else {
>>>
>>>> +        cs = ptr = gem_mmap__device_coherent(fd,
>>>> +                               w->bb_handle,
>>>> +                               0, w->bb_size,
>>>> +                               PROT_READ | PROT_WRITE);
>>>
>>> so it will look like:
>>>      } else {
>>>          cs = ptr = gem_mmap__device_coherent(fd, w->bb_handle, 0,
>>>                               w->bb_size,
>>>                               PROT_READ | PROT_WRITE);
>>>      }
>> ok
>>>
>>> Please use checkpatch.pl script from Linux kernel, it could spot
>>> such problems, see also CONTRIBUTE.md for some helpful options.
>>
>> Strange, I did run checkpatch.pl but it didn't shout:
>>
>> -----------------------------------------------------------------
>> ./0001-benchmarks-gem_wsim-Support-gens-without-relocations.patch
>> -----------------------------------------------------------------
>> total: 0 errors, 0 warnings, 230 lines checked
>>
>> ./0001-benchmarks-gem_wsim-Support-gens-without-relocations.patch has no
>> obvious style problems and is ready for submission.
>> -----------------------------------------------------------------
>> ./0002-benchmarks-gem_wsim-Fix-mmap-for-discrete-graphics-c.patch
>> -----------------------------------------------------------------
>> total: 0 errors, 0 warnings, 17 lines checked
>>
> 
> try with --strict option
> 
> CHECK: multiple assignments should be avoided
> #12: FILE: benchmarks/gem_wsim.c:1507:
> +               cs = ptr = gem_mmap__cpu(fd, w->bb_handle,
> 
> CHECK: Unbalanced braces around else statement
> #15: FILE: benchmarks/gem_wsim.c:1510:
> +       } else
> 
> CHECK: multiple assignments should be avoided
> #16: FILE: benchmarks/gem_wsim.c:1511:
> +               cs = ptr = gem_mmap__device_coherent(fd,
> 
> total: 0 errors, 0 warnings, 3 checks, 17 lines checked
>

Thanks, my bad, I missed the options mentioned in CONTRIBUTE.md

> 
>>
>>>
>>> With above fixed
>>> Reviewed-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
>>
>> Thanks
>>>
>>>>          /* Store initial 64b timestamp: start */
>>>>        *cs++ = MI_LOAD_REGISTER_IMM(1) | MI_CS_MMIO_DST;
>>>> -- 
>>>> 2.31.1
>>>>

  reply	other threads:[~2024-07-25  9:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-14 20:13 [PATCH v2 i-g-t 0/2] benchmarks/gem_wsim: support gens without relocations and mmap fix Marcin Bernatowicz
2023-12-14 20:13 ` [PATCH v2 i-g-t 1/2] benchmarks/gem_wsim: Support gens without relocations Marcin Bernatowicz
2024-07-23  9:52   ` Kamil Konieczny
2024-07-25  9:13     ` Bernatowicz, Marcin
2023-12-14 20:13 ` [PATCH v2 i-g-t 2/2] benchmarks/gem_wsim: Fix mmap for discrete graphics cards Marcin Bernatowicz
2024-07-23 10:36   ` Kamil Konieczny
2024-07-25  7:26     ` Bernatowicz, Marcin
2024-07-25  9:06       ` Michal Wajdeczko
2024-07-25  9:52         ` Bernatowicz, Marcin [this message]
2023-12-14 21:47 ` ✓ Fi.CI.BAT: success for benchmarks/gem_wsim: support gens without relocations and mmap fix Patchwork
2023-12-14 22:39 ` ✗ Fi.CI.IGT: failure " Patchwork
2023-12-14 22:58 ` ✗ CI.xeBAT: " Patchwork

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=1d9377cd-0608-4bce-a3b7-2f0c0116bfdb@linux.intel.com \
    --to=marcin.bernatowicz@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=kamil.konieczny@linux.intel.com \
    --cc=lukasz.laguna@intel.com \
    --cc=michal.wajdeczko@intel.com \
    --cc=tursulin@igalia.com \
    --cc=tursulin@ursulin.net \
    --cc=zbigniew.kempczynski@intel.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