lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202008110054.OWuElhWL%lkp@intel.com>
Date:   Tue, 11 Aug 2020 00:39:56 +0800
From:   kernel test robot <lkp@...el.com>
To:     Oded Gabbay <oded.gabbay@...il.com>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        Omer Shpigelman <oshpigelman@...ana.ai>
Subject: drivers/misc/habanalabs/common/command_submission.c:950
 cs_ioctl_signal_wait() warn: should 'cb->id << (12)' be a 64 bit

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   fc80c51fd4b23ec007e88d4c688f2cac1b8648e7
commit: 70b2f993ea4a79c298aac4ec1c58089020536ba5 habanalabs: create common folder
date:   2 weeks ago
config: riscv-randconfig-m031-20200810 (attached as .config)
compiler: riscv32-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>

smatch warnings:
drivers/misc/habanalabs/common/command_submission.c:950 cs_ioctl_signal_wait() warn: should 'cb->id << (12)' be a 64 bit type?

vim +950 drivers/misc/habanalabs/common/command_submission.c

eff6f4a0e70b7b drivers/misc/habanalabs/command_submission.c Oded Gabbay     2019-02-16  768  
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  769  static int cs_ioctl_signal_wait(struct hl_fpriv *hpriv, enum hl_cs_type cs_type,
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  770  				void __user *chunks, u32 num_chunks,
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  771  				u64 *cs_seq)
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  772  {
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  773  	struct hl_device *hdev = hpriv->hdev;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  774  	struct hl_ctx *ctx = hpriv->ctx;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  775  	struct hl_cs_chunk *cs_chunk_array, *chunk;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  776  	struct hw_queue_properties *hw_queue_prop;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  777  	struct dma_fence *sig_fence = NULL;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  778  	struct hl_cs_job *job;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  779  	struct hl_cs *cs;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  780  	struct hl_cb *cb;
21e7a346344959 drivers/misc/habanalabs/command_submission.c Ofir Bitton     2020-05-14  781  	enum hl_queue_type q_type;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  782  	u64 *signal_seq_arr = NULL, signal_seq;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  783  	u32 size_to_copy, q_idx, signal_seq_arr_len, cb_size;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  784  	int rc;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  785  
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  786  	*cs_seq = ULLONG_MAX;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  787  
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  788  	if (num_chunks > HL_MAX_JOBS_PER_CS) {
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  789  		dev_err(hdev->dev,
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  790  			"Number of chunks can NOT be larger than %d\n",
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  791  			HL_MAX_JOBS_PER_CS);
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  792  		rc = -EINVAL;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  793  		goto out;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  794  	}
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  795  
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  796  	cs_chunk_array = kmalloc_array(num_chunks, sizeof(*cs_chunk_array),
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  797  					GFP_ATOMIC);
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  798  	if (!cs_chunk_array) {
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  799  		rc = -ENOMEM;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  800  		goto out;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  801  	}
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  802  
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  803  	size_to_copy = num_chunks * sizeof(struct hl_cs_chunk);
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  804  	if (copy_from_user(cs_chunk_array, chunks, size_to_copy)) {
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  805  		dev_err(hdev->dev, "Failed to copy cs chunk array from user\n");
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  806  		rc = -EFAULT;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  807  		goto free_cs_chunk_array;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  808  	}
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  809  
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  810  	/* currently it is guaranteed to have only one chunk */
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  811  	chunk = &cs_chunk_array[0];
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  812  	q_idx = chunk->queue_index;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  813  	hw_queue_prop = &hdev->asic_prop.hw_queues_props[q_idx];
21e7a346344959 drivers/misc/habanalabs/command_submission.c Ofir Bitton     2020-05-14  814  	q_type = hw_queue_prop->type;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  815  
3abc99bb7dcbc0 drivers/misc/habanalabs/command_submission.c Ofir Bitton     2020-06-23  816  	if ((q_idx >= hdev->asic_prop.max_queues) ||
21e7a346344959 drivers/misc/habanalabs/command_submission.c Ofir Bitton     2020-05-14  817  			(!hw_queue_prop->supports_sync_stream)) {
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  818  		dev_err(hdev->dev, "Queue index %d is invalid\n", q_idx);
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  819  		rc = -EINVAL;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  820  		goto free_cs_chunk_array;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  821  	}
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  822  
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  823  	if (cs_type == CS_TYPE_WAIT) {
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  824  		struct hl_cs_compl *sig_waitcs_cmpl;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  825  
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  826  		signal_seq_arr_len = chunk->num_signal_seq_arr;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  827  
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  828  		/* currently only one signal seq is supported */
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  829  		if (signal_seq_arr_len != 1) {
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  830  			dev_err(hdev->dev,
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  831  				"Wait for signal CS supports only one signal CS seq\n");
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  832  			rc = -EINVAL;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  833  			goto free_cs_chunk_array;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  834  		}
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  835  
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  836  		signal_seq_arr = kmalloc_array(signal_seq_arr_len,
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  837  						sizeof(*signal_seq_arr),
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  838  						GFP_ATOMIC);
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  839  		if (!signal_seq_arr) {
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  840  			rc = -ENOMEM;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  841  			goto free_cs_chunk_array;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  842  		}
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  843  
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  844  		size_to_copy = chunk->num_signal_seq_arr *
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  845  				sizeof(*signal_seq_arr);
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  846  		if (copy_from_user(signal_seq_arr,
05c8a4fc44a916 drivers/misc/habanalabs/command_submission.c Oded Gabbay     2020-06-01  847  					u64_to_user_ptr(chunk->signal_seq_arr),
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  848  					size_to_copy)) {
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  849  			dev_err(hdev->dev,
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  850  				"Failed to copy signal seq array from user\n");
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  851  			rc = -EFAULT;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  852  			goto free_signal_seq_array;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  853  		}
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  854  
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  855  		/* currently it is guaranteed to have only one signal seq */
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  856  		signal_seq = signal_seq_arr[0];
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  857  		sig_fence = hl_ctx_get_fence(ctx, signal_seq);
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  858  		if (IS_ERR(sig_fence)) {
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  859  			dev_err(hdev->dev,
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  860  				"Failed to get signal CS with seq 0x%llx\n",
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  861  				signal_seq);
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  862  			rc = PTR_ERR(sig_fence);
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  863  			goto free_signal_seq_array;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  864  		}
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  865  
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  866  		if (!sig_fence) {
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  867  			/* signal CS already finished */
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  868  			rc = 0;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  869  			goto free_signal_seq_array;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  870  		}
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  871  
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  872  		sig_waitcs_cmpl =
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  873  			container_of(sig_fence, struct hl_cs_compl, base_fence);
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  874  
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  875  		if (sig_waitcs_cmpl->type != CS_TYPE_SIGNAL) {
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  876  			dev_err(hdev->dev,
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  877  				"CS seq 0x%llx is not of a signal CS\n",
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  878  				signal_seq);
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  879  			dma_fence_put(sig_fence);
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  880  			rc = -EINVAL;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  881  			goto free_signal_seq_array;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  882  		}
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  883  
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  884  		if (dma_fence_is_signaled(sig_fence)) {
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  885  			/* signal CS already finished */
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  886  			dma_fence_put(sig_fence);
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  887  			rc = 0;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  888  			goto free_signal_seq_array;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  889  		}
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  890  	}
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  891  
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  892  	/* increment refcnt for context */
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  893  	hl_ctx_get(hdev, ctx);
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  894  
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  895  	rc = allocate_cs(hdev, ctx, cs_type, &cs);
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  896  	if (rc) {
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  897  		if (cs_type == CS_TYPE_WAIT)
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  898  			dma_fence_put(sig_fence);
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  899  		hl_ctx_put(ctx);
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  900  		goto free_signal_seq_array;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  901  	}
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  902  
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  903  	/*
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  904  	 * Save the signal CS fence for later initialization right before
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  905  	 * hanging the wait CS on the queue.
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  906  	 */
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  907  	if (cs->type == CS_TYPE_WAIT)
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  908  		cs->signal_fence = sig_fence;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  909  
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  910  	hl_debugfs_add_cs(cs);
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  911  
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  912  	*cs_seq = cs->sequence;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  913  
21e7a346344959 drivers/misc/habanalabs/command_submission.c Ofir Bitton     2020-05-14  914  	job = hl_cs_allocate_job(hdev, q_type, true);
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  915  	if (!job) {
db491e4f08a9fd drivers/misc/habanalabs/command_submission.c Ofir Bitton     2020-06-18  916  		ctx->cs_counters.out_of_mem_drop_cnt++;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  917  		dev_err(hdev->dev, "Failed to allocate a new job\n");
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  918  		rc = -ENOMEM;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  919  		goto put_cs;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  920  	}
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  921  
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  922  	cb = hl_cb_kernel_create(hdev, PAGE_SIZE);
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  923  	if (!cb) {
db491e4f08a9fd drivers/misc/habanalabs/command_submission.c Ofir Bitton     2020-06-18  924  		ctx->cs_counters.out_of_mem_drop_cnt++;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  925  		kfree(job);
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  926  		rc = -EFAULT;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  927  		goto put_cs;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  928  	}
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  929  
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  930  	if (cs->type == CS_TYPE_WAIT)
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  931  		cb_size = hdev->asic_funcs->get_wait_cb_size(hdev);
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  932  	else
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  933  		cb_size = hdev->asic_funcs->get_signal_cb_size(hdev);
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  934  
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  935  	job->id = 0;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  936  	job->cs = cs;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  937  	job->user_cb = cb;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  938  	job->user_cb->cs_cnt++;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  939  	job->user_cb_size = cb_size;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  940  	job->hw_queue_id = q_idx;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  941  
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  942  	/*
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  943  	 * No need in parsing, user CB is the patched CB.
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  944  	 * We call hl_cb_destroy() out of two reasons - we don't need the CB in
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  945  	 * the CB idr anymore and to decrement its refcount as it was
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  946  	 * incremented inside hl_cb_kernel_create().
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  947  	 */
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  948  	job->patched_cb = job->user_cb;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  949  	job->job_cb_size = job->user_cb_size;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07 @950  	hl_cb_destroy(hdev, &hdev->kernel_cb_mgr, cb->id << PAGE_SHIFT);
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  951  
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  952  	cs->jobs_in_queue_cnt[job->hw_queue_id]++;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  953  
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  954  	list_add_tail(&job->cs_node, &cs->job_list);
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  955  
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  956  	/* increment refcount as for external queues we get completion */
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  957  	cs_get(cs);
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  958  
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  959  	hl_debugfs_add_job(hdev, job);
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  960  
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  961  	rc = hl_hw_queue_schedule_cs(cs);
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  962  	if (rc) {
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  963  		if (rc != -EAGAIN)
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  964  			dev_err(hdev->dev,
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  965  				"Failed to submit CS %d.%llu to H/W queues, error %d\n",
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  966  				ctx->asid, cs->sequence, rc);
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  967  		goto free_cs_object;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  968  	}
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  969  
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  970  	rc = HL_CS_STATUS_SUCCESS;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  971  	goto put_cs;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  972  
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  973  free_cs_object:
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  974  	cs_rollback(hdev, cs);
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  975  	*cs_seq = ULLONG_MAX;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  976  	/* The path below is both for good and erroneous exits */
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  977  put_cs:
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  978  	/* We finished with the CS in this function, so put the ref */
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  979  	cs_put(cs);
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  980  free_signal_seq_array:
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  981  	if (cs_type == CS_TYPE_WAIT)
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  982  		kfree(signal_seq_arr);
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  983  free_cs_chunk_array:
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  984  	kfree(cs_chunk_array);
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  985  out:
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  986  	return rc;
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  987  }
b75f22505ac97e drivers/misc/habanalabs/command_submission.c Omer Shpigelman 2020-05-07  988  

:::::: The code at line 950 was first introduced by commit
:::::: b75f22505ac97ea680bcc3e23dcd56f421252b43 habanalabs: add signal/wait to CS IOCTL operations

:::::: TO: Omer Shpigelman <oshpigelman@...ana.ai>
:::::: CC: Oded Gabbay <oded.gabbay@...il.com>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Download attachment ".config.gz" of type "application/gzip" (28811 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