Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c0da5378 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: kgsl: Compare pid pointer instead of TGID for a new process"

parents 9e1e8866 a9c943d5
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
/* Copyright (c) 2002,2008-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2002,2008-2018,2020, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -281,7 +281,7 @@ static int ctx_print(struct seq_file *s, void *unused)
		   ctx_type_str(drawctxt->type),
		   drawctxt->base.priority,
		   drawctxt->base.proc_priv->comm,
		   drawctxt->base.proc_priv->pid,
		   pid_nr(drawctxt->base.proc_priv->pid),
		   drawctxt->base.tid);

	seq_puts(s, "flags: ");
+1 −1
Original line number Diff line number Diff line
@@ -1702,7 +1702,7 @@ static inline const char *_kgsl_context_comm(struct kgsl_context *context)
#define pr_fault(_d, _c, fmt, args...) \
		dev_err((_d)->dev, "%s[%d]: " fmt, \
		_kgsl_context_comm((_c)->context), \
		(_c)->context->proc_priv->pid, ##args)
		pid_nr((_c)->context->proc_priv->pid), ##args)


static void adreno_fault_header(struct kgsl_device *device,
+2 −2
Original line number Diff line number Diff line
/* Copyright (c) 2013-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2013-2018,2020, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -167,7 +167,7 @@ static int _build_pre_ib_cmds(struct adreno_device *adreno_dev,
	ibcmds += _ib_cmd_mem_write(adreno_dev, ibcmds, gpuaddr + data_offset,
			drawctxt->base.id, &data_offset);
	ibcmds += _ib_cmd_mem_write(adreno_dev, ibcmds, gpuaddr + data_offset,
			drawctxt->base.proc_priv->pid, &data_offset);
			pid_nr(drawctxt->base.proc_priv->pid), &data_offset);
	ibcmds += _ib_cmd_mem_write(adreno_dev, ibcmds, gpuaddr + data_offset,
			drawctxt->base.tid, &data_offset);
	ibcmds += _ib_cmd_mem_write(adreno_dev, ibcmds, gpuaddr + data_offset,
+19 −12
Original line number Diff line number Diff line
@@ -543,7 +543,7 @@ int kgsl_context_init(struct kgsl_device_private *dev_priv,
	if (atomic_read(&proc_priv->ctxt_count) > KGSL_MAX_CONTEXTS_PER_PROC) {
		KGSL_DRV_ERR_RATELIMIT(device,
			"Per process context limit reached for pid %u",
			dev_priv->process_priv->pid);
			pid_nr(dev_priv->process_priv->pid));
		spin_unlock(&proc_priv->ctxt_count_lock);
		return -ENOSPC;
	}
@@ -866,6 +866,7 @@ static void kgsl_destroy_process_private(struct kref *kref)
	struct kgsl_process_private *private = container_of(kref,
			struct kgsl_process_private, refcount);

	put_pid(private->pid);
	idr_destroy(&private->mem_idr);
	idr_destroy(&private->syncsource_idr);

@@ -895,7 +896,7 @@ struct kgsl_process_private *kgsl_process_private_find(pid_t pid)

	mutex_lock(&kgsl_driver.process_mutex);
	list_for_each_entry(p, &kgsl_driver.process_list, list) {
		if (p->pid == pid) {
		if (pid_nr(p->pid) == pid) {
			if (kgsl_process_private_get(p))
				private = p;
			break;
@@ -909,13 +910,15 @@ static struct kgsl_process_private *kgsl_process_private_new(
		struct kgsl_device *device)
{
	struct kgsl_process_private *private;
	pid_t tgid = task_tgid_nr(current);
	struct pid *cur_pid = get_task_pid(current->group_leader, PIDTYPE_PID);

	/* Search in the process list */
	list_for_each_entry(private, &kgsl_driver.process_list, list) {
		if (private->pid == tgid) {
			if (!kgsl_process_private_get(private))
		if (private->pid == cur_pid) {
			if (!kgsl_process_private_get(private)) {
				put_pid(cur_pid);
				private = ERR_PTR(-EINVAL);
			}
			return private;
		}
	}
@@ -927,7 +930,7 @@ static struct kgsl_process_private *kgsl_process_private_new(

	kref_init(&private->refcount);

	private->pid = tgid;
	private->pid = cur_pid;
	get_task_comm(private->comm, current->group_leader);

	spin_lock_init(&private->mem_lock);
@@ -938,12 +941,14 @@ static struct kgsl_process_private *kgsl_process_private_new(
	idr_init(&private->syncsource_idr);

	/* Allocate a pagetable for the new process object */
	private->pagetable = kgsl_mmu_getpagetable(&device->mmu, tgid);
	private->pagetable = kgsl_mmu_getpagetable(&device->mmu,
							pid_nr(cur_pid));
	if (IS_ERR(private->pagetable)) {
		int err = PTR_ERR(private->pagetable);

		idr_destroy(&private->mem_idr);
		idr_destroy(&private->syncsource_idr);
		put_pid(private->pid);

		kfree(private);
		private = ERR_PTR(err);
@@ -1859,7 +1864,7 @@ long gpumem_free_entry(struct kgsl_mem_entry *entry)
		return -EBUSY;

	trace_kgsl_mem_free(entry);
	kgsl_memfree_add(entry->priv->pid,
	kgsl_memfree_add(pid_nr(entry->priv->pid),
			entry->memdesc.pagetable ?
				entry->memdesc.pagetable->name : 0,
			entry->memdesc.gpuaddr, entry->memdesc.size,
@@ -1882,7 +1887,7 @@ static void gpumem_free_func(struct kgsl_device *device,
	/* Free the memory for all event types */
	trace_kgsl_mem_timestamp_free(device, entry, KGSL_CONTEXT_ID(context),
		timestamp, 0);
	kgsl_memfree_add(entry->priv->pid,
	kgsl_memfree_add(pid_nr(entry->priv->pid),
			entry->memdesc.pagetable ?
				entry->memdesc.pagetable->name : 0,
			entry->memdesc.gpuaddr, entry->memdesc.size,
@@ -1982,7 +1987,7 @@ static bool gpuobj_free_fence_func(void *priv)
	struct kgsl_mem_entry *entry = priv;

	trace_kgsl_mem_free(entry);
	kgsl_memfree_add(entry->priv->pid,
	kgsl_memfree_add(pid_nr(entry->priv->pid),
			entry->memdesc.pagetable ?
				entry->memdesc.pagetable->name : 0,
			entry->memdesc.gpuaddr, entry->memdesc.size,
@@ -4473,13 +4478,15 @@ kgsl_get_unmapped_area(struct file *file, unsigned long addr,
		if (IS_ERR_VALUE(val))
			KGSL_DRV_ERR_RATELIMIT(device,
				"get_unmapped_area: pid %d addr %lx pgoff %lx len %ld failed error %d\n",
				private->pid, addr, pgoff, len, (int) val);
				pid_nr(private->pid), addr,
				pgoff, len, (int) val);
	} else {
		val = _get_svm_area(private, entry, addr, len, flags);
		if (IS_ERR_VALUE(val))
			KGSL_DRV_ERR_RATELIMIT(device,
				"_get_svm_area: pid %d mmap_base %lx addr %lx pgoff %lx len %ld failed error %d\n",
				private->pid, current->mm->mmap_base, addr,
				pid_nr(private->pid),
				current->mm->mmap_base, addr,
				pgoff, len, (int) val);
	}

+5 −4
Original line number Diff line number Diff line
/* Copyright (c) 2002,2008-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2002,2008-2017,2020, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -397,7 +397,7 @@ void kgsl_process_init_debugfs(struct kgsl_process_private *private)
	unsigned char name[16];
	struct dentry *dentry;

	snprintf(name, sizeof(name), "%d", private->pid);
	snprintf(name, sizeof(name), "%d", pid_nr(private->pid));

	private->debug_root = debugfs_create_dir(name, proc_d_debugfs);

@@ -417,14 +417,15 @@ void kgsl_process_init_debugfs(struct kgsl_process_private *private)
	}

	dentry = debugfs_create_file("mem", 0444, private->debug_root,
		(void *) ((unsigned long) private->pid), &process_mem_fops);
		(void *) ((unsigned long) pid_nr(private->pid)),
		&process_mem_fops);

	if (IS_ERR_OR_NULL(dentry))
		WARN((dentry == NULL),
			"Unable to create 'mem' file for %s\n", name);

	dentry = debugfs_create_file("sparse_mem", 0444, private->debug_root,
		(void *) ((unsigned long) private->pid),
		(void *) ((unsigned long) pid_nr(private->pid)),
		&process_sparse_mem_fops);

	if (IS_ERR_OR_NULL(dentry))
Loading