Skip to content

Commit f091bf3

Browse files
committed
Merge tag 'drm-intel-fixes-2020-02-27' of git://anongit.freedesktop.org/drm/drm-intel into drm-fixes
drm/i915 fixes for v5.6-rc4: - downgrade gen7 back to aliasing-ppgtt to avoid GPU hangs - shrinker fix - pmu leak and double free fixes - gvt user after free and virtual display reset fixes - randconfig build fix Signed-off-by: Dave Airlie <[email protected]> From: Jani Nikula <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2 parents e180af1 + 8e9a400 commit f091bf3

File tree

7 files changed

+46
-38
lines changed

7 files changed

+46
-38
lines changed

drivers/gpu/drm/i915/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ extra-$(CONFIG_DRM_I915_WERROR) += \
294294
$(shell cd $(srctree)/$(src) && find * -name '*.h')))
295295

296296
quiet_cmd_hdrtest = HDRTEST $(patsubst %.hdrtest,%.h,$@)
297-
cmd_hdrtest = $(CC) $(c_flags) -S -o /dev/null -x c /dev/null -include $<; touch $@
297+
cmd_hdrtest = $(CC) $(filter-out $(CFLAGS_GCOV), $(c_flags)) -S -o /dev/null -x c /dev/null -include $<; touch $@
298298

299299
$(obj)/%.hdrtest: $(src)/%.h FORCE
300300
$(call if_changed_dep,hdrtest)

drivers/gpu/drm/i915/gem/i915_gem_shrinker.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,7 @@ unsigned long i915_gem_shrink_all(struct drm_i915_private *i915)
256256
with_intel_runtime_pm(&i915->runtime_pm, wakeref) {
257257
freed = i915_gem_shrink(i915, -1UL, NULL,
258258
I915_SHRINK_BOUND |
259-
I915_SHRINK_UNBOUND |
260-
I915_SHRINK_ACTIVE);
259+
I915_SHRINK_UNBOUND);
261260
}
262261

263262
return freed;
@@ -336,7 +335,6 @@ i915_gem_shrinker_oom(struct notifier_block *nb, unsigned long event, void *ptr)
336335
freed_pages = 0;
337336
with_intel_runtime_pm(&i915->runtime_pm, wakeref)
338337
freed_pages += i915_gem_shrink(i915, -1UL, NULL,
339-
I915_SHRINK_ACTIVE |
340338
I915_SHRINK_BOUND |
341339
I915_SHRINK_UNBOUND |
342340
I915_SHRINK_WRITEBACK);

drivers/gpu/drm/i915/gvt/dmabuf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,12 @@ static void dmabuf_gem_object_free(struct kref *kref)
151151
dmabuf_obj = container_of(pos,
152152
struct intel_vgpu_dmabuf_obj, list);
153153
if (dmabuf_obj == obj) {
154+
list_del(pos);
154155
intel_gvt_hypervisor_put_vfio_device(vgpu);
155156
idr_remove(&vgpu->object_idr,
156157
dmabuf_obj->dmabuf_id);
157158
kfree(dmabuf_obj->info);
158159
kfree(dmabuf_obj);
159-
list_del(pos);
160160
break;
161161
}
162162
}

