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: <202206281428.SeGK8goA-lkp@intel.com>
Date:   Tue, 28 Jun 2022 14:48:49 +0800
From:   kernel test robot <lkp@...el.com>
To:     Oded Gabbay <ogabbay@...nel.org>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org
Subject: [ogabbay:gaudi2 58/61]
 drivers/misc/habanalabs/common/command_submission.c:251:6: warning: no
 previous prototype for 'hl_cs_job_get'

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/ogabbay/linux.git gaudi2
head:   a76819ab38942fcb341142a55e9dc81f3eaf08e3
commit: 495848b62460cd3d6d388b284e08c4dc58132bd3 [58/61] habanalabs: add gaudi2 wait-for-CS support
config: csky-randconfig-r001-20220627
compiler: csky-linux-gcc (GCC) 11.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://git.kernel.org/pub/scm/linux/kernel/git/ogabbay/linux.git/commit/?id=495848b62460cd3d6d388b284e08c4dc58132bd3
        git remote add ogabbay https://git.kernel.org/pub/scm/linux/kernel/git/ogabbay/linux.git
        git fetch --no-tags ogabbay gaudi2
        git checkout 495848b62460cd3d6d388b284e08c4dc58132bd3
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=csky SHELL=/bin/bash drivers/misc/

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

All warnings (new ones prefixed by >>):

>> drivers/misc/habanalabs/common/command_submission.c:251:6: warning: no previous prototype for 'hl_cs_job_get' [-Wmissing-prototypes]
     251 | void hl_cs_job_get(struct hl_cs_job *job)
         |      ^~~~~~~~~~~~~
>> drivers/misc/habanalabs/common/command_submission.c:256:6: warning: no previous prototype for 'hl_cs_job_put' [-Wmissing-prototypes]
     256 | void hl_cs_job_put(struct hl_cs_job *job)
         |      ^~~~~~~~~~~~~
>> drivers/misc/habanalabs/common/command_submission.c:351:6: warning: no previous prototype for 'hl_complete_job' [-Wmissing-prototypes]
     351 | void hl_complete_job(struct hl_device *hdev, struct hl_cs_job *job)
         |      ^~~~~~~~~~~~~~~


