public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
To: Lukasz Kalamarz <lukasz.kalamarz@intel.com>,
	igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t 4/6] benchmarks/ tests/i915/: drop usage of __gem_mmap__cpu in code
Date: Wed, 9 Jan 2019 10:57:15 -0800	[thread overview]
Message-ID: <00a5b324-a0cf-392f-4a09-3ab65481a8d9@intel.com> (raw)
In-Reply-To: <20190109174057.16835-4-lukasz.kalamarz@intel.com>



On 01/09/2019 09:40 AM, Lukasz Kalamarz wrote:
> With implementation of __gem_mmap we can drop __gem_mmap__cpu
> and instead use refactored function.

Ok now I see why you didn't make it static in patch 2 :)
I'd personally prefer to keep __gem_mmap__cpu and __gem_mmap__wc as 
they're paired with gem_mmap__cpu and gem_mmap__wc and also make it 
explicit what mapping we're going for, but I'm not going to block if the 
majority prefers to get rid of them.

> 
> Signed-off-by: Lukasz Kalamarz <lukasz.kalamarz@intel.com>
> Cc: Michal Winiarski <michal.winiarski@intel.com>
> Cc: Katarzyna Dec <katarzyna.dec@intel.com>
> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> ---
>   benchmarks/gem_exec_reloc.c      | 6 +++---
>   tests/i915/gem_exec_big.c        | 2 +-
>   tests/i915/gem_exec_lut_handle.c | 6 +++---
>   tests/i915/gem_mmap.c            | 4 ++--
>   tests/i915/gem_stolen.c          | 2 +-
>   5 files changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/benchmarks/gem_exec_reloc.c b/benchmarks/gem_exec_reloc.c
> index f9487d95..40a1d500 100644
> --- a/benchmarks/gem_exec_reloc.c
> +++ b/benchmarks/gem_exec_reloc.c
> @@ -116,13 +116,13 @@ static int run(unsigned batch_size,
>   	if (num_relocs) {
>   		size = ALIGN(sizeof(*mem_reloc)*num_relocs, 4096);
>   		reloc_handle = gem_create(fd, size);
> -		reloc = __gem_mmap__cpu(fd, reloc_handle, 0, size, PROT_READ | PROT_WRITE);
> +		reloc = __gem_mmap(fd, reloc_handle, 0, size, PROT_READ | PROT_WRITE, false);

I'm wondering what the reason is not to use gem_mmap__cpu here and in 
the other cases where we pass the mapping as a reloc. From what I can 
see we do access the pointer (e.g. with the memcpy the line below or 
passing it to execbuf), so I'd expect we'd want to make sure it is valid

Daniele

>   		memcpy(reloc, mem_reloc, sizeof(*mem_reloc)*num_relocs);
>   		munmap(reloc, size);
>   
>   		if (flags & FAULT) {
>   			igt_disable_prefault();
> -			reloc = __gem_mmap__cpu(fd, reloc_handle, 0, size, PROT_READ | PROT_WRITE);
> +			reloc = __gem_mmap(fd, reloc_handle, 0, size, PROT_READ | PROT_WRITE, false);
>   		} else
>   			reloc = mem_reloc;
>   	}
> @@ -163,7 +163,7 @@ static int run(unsigned batch_size,
>   			}
>   			if (flags & FAULT && reloc) {
>   				munmap(reloc, size);
> -				reloc = __gem_mmap__cpu(fd, reloc_handle, 0, size, PROT_READ | PROT_WRITE);
> +				reloc = __gem_mmap(fd, reloc_handle, 0, size, PROT_READ | PROT_WRITE, false);
>   				gem_exec[num_objects].relocs_ptr = (uintptr_t)reloc;
>   			}
>   			gem_execbuf(fd, &execbuf);
> diff --git a/tests/i915/gem_exec_big.c b/tests/i915/gem_exec_big.c
> index a15672f6..b57560af 100644
> --- a/tests/i915/gem_exec_big.c
> +++ b/tests/i915/gem_exec_big.c
> @@ -220,7 +220,7 @@ igt_simple_main
>   		gem_write(fd, handle, 0, batch, sizeof(batch));
>   
>   		if (!FORCE_PREAD_PWRITE && gem_has_llc(fd))
> -			ptr = __gem_mmap__cpu(fd, handle, 0, batch_size, PROT_READ);
> +			ptr = __gem_mmap(fd, handle, 0, batch_size, PROT_READ, false);
>   		else if (!FORCE_PREAD_PWRITE && gem_mmap__has_wc(fd))
>   			ptr = __gem_mmap__wc(fd, handle, 0, batch_size, PROT_READ);
>   		else
> diff --git a/tests/i915/gem_exec_lut_handle.c b/tests/i915/gem_exec_lut_handle.c
> index 98e6ae5a..9929f0c7 100644
> --- a/tests/i915/gem_exec_lut_handle.c
> +++ b/tests/i915/gem_exec_lut_handle.c
> @@ -148,7 +148,7 @@ igt_simple_main
>   				struct timeval start, end;
>   
>   				if (p->flags & FAULT)
> -					reloc = __gem_mmap__cpu(fd, reloc_handle, 0, size, PROT_READ | PROT_WRITE);
> +					reloc = __gem_mmap(fd, reloc_handle, 0, size, PROT_READ | PROT_WRITE, false);
>   				else
>   					reloc = mem_reloc;
>   
> @@ -182,7 +182,7 @@ igt_simple_main
>   					}
>   					if (p->flags & FAULT) {
>   						munmap(reloc, size);
> -						reloc = __gem_mmap__cpu(fd, reloc_handle, 0, size, PROT_READ | PROT_WRITE);
> +						reloc = __gem_mmap(fd, reloc_handle, 0, size, PROT_READ | PROT_WRITE, false);
>   						gem_exec[MAX_NUM_EXEC].relocs_ptr = to_user_pointer(reloc);
>   					}
>   					gem_execbuf(fd, &execbuf);
> @@ -212,7 +212,7 @@ igt_simple_main
>   					}
>   					if (p->flags & FAULT) {
>   						munmap(reloc, size);
> -						reloc = __gem_mmap__cpu(fd, reloc_handle, 0, size, PROT_READ | PROT_WRITE);
> +						reloc = __gem_mmap(fd, reloc_handle, 0, size, PROT_READ | PROT_WRITE, false);
>   						gem_exec[MAX_NUM_EXEC].relocs_ptr = to_user_pointer(reloc);
>   					}
>   					gem_execbuf(fd, &execbuf);
> diff --git a/tests/i915/gem_mmap.c b/tests/i915/gem_mmap.c
> index 0ed15878..5cbea456 100644
> --- a/tests/i915/gem_mmap.c
> +++ b/tests/i915/gem_mmap.c
> @@ -80,8 +80,8 @@ test_huge_bo(int huge)
>   	bo = gem_create(fd, huge_object_size);
>   
>   	/* Obtain CPU mapping for the object. */
> -	ptr_cpu = __gem_mmap__cpu(fd, bo, 0, huge_object_size,
> -				PROT_READ | PROT_WRITE);
> +	ptr_cpu = __gem_mmap(fd, bo, 0, huge_object_size,
> +			     PROT_READ | PROT_WRITE, false);
>   	igt_require(ptr_cpu);
>   	gem_set_domain(fd, bo, I915_GEM_DOMAIN_CPU, I915_GEM_DOMAIN_CPU);
>   	gem_close(fd, bo);
> diff --git a/tests/i915/gem_stolen.c b/tests/i915/gem_stolen.c
> index 1d489976..9b88c440 100644
> --- a/tests/i915/gem_stolen.c
> +++ b/tests/i915/gem_stolen.c
> @@ -392,7 +392,7 @@ stolen_no_mmap(int fd)
>   
>   	handle = gem_create_stolen(fd, SIZE);
>   
> -	addr = __gem_mmap__cpu(fd, handle, 0, SIZE, PROT_READ | PROT_WRITE);
> +	addr = __gem_mmap(fd, handle, 0, SIZE, PROT_READ | PROT_WRITE, false);
>   	igt_assert(addr == NULL);
>   
>   	gem_close(fd, handle);
> 
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2019-01-09 18:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-09 17:40 [igt-dev] [PATCH i-g-t 1/6] lib/ioctl_wrapper: use defines for get_param instead of param number Lukasz Kalamarz
2019-01-09 17:40 ` [igt-dev] [PATCH i-g-t 2/6] lib/ioctl_wrapper: Implement __gem_mmap Lukasz Kalamarz
2019-01-09 18:04   ` Daniele Ceraolo Spurio
2019-01-09 20:40   ` Chris Wilson
2019-01-09 17:40 ` [igt-dev] [PATCH i-g-t 3/6] lib/igt_dummyload: use gem_mmap__cpu and gem_mmap__wc when applicable Lukasz Kalamarz
2019-01-09 17:40 ` [igt-dev] [PATCH i-g-t 4/6] benchmarks/ tests/i915/: drop usage of __gem_mmap__cpu in code Lukasz Kalamarz
2019-01-09 18:57   ` Daniele Ceraolo Spurio [this message]
2019-01-09 20:45   ` Chris Wilson
2019-01-09 17:40 ` [igt-dev] [PATCH i-g-t 5/6] lib/ tests/: drop usage of __gem_mmap__wc " Lukasz Kalamarz
2019-01-09 17:40 ` [igt-dev] [PATCH i-g-t 6/6] lib/ioctl_wrapper: remove __gem_mmap__cpu and __gem_mmap__wc Lukasz Kalamarz
2019-01-09 18:14 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/6] lib/ioctl_wrapper: use defines for get_param instead of param number Patchwork
2019-01-09 19:01 ` [igt-dev] ✓ Fi.CI.IGT: " 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=00a5b324-a0cf-392f-4a09-3ab65481a8d9@intel.com \
    --to=daniele.ceraolospurio@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=lukasz.kalamarz@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