drivers/gpu/drm/i915/gvt/vgpu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,9 +560,9 @@ void intel_gvt_reset_vgpu_locked(struct intel_vgpu *vgpu, bool dmlr,
560560

561561
intel_vgpu_reset_mmio(vgpu, dmlr);
562562
populate_pvinfo_page(vgpu);
563-
intel_vgpu_reset_display(vgpu);
564563

565564
if (dmlr) {
565+
intel_vgpu_reset_display(vgpu);
566566
intel_vgpu_reset_cfg_space(vgpu);
567567
/* only reset the failsafe mode when dmlr reset */
568568
vgpu->failsafe = false;

drivers/gpu/drm/i915/i915_pci.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ static const struct intel_device_info snb_m_gt2_info = {
437437
.has_rc6 = 1, \
438438
.has_rc6p = 1, \
439439
.has_rps = true, \
440-
.ppgtt_type = INTEL_PPGTT_FULL, \
440+
.ppgtt_type = INTEL_PPGTT_ALIASING, \
441441
.ppgtt_size = 31, \
442442
IVB_PIPE_OFFSETS, \
443443
IVB_CURSOR_OFFSETS, \
@@ -494,7 +494,7 @@ static const struct intel_device_info vlv_info = {
494494
.has_rps = true,
495495
.display.has_gmch = 1,
496496
.display.has_hotplug = 1,
497-
.ppgtt_type = INTEL_PPGTT_FULL,
497+
.ppgtt_type = INTEL_PPGTT_ALIASING,
498498
.ppgtt_size = 31,
499499
.has_snoop = true,
500500
.has_coherent_ggtt = false,

drivers/gpu/drm/i915/i915_pmu.c

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -822,11 +822,6 @@ static ssize_t i915_pmu_event_show(struct device *dev,
822822
return sprintf(buf, "config=0x%lx\n", eattr->val);
823823
}
824824

825-
static struct attribute_group i915_pmu_events_attr_group = {
826-
.name = "events",
827-
/* Patch in attrs at runtime. */
828-
};
829-
830825
static ssize_t
831826
i915_pmu_get_attr_cpumask(struct device *dev,
832827
struct device_attribute *attr,
@@ -846,13 +841,6 @@ static const struct attribute_group i915_pmu_cpumask_attr_group = {
846841
.attrs = i915_cpumask_attrs,
847842
};
848843

849-
static const struct attribute_group *i915_pmu_attr_groups[] = {
850-
&i915_pmu_format_attr_group,
851-
&i915_pmu_events_attr_group,
852-
&i915_pmu_cpumask_attr_group,
853-
NULL
854-
};
855-
856844
#define __event(__config, __name, __unit) \
857845
{ \
858846
.config = (__config), \
@@ -1026,23 +1014,23 @@ err:;
10261014

10271015
static void free_event_attributes(struct i915_pmu *pmu)
10281016
{
1029-
struct attribute **attr_iter = i915_pmu_events_attr_group.attrs;
1017+
struct attribute **attr_iter = pmu->events_attr_group.attrs;
10301018

10311019
for (; *attr_iter; attr_iter++)
10321020
kfree((*attr_iter)->name);
10331021

1034-
kfree(i915_pmu_events_attr_group.attrs);
1022+
kfree(pmu->events_attr_group.attrs);
10351023
kfree(pmu->i915_attr);
10361024
kfree(pmu->pmu_attr);
10371025

1038-
i915_pmu_events_attr_group.attrs = NULL;
1026+
pmu->events_attr_group.attrs = NULL;
10391027
pmu->i915_attr = NULL;
10401028
pmu->pmu_attr = NULL;
10411029
}
10421030

10431031
static int i915_pmu_cpu_online(unsigned int cpu, struct hlist_node *node)
10441032
{
1045-
struct i915_pmu *pmu = hlist_entry_safe(node, typeof(*pmu), node);
1033+
struct i915_pmu *pmu = hlist_entry_safe(node, typeof(*pmu), cpuhp.node);
10461034

10471035
GEM_BUG_ON(!pmu->base.event_init);
10481036

@@ -1055,7 +1043,7 @@ static int i915_pmu_cpu_online(unsigned int cpu, struct hlist_node *node)
10551043

10561044
static int i915_pmu_cpu_offline(unsigned int cpu, struct hlist_node *node)
10571045
{
1058-
struct i915_pmu *pmu = hlist_entry_safe(node, typeof(*pmu), node);
1046+
struct i915_pmu *pmu = hlist_entry_safe(node, typeof(*pmu), cpuhp.node);
10591047
unsigned int target;
10601048

10611049
GEM_BUG_ON(!pmu->base.event_init);
@@ -1072,8 +1060,6 @@ static int i915_pmu_cpu_offline(unsigned int cpu, struct hlist_node *node)
10721060
return 0;
10731061
}
10741062

1075-
static enum cpuhp_state cpuhp_slot = CPUHP_INVALID;
1076-
10771063
static int i915_pmu_register_cpuhp_state(struct i915_pmu *pmu)
10781064
{
10791065
enum cpuhp_state slot;
@@ -1087,21 +1073,22 @@ static int i915_pmu_register_cpuhp_state(struct i915_pmu *pmu)
10871073
return ret;
10881074

10891075
slot = ret;
1090-
ret = cpuhp_state_add_instance(slot, &pmu->node);
1076+
ret = cpuhp_state_add_instance(slot, &pmu->cpuhp.node);
10911077
if (ret) {
10921078
cpuhp_remove_multi_state(slot);
10931079
return ret;
10941080
}
10951081

1096-
cpuhp_slot = slot;
1082+
pmu->cpuhp.slot = slot;
10971083
return 0;
10981084
}
10991085

11001086
static void i915_pmu_unregister_cpuhp_state(struct i915_pmu *pmu)
11011087
{
1102-
WARN_ON(cpuhp_slot == CPUHP_INVALID);
1103-
WARN_ON(cpuhp_state_remove_instance(cpuhp_slot, &pmu->node));
1104-
cpuhp_remove_multi_state(cpuhp_slot);
1088+
WARN_ON(pmu->cpuhp.slot == CPUHP_INVALID);
1089+
WARN_ON(cpuhp_state_remove_instance(pmu->cpuhp.slot, &pmu->cpuhp.node));
1090+
cpuhp_remove_multi_state(pmu->cpuhp.slot);
1091+
pmu->cpuhp.slot = CPUHP_INVALID;
11051092
}
11061093

11071094
static bool is_igp(struct drm_i915_private *i915)
@@ -1118,6 +1105,13 @@ static bool is_igp(struct drm_i915_private *i915)
11181105
void i915_pmu_register(struct drm_i915_private *i915)
11191106
{
11201107
struct i915_pmu *pmu = &i915->pmu;
1108+
const struct attribute_group *attr_groups[] = {
1109+
&i915_pmu_format_attr_group,
1110+
&pmu->events_attr_group,
1111+
&i915_pmu_cpumask_attr_group,
1112+
NULL
1113+
};
1114+
11211115
int ret = -ENOMEM;
11221116

11231117
if (INTEL_GEN(i915) <= 2) {
@@ -1128,6 +1122,7 @@ void i915_pmu_register(struct drm_i915_private *i915)
11281122
spin_lock_init(&pmu->lock);
11291123
hrtimer_init(&pmu->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
11301124
pmu->timer.function = i915_sample;
1125+
pmu->cpuhp.slot = CPUHP_INVALID;
11311126

11321127
if (!is_igp(i915)) {
11331128
pmu->name = kasprintf(GFP_KERNEL,
@@ -1143,11 +1138,16 @@ void i915_pmu_register(struct drm_i915_private *i915)
11431138
if (!pmu->name)
11441139
goto err;
11451140

1146-
i915_pmu_events_attr_group.attrs = create_event_attributes(pmu);
1147-
if (!i915_pmu_events_attr_group.attrs)
1141+
pmu->events_attr_group.name = "events";
1142+
pmu->events_attr_group.attrs = create_event_attributes(pmu);
1143+
if (!pmu->events_attr_group.attrs)
11481144
goto err_name;
11491145

1150-
pmu->base.attr_groups = i915_pmu_attr_groups;
1146+
pmu->base.attr_groups = kmemdup(attr_groups, sizeof(attr_groups),
1147+
GFP_KERNEL);
1148+
if (!pmu->base.attr_groups)
1149+
goto err_attr;
1150+
11511151
pmu->base.task_ctx_nr = perf_invalid_context;
11521152
pmu->base.event_init = i915_pmu_event_init;
11531153
pmu->base.add = i915_pmu_event_add;
@@ -1159,7 +1159,7 @@ void i915_pmu_register(struct drm_i915_private *i915)
11591159

11601160
ret = perf_pmu_register(&pmu->base, pmu->name, -1);
11611161
if (ret)
1162-
goto err_attr;
1162+
goto err_groups;
11631163

11641164
ret = i915_pmu_register_cpuhp_state(pmu);
11651165
if (ret)
@@ -1169,6 +1169,8 @@ void i915_pmu_register(struct drm_i915_private *i915)
11691169

11701170
err_unreg:
11711171
perf_pmu_unregister(&pmu->base);
1172+
err_groups:
1173+
kfree(pmu->base.attr_groups);
11721174
err_attr:
11731175
pmu->base.event_init = NULL;
11741176
free_event_attributes(pmu);
@@ -1194,6 +1196,7 @@ void i915_pmu_unregister(struct drm_i915_private *i915)
11941196

11951197
perf_pmu_unregister(&pmu->base);
11961198
pmu->base.event_init = NULL;
1199+
kfree(pmu->base.attr_groups);
11971200
if (!is_igp(i915))
11981201
kfree(pmu->name);
11991202
free_event_attributes(pmu);

drivers/gpu/drm/i915/i915_pmu.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,12 @@ struct i915_pmu_sample {
3939

4040
struct i915_pmu {
4141
/**
42-
* @node: List node for CPU hotplug handling.
42+
* @cpuhp: Struct used for CPU hotplug handling.
4343
*/
44-
struct hlist_node node;
44+
struct {
45+
struct hlist_node node;
46+
enum cpuhp_state slot;
47+
} cpuhp;
4548
/**
4649
* @base: PMU base.
4750
*/
@@ -104,6 +107,10 @@ struct i915_pmu {
104107
* @sleep_last: Last time GT parked for RC6 estimation.
105108
*/
106109
ktime_t sleep_last;
110+
/**
111+
* @events_attr_group: Device events attribute group.
112+
*/
113+
struct attribute_group events_attr_group;
107114
/**
108115
* @i915_attr: Memory block holding device attributes.
109116
*/

0 commit comments

Comments
 (0)