vim +/hl_cs_job_get +251 drivers/misc/habanalabs/common/command_submission.c

   250	
 > 251	void hl_cs_job_get(struct hl_cs_job *job)
   252	{
   253		kref_get(&job->refcount);
   254	}
   255	
 > 256	void hl_cs_job_put(struct hl_cs_job *job)
   257	{
   258		kref_put(&job->refcount, cs_job_do_release);
   259	}
   260	
   261	bool cs_needs_completion(struct hl_cs *cs)
   262	{
   263		/* In case this is a staged CS, only the last CS in sequence should
   264		 * get a completion, any non staged CS will always get a completion
   265		 */
   266		if (cs->staged_cs && !cs->staged_last)
   267			return false;
   268	
   269		return true;
   270	}
   271	
   272	bool cs_needs_timeout(struct hl_cs *cs)
   273	{
   274		/* In case this is a staged CS, only the first CS in sequence should
   275		 * get a timeout, any non staged CS will always get a timeout
   276		 */
   277		if (cs->staged_cs && !cs->staged_first)
   278			return false;
   279	
   280		return true;
   281	}
   282	
   283	static bool is_cb_patched(struct hl_device *hdev, struct hl_cs_job *job)
   284	{
   285		/*
   286		 * Patched CB is created for external queues jobs, and for H/W queues
   287		 * jobs if the user CB was allocated by driver and MMU is disabled.
   288		 */
   289		return (job->queue_type == QUEUE_TYPE_EXT ||
   290				(job->queue_type == QUEUE_TYPE_HW &&
   291						job->is_kernel_allocated_cb &&
   292						!hdev->mmu_enable));
   293	}
   294	
   295	/*
   296	 * cs_parser - parse the user command submission
   297	 *
   298	 * @hpriv	: pointer to the private data of the fd
   299	 * @job        : pointer to the job that holds the command submission info
   300	 *
   301	 * The function parses the command submission of the user. It calls the
   302	 * ASIC specific parser, which returns a list of memory blocks to send
   303	 * to the device as different command buffers
   304	 *
   305	 */
   306	static int cs_parser(struct hl_fpriv *hpriv, struct hl_cs_job *job)
   307	{
   308		struct hl_device *hdev = hpriv->hdev;
   309		struct hl_cs_parser parser;
   310		int rc;
   311	
   312		parser.ctx_id = job->cs->ctx->asid;
   313		parser.cs_sequence = job->cs->sequence;
   314		parser.job_id = job->id;
   315	
   316		parser.hw_queue_id = job->hw_queue_id;
   317		parser.job_userptr_list = &job->userptr_list;
   318		parser.patched_cb = NULL;
   319		parser.user_cb = job->user_cb;
   320		parser.user_cb_size = job->user_cb_size;
   321		parser.queue_type = job->queue_type;
   322		parser.is_kernel_allocated_cb = job->is_kernel_allocated_cb;
   323		job->patched_cb = NULL;
   324		parser.completion = cs_needs_completion(job->cs);
   325	
   326		rc = hdev->asic_funcs->cs_parser(hdev, &parser);
   327	
   328		if (is_cb_patched(hdev, job)) {
   329			if (!rc) {
   330				job->patched_cb = parser.patched_cb;
   331				job->job_cb_size = parser.patched_cb_size;
   332				job->contains_dma_pkt = parser.contains_dma_pkt;
   333				atomic_inc(&job->patched_cb->cs_cnt);
   334			}
   335	
   336			/*
   337			 * Whether the parsing worked or not, we don't need the
   338			 * original CB anymore because it was already parsed and
   339			 * won't be accessed again for this CS
   340			 */
   341			atomic_dec(&job->user_cb->cs_cnt);
   342			hl_cb_put(job->user_cb);
   343			job->user_cb = NULL;
   344		} else if (!rc) {
   345			job->job_cb_size = job->user_cb_size;
   346		}
   347	
   348		return rc;
   349	}
   350	
 > 351	void hl_complete_job(struct hl_device *hdev, struct hl_cs_job *job)
   352	{
   353		struct hl_cs *cs = job->cs;
   354	
   355		if (is_cb_patched(hdev, job)) {
   356			hl_userptr_delete_list(hdev, &job->userptr_list);
   357	
   358			/*
   359			 * We might arrive here from rollback and patched CB wasn't
   360			 * created, so we need to check it's not NULL
   361			 */
   362			if (job->patched_cb) {
   363				atomic_dec(&job->patched_cb->cs_cnt);
   364				hl_cb_put(job->patched_cb);
   365			}
   366		}
   367	
   368		/* For H/W queue jobs, if a user CB was allocated by driver and MMU is
   369		 * enabled, the user CB isn't released in cs_parser() and thus should be
   370		 * released here. This is also true for INT queues jobs which were
   371		 * allocated by driver.
   372		 */
   373		if ((job->is_kernel_allocated_cb &&
   374			((job->queue_type == QUEUE_TYPE_HW && hdev->mmu_enable) ||
   375					job->queue_type == QUEUE_TYPE_INT))) {
   376			atomic_dec(&job->user_cb->cs_cnt);
   377			hl_cb_put(job->user_cb);
   378		}
   379	
   380		/*
   381		 * This is the only place where there can be multiple threads
   382		 * modifying the list at the same time
   383		 */
   384		spin_lock(&cs->job_lock);
   385		list_del(&job->cs_node);
   386		spin_unlock(&cs->job_lock);
   387	
   388		hl_debugfs_remove_job(hdev, job);
   389	
   390		/* We decrement reference only for a CS that gets completion
   391		 * because the reference was incremented only for this kind of CS
   392		 * right before it was scheduled.
   393		 *
   394		 * In staged submission, only the last CS marked as 'staged_last'
   395		 * gets completion, hence its release function will be called from here.
   396		 * As for all the rest CS's in the staged submission which do not get
   397		 * completion, their CS reference will be decremented by the
   398		 * 'staged_last' CS during the CS release flow.
   399		 * All relevant PQ CI counters will be incremented during the CS release
   400		 * flow by calling 'hl_hw_queue_update_ci'.
   401		 */
   402		if (cs_needs_completion(cs) &&
   403			(job->queue_type == QUEUE_TYPE_EXT || job->queue_type == QUEUE_TYPE_HW))
   404			cs_put(cs);
   405	
   406		hl_cs_job_put(job);
   407	}
   408	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

View attachment "config" of type "text/plain" (104303 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