public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>,
	intel-gfx@lists.freedesktop.org,
	Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Subject: Re: [PATCH] drm/i915: Move ioremap_wc tracking onto VMA
Date: Fri, 15 Apr 2016 11:41:35 +0100	[thread overview]
Message-ID: <5710C55F.2070400@linux.intel.com> (raw)
In-Reply-To: <20160415103806.GJ19990@nuc-i3427.alporthouse.com>


On 15/04/16 11:38, Chris Wilson wrote:
> On Fri, Apr 15, 2016 at 11:19:30AM +0100, Tvrtko Ursulin wrote:
>> On 15/04/16 11:00, Chris Wilson wrote:
>>> On Fri, Apr 15, 2016 at 10:40:42AM +0100, Tvrtko Ursulin wrote:
>>>>
>>>> On 13/04/16 16:12, Chris Wilson wrote:
>>>>> On Wed, Apr 13, 2016 at 03:47:58PM +0100, Chris Wilson wrote:
>>>>>> +	/* We also want to clear any cached iomaps as they wrap vmap */
>>>>>> +	list_for_each_entry_safe(vma, next,
>>>>>> +				 &dev_priv->ggtt.base.inactive_list, vm_link)
>>>>>> +		if (vma->iomap && i915_vma_unbind(vma) == 0)
>>>>>> +			freed_pages += vma->node.size >> PAGE_SHIFT;
>>>>>
>>>>> Use after free. I need to store the page count in a local before calling
>>>>> unbind.
>>>>
>>>> Waiting for respin. :)
>>>>
>>>> Also, shouldn't the patch which adds the size argument to
>>>> io_mapping_map_wc be in this series?
>>>
>>> It was, this was just an update to patch 2. The delta here is just
>>> unsigned long count = vma->node.size >> PAGE_SHIFT;
>>> if (vma->iomap && i915_vma_unbind(vma) == 0)
>>> 	freed_pages += count;
>>
>> My bad, I got lost in the threads.. :(
>>
>> Could I ask for those two BUG_ONs to be replaced with GEM_BUG_ONs
>> now that is in?
>>
>> Maybe also add a quick return at the top, as a micro-opt:
>>
>> 	if (vma->iomap)
>> 		reutrn vma->iomap;
>>
>> Followed by WARNs, GEM_BUG_ONs and rest?
>
> Like so?
>
> void *i915_vma_iomap(struct i915_vma *vma)
> {
>          struct i915_ggtt *ggtt;
>          void *ptr;
>
>          if (vma->iomap)
>                  return vma->iomap;
>
>          if (WARN_ON(!vma->obj->map_and_fenceable))
>                  return ERR_PTR(-ENODEV);
>
>          GEM_BUG_ON(!vma->is_ggtt);
>          GEM_BUG_ON((vma->bound & GLOBAL_BIND) == 0);
>
>          ggtt = container_of(vma->vm, struct i915_ggtt, base);
>          ptr = io_mapping_map_wc(ggtt->mappable vma->node.start, vma->node.size);
>          if (ptr == NULL)
>                  return ERR_PTR(-ENOMEM);
>
>          vma->iomap = ptr;
>          return ptr;
> }

Yes, that's what I had in mind. You can put my r-b in the repost.

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2016-04-15 10:41 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-13  9:52 [PATCH 1/3] drm/i915/overlay: Replace i915_gem_obj_ggtt_offset() with the known flip_addr Chris Wilson
2016-04-13  9:52 ` [PATCH 2/3] io-mapping: Specify mapping size for io_mapping_map_wc() Chris Wilson
2016-04-13  9:52 ` [PATCH 3/3] drm/i915: Move ioremap_wc tracking onto VMA Chris Wilson
2016-04-13 12:30   ` Tvrtko Ursulin
2016-04-13 12:44     ` Chris Wilson
2016-04-13 14:47       ` [PATCH] " Chris Wilson
2016-04-13 15:07         ` kbuild test robot
2016-04-13 15:12         ` Chris Wilson
2016-04-15  9:40           ` Tvrtko Ursulin
2016-04-15 10:00             ` Chris Wilson
2016-04-15 10:19               ` Tvrtko Ursulin
2016-04-15 10:38                 ` Chris Wilson
2016-04-15 10:41                   ` Tvrtko Ursulin [this message]
2016-04-18 10:57                   ` Joonas Lahtinen
2016-04-13 12:10 ` [PATCH 1/3] drm/i915/overlay: Replace i915_gem_obj_ggtt_offset() with the known flip_addr Tvrtko Ursulin
2016-04-14 10:07 ` ✓ Fi.CI.BAT: success for series starting with [1/3] drm/i915/overlay: Replace i915_gem_obj_ggtt_offset() with the known flip_addr (rev2) Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2016-04-18 12:08 [PATCH v2 4/4] drm/i915: Move ioremap_wc tracking onto VMA Tvrtko Ursulin
2016-04-18 14:54 ` [PATCH] " Chris Wilson
2016-04-18 15:08   ` Tvrtko Ursulin
2016-04-18 15:22     ` Chris Wilson
2016-04-18 15:27       ` Tvrtko Ursulin
2016-04-19 11:06         ` Chris Wilson
2016-04-19 12:19           ` Tvrtko Ursulin
2016-04-19 17:33           ` kbuild test robot
2016-04-18 15:20   ` kbuild test robot

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=5710C55F.2070400@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=tvrtko.ursulin@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