[PATCH] drm/i915/gvt: Introduce vGPU mm notifier

Zhi Wang zhi.a.wang at intel.com
Tue Apr 25 04:08:21 UTC 2017


Thanks! Will do that!
于 04/25/17 11:29, Tian, Kevin 写道:
> Then using a RFC prefix is clearer.
>
>> -----Original Message-----
>> From: intel-gvt-dev [mailto:intel-gvt-dev-bounces at lists.freedesktop.org] On
>> Behalf Of Zhi Wang
>> Sent: Monday, April 24, 2017 1:21 PM
>> To: Zhenyu Wang <zhenyuw at linux.intel.com>
>> Cc: intel-gvt-dev at lists.freedesktop.org
>> Subject: Re: [PATCH] drm/i915/gvt: Introduce vGPU mm notifier
>>
>> Sure!, I'm collecting the comments at this time. :)
>>
>> 于 04/24/17 10:50, Zhenyu Wang 写道:
>>> On 2017.04.21 23:32:28 +0800, Zhi Wang wrote:
>>>> This patch introduces vGPU mm notifier for clients who may wish to track
>>>> guest changing its graphics memory mapping in a vGPU GGTT/PPGTT mm.
>>>>
>>>> Signed-off-by: Zhi Wang <zhi.a.wang at intel.com>
>>>> ---
>>> We might wait to merge this until real user will be ready.
>>>
>>>> +
>>>> +/**
>>>> + * intel_vgpu_activate_mm_notifier - activate a vGPU mm notifier
>>>> + * @n: a vGPU mm notifier
>>>> + *
>>>> + * This function is used to start tracking the GMADR mapping change.
>>>> + *
>>>> + * Returns:
>>>> + * Zero on success, negative error code in pointer if failed.
>>>> + */
>>>> +int intel_vgpu_activate_mm_notifier(struct intel_vgpu_mm_notifier *n)
>>>> +{
>>>> +	if (n->active)
>>>> +		return -EEXIST;
>>>> +
>>>> +	n->active = true;
>>>> +	interval_tree_insert(&n->node, &n->mm->mm_notifiers);
>>>> +
>>>> +	return 0;
>>>> +}
>>> I think you should add start/last setting here for this notifier
>>> instead of leaving out to caller, which will be consistent then.
>>>
>>>> +
>>>> +/**
>>>> + * intel_vgpu_deactivate_mm_notifier - de-activate a vGPU mm notifier
>>>> + * @n: a vGPU mm notifier
>>>> + *
>>>> + * This function is used to stop tracking the GMADR mapping change. If a
>>>> + * client wish to modify the tracking range, it has to stop the tracking
>>>> + * first and then start the tracking again after modifying the range.
>>>> + *
>>>> + */
>>>> +void intel_vgpu_deactivate_notifier(struct intel_vgpu_mm_notifier *n)
>>>> +{
>>>> +	interval_tree_remove(&n->node, &n->mm->mm_notifiers);
>>>> +	n->active = false;
>>>> +}
>>>> diff --git a/drivers/gpu/drm/i915/gvt/gtt.h
>> b/drivers/gpu/drm/i915/gvt/gtt.h
>>>> index f88eb5e..95cfe7b 100644
>>>> --- a/drivers/gpu/drm/i915/gvt/gtt.h
>>>> +++ b/drivers/gpu/drm/i915/gvt/gtt.h
>>>> @@ -121,6 +121,18 @@ typedef enum {
>>>>    	GTT_TYPE_MAX,
>>>>    } intel_gvt_gtt_type_t;
>>>>
>>>> +struct intel_vgpu_mm_notifier {
>>>> +	bool active;
>>>> +
>>>> +	struct intel_vgpu_mm *mm;
>>>> +	int (*mapping_change)(struct intel_vgpu_mm_notifier *, u64, u64);
>>>> +	struct interval_tree_node node;
>>>> +};
>>>> +
>>>> +extern int intel_vgpu_activate_mm_notifier(struct
>> intel_vgpu_mm_notifier *n);
>>>> +
>>>> +extern void intel_vgpu_deactivate_mm_notifier(struct
>> intel_vgpu_mm_notifier *n);
>>>> +
>>>>    struct intel_vgpu_mm {
>>>>    	int type;
>>>>    	bool initialized;
>>>> @@ -141,6 +153,7 @@ struct intel_vgpu_mm {
>>>>    	atomic_t pincount;
>>>>    	struct list_head lru_list;
>>>>    	struct intel_vgpu *vgpu;
>>>> +	struct rb_root mm_notifiers;
>>>>    };
>>> You also need to handle notifier tree cleanup when vgpu mm destroy.
>>>
>>>>    extern struct intel_gvt_gtt_entry *intel_vgpu_mm_get_entry(
>>>> diff --git a/drivers/gpu/drm/i915/gvt/gvt.h
>> b/drivers/gpu/drm/i915/gvt/gvt.h
>>>> index becae2f..b3629404 100644
>>>> --- a/drivers/gpu/drm/i915/gvt/gvt.h
>>>> +++ b/drivers/gpu/drm/i915/gvt/gvt.h
>>>> @@ -33,6 +33,8 @@
>>>>    #ifndef _GVT_H_
>>>>    #define _GVT_H_
>>>>
>>>> +#include <linux/interval_tree.h>
>>>> +
>>>>    #include "debug.h"
>>>>    #include "hypercall.h"
>>>>    #include "mmio.h"
>>>> --
>>>> 2.7.4
>>>>
>>>> _______________________________________________
>>>> intel-gvt-dev mailing list
>>>> intel-gvt-dev at lists.freedesktop.org
>>>> https://lists.freedesktop.org/mailman/listinfo/intel-gvt-dev
>> _______________________________________________
>> intel-gvt-dev mailing list
>> intel-gvt-dev at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/intel-gvt-dev



More information about the intel-gvt-dev mailing list