Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DRM[i915]: fix i915 crash during reboot stress test #71

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions drivers/gpu/drm/i915/gem/i915_gem_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -1711,6 +1711,9 @@ static void gem_context_register(struct i915_gem_context *ctx,
snprintf(ctx->name, sizeof(ctx->name), "%s[%d]",
current->comm, pid_nr(ctx->pid));

if (ctx->client == NULL)
return ;

spin_lock(&ctx->client->ctx_lock);
list_add_tail_rcu(&ctx->client_link, &ctx->client->ctx_list);
spin_unlock(&ctx->client->ctx_lock);
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/i915/i915_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -1772,7 +1772,7 @@ const struct dev_pm_ops i915_pm_ops = {
static const struct file_operations i915_driver_fops = {
.owner = THIS_MODULE,
.open = drm_open,
.release = drm_release_noglobal,
.release = drm_release,
.unlocked_ioctl = drm_ioctl,
.mmap = i915_gem_mmap,
.poll = drm_poll,
Expand Down
12 changes: 5 additions & 7 deletions drivers/gpu/drm/i915/i915_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ int i915_gem_create_sysfs_file_entry(struct drm_device *dev,
struct drm_i915_file_private *file_priv_local =
file_local->driver_priv;

if (pid_nr(file_priv->tgid) == pid_nr(file_priv_local->tgid)) {
if ((pid_nr(file_priv->tgid) == pid_nr(file_priv_local->tgid)) && (file_priv_local->obj_attr != NULL)) {
file_priv->obj_attr = file_priv_local->obj_attr;
mutex_unlock(&dev->filelist_mutex);
return 0;
Expand Down Expand Up @@ -447,6 +447,8 @@ int i915_gem_create_sysfs_file_entry(struct drm_device *dev,
DRM_ERROR(
"sysfs tgid file setup failed. tgid=%d, process:%s, ret:%d\n",
pid_nr(file_priv->tgid), file_priv->process_name, ret);
if (ret == -EEXIST)
ret = 0;
goto out_attr_priv;
}

Expand Down Expand Up @@ -486,16 +488,15 @@ void i915_gem_remove_sysfs_file_entry(struct drm_device *dev,
}
mutex_unlock(&dev->filelist_mutex);

mutex_lock(&drm_global_mutex);
if (open_count == 1) {
struct i915_gem_file_attr_priv *attr_priv;

if (file_priv->obj_attr == NULL)
goto out;
return;

attr_priv = file_priv->obj_attr->private;
if (attr_priv == NULL)
goto out;
return;

sysfs_remove_bin_file(&dev_priv->memtrack_kobj,
file_priv->obj_attr);
Expand All @@ -506,9 +507,6 @@ void i915_gem_remove_sysfs_file_entry(struct drm_device *dev,
kfree(file_priv->obj_attr);
file_priv->obj_attr = NULL;
}

out:
mutex_unlock(&drm_global_mutex);
}

static struct bin_attribute i915_gem_client_state_attr = {
Expand Down
Loading