All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: [android-common:android15-6.6 6/6] kernel/fork.c:2318 copy_dmabuf_info() warn: sleeping in atomic context
Date: Thu, 10 Jul 2025 04:25:03 +0800	[thread overview]
Message-ID: <202507100414.f3Yyuj82-lkp@intel.com> (raw)

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: cros-kernel-buildreports@googlegroups.com

tree:   https://android.googlesource.com/kernel/common android15-6.6
head:   a9597c7b32ec09bdaf13909f77b203e77b4fbb69
commit: f44d593749dcbd4e1013121fa615ecca412d1cb3 [6/6] ANDROID: Track per-process dmabuf RSS
:::::: branch date: 12 hours ago
:::::: commit date: 21 hours ago
config: i386-randconfig-141-20250709 (https://download.01.org/0day-ci/archive/20250710/202507100414.f3Yyuj82-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14+deb12u1) 12.2.0

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202507100414.f3Yyuj82-lkp@intel.com/

smatch warnings:
kernel/fork.c:2318 copy_dmabuf_info() warn: sleeping in atomic context

vim +2318 kernel/fork.c

792575348ff70e Daniel Bristot de Oliveira 2022-07-29  2291  
f44d593749dcbd T.J. Mercier               2025-06-25  2292  static int copy_dmabuf_info(u64 clone_flags, struct task_struct *p)
f44d593749dcbd T.J. Mercier               2025-06-25  2293  {
f44d593749dcbd T.J. Mercier               2025-06-25  2294  	struct task_dma_buf_record *rec, *copy;
f44d593749dcbd T.J. Mercier               2025-06-25  2295  
f44d593749dcbd T.J. Mercier               2025-06-25  2296  	if (current->dmabuf_info && (clone_flags & (CLONE_VM | CLONE_FILES))
f44d593749dcbd T.J. Mercier               2025-06-25  2297  						== (CLONE_VM | CLONE_FILES)) {
f44d593749dcbd T.J. Mercier               2025-06-25  2298  		/*
f44d593749dcbd T.J. Mercier               2025-06-25  2299  		 * Both MM and FD references to dmabufs are shared with the parent, so
f44d593749dcbd T.J. Mercier               2025-06-25  2300  		 * we can share a RSS counter with the parent.
f44d593749dcbd T.J. Mercier               2025-06-25  2301  		 */
f44d593749dcbd T.J. Mercier               2025-06-25  2302  		refcount_inc(&current->dmabuf_info->refcnt);
f44d593749dcbd T.J. Mercier               2025-06-25  2303  		p->dmabuf_info = current->dmabuf_info;
f44d593749dcbd T.J. Mercier               2025-06-25  2304  		return 0;
f44d593749dcbd T.J. Mercier               2025-06-25  2305  	}
f44d593749dcbd T.J. Mercier               2025-06-25  2306  
f44d593749dcbd T.J. Mercier               2025-06-25  2307  	p->dmabuf_info = kmalloc(sizeof(*p->dmabuf_info), GFP_KERNEL);
f44d593749dcbd T.J. Mercier               2025-06-25  2308  	if (!p->dmabuf_info)
f44d593749dcbd T.J. Mercier               2025-06-25  2309  		return -ENOMEM;
f44d593749dcbd T.J. Mercier               2025-06-25  2310  
f44d593749dcbd T.J. Mercier               2025-06-25  2311  	refcount_set(&p->dmabuf_info->refcnt, 1);
f44d593749dcbd T.J. Mercier               2025-06-25  2312  	spin_lock_init(&p->dmabuf_info->lock);
f44d593749dcbd T.J. Mercier               2025-06-25  2313  	INIT_LIST_HEAD(&p->dmabuf_info->dmabufs);
f44d593749dcbd T.J. Mercier               2025-06-25  2314  	if (current->dmabuf_info) {
f44d593749dcbd T.J. Mercier               2025-06-25  2315  		spin_lock(&current->dmabuf_info->lock);
f44d593749dcbd T.J. Mercier               2025-06-25  2316  		p->dmabuf_info->rss = current->dmabuf_info->rss;
f44d593749dcbd T.J. Mercier               2025-06-25  2317  		list_for_each_entry(rec, &current->dmabuf_info->dmabufs, node) {
f44d593749dcbd T.J. Mercier               2025-06-25 @2318  			copy = kmalloc(sizeof(*copy), GFP_KERNEL);
f44d593749dcbd T.J. Mercier               2025-06-25  2319  			if (!copy) {
f44d593749dcbd T.J. Mercier               2025-06-25  2320  				spin_unlock(&current->dmabuf_info->lock);
f44d593749dcbd T.J. Mercier               2025-06-25  2321  				goto err_list_copy;
f44d593749dcbd T.J. Mercier               2025-06-25  2322  			}
f44d593749dcbd T.J. Mercier               2025-06-25  2323  
f44d593749dcbd T.J. Mercier               2025-06-25  2324  			copy->dmabuf = rec->dmabuf;
f44d593749dcbd T.J. Mercier               2025-06-25  2325  			copy->refcnt = rec->refcnt;
f44d593749dcbd T.J. Mercier               2025-06-25  2326  			list_add(&copy->node, &p->dmabuf_info->dmabufs);
f44d593749dcbd T.J. Mercier               2025-06-25  2327  		}
f44d593749dcbd T.J. Mercier               2025-06-25  2328  		spin_unlock(&current->dmabuf_info->lock);
f44d593749dcbd T.J. Mercier               2025-06-25  2329  	} else {
f44d593749dcbd T.J. Mercier               2025-06-25  2330  		p->dmabuf_info->rss = 0;
f44d593749dcbd T.J. Mercier               2025-06-25  2331  	}
f44d593749dcbd T.J. Mercier               2025-06-25  2332  
f44d593749dcbd T.J. Mercier               2025-06-25  2333  	return 0;
f44d593749dcbd T.J. Mercier               2025-06-25  2334  
f44d593749dcbd T.J. Mercier               2025-06-25  2335  err_list_copy:
f44d593749dcbd T.J. Mercier               2025-06-25  2336  	list_for_each_entry_safe(rec, copy, &p->dmabuf_info->dmabufs, node) {
f44d593749dcbd T.J. Mercier               2025-06-25  2337  		list_del(&rec->node);
f44d593749dcbd T.J. Mercier               2025-06-25  2338  		kfree(rec);
f44d593749dcbd T.J. Mercier               2025-06-25  2339  	}
f44d593749dcbd T.J. Mercier               2025-06-25  2340  	kfree(p->dmabuf_info);
f44d593749dcbd T.J. Mercier               2025-06-25  2341  	return -ENOMEM;
f44d593749dcbd T.J. Mercier               2025-06-25  2342  }
f44d593749dcbd T.J. Mercier               2025-06-25  2343  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

             reply	other threads:[~2025-07-09 20:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-09 20:25 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-07-14 19:23 [android-common:android15-6.6 6/6] kernel/fork.c:2318 copy_dmabuf_info() warn: sleeping in atomic context Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202507100414.f3Yyuj82-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=error27@gmail.com \
    --cc=oe-kbuild@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.