All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: cros-kernel-buildreports@googlegroups.com
Cc: oe-kbuild-all@lists.linux.dev
Subject: [android-common:android16-6.12 2/2] drivers/virt/gunyah/vm_mgr.c:173:28: error: implicit declaration of function 'module_refcount'
Date: Wed, 11 Mar 2026 21:13:05 +0800	[thread overview]
Message-ID: <202603112157.1TTCB2vY-lkp@intel.com> (raw)

tree:   https://android.googlesource.com/kernel/common android16-6.12
head:   0104b0412b0a41935ece11bfd31b3b309c734cd7
commit: 93af311a26d2889a54d01bd27170ba59e0cc7536 [2/2] FROMLIST: gunyah: vm_mgr: Add framework for VM Functions
config: arm64-randconfig-r132-20260311 (https://download.01.org/0day-ci/archive/20260311/202603112157.1TTCB2vY-lkp@intel.com/config)
compiler: aarch64-linux-gcc (GCC) 14.3.0
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260311/202603112157.1TTCB2vY-lkp@intel.com/reproduce)

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>
| Closes: https://lore.kernel.org/oe-kbuild-all/202603112157.1TTCB2vY-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from arch/arm64/include/asm/bug.h:26,
                    from include/linux/bug.h:5,
                    from arch/arm64/include/asm/cpufeature.h:24,
                    from arch/arm64/include/asm/hwcap.h:9,
                    from arch/arm64/include/asm/arch_timer.h:12,
                    from arch/arm64/include/asm/timex.h:8,
                    from include/linux/timex.h:67,
                    from include/linux/time32.h:13,
                    from include/linux/time.h:60,
                    from include/linux/compat.h:10,
                    from drivers/virt/gunyah/vm_mgr.c:9:
   drivers/virt/gunyah/vm_mgr.c: In function 'gunyah_vm_function_unregister':
>> drivers/virt/gunyah/vm_mgr.c:173:28: error: implicit declaration of function 'module_refcount' [-Wimplicit-function-declaration]
     173 |         WARN_ON(fn->mod && module_refcount(fn->mod));
         |                            ^~~~~~~~~~~~~~~
   include/asm-generic/bug.h:123:32: note: in definition of macro 'WARN_ON'
     123 |         int __ret_warn_on = !!(condition);                              \
         |                                ^~~~~~~~~

Kconfig warnings: (for reference only)
   WARNING: unmet direct dependencies detected for PHYLINK
   Depends on [n]: NETDEVICES [=n]
   Selected by [y]:
   - GKI_HIDDEN_ETHERNET_CONFIGS [=y] && 64BIT [=y]
   WARNING: unmet direct dependencies detected for SND_JACK_INPUT_DEV
   Depends on [n]: SOUND [=n] && SND [=n] && SND_JACK [=y]
   Selected by [y]:
   - GKI_HIDDEN_SND_CONFIGS [=y] && 64BIT [=y]
   WARNING: unmet direct dependencies detected for NET_DEVLINK
   Depends on [n]: NET [=n]
   Selected by [y]:
   - GKI_HIDDEN_NET_CONFIGS [=y] && 64BIT [=y]
   WARNING: unmet direct dependencies detected for WEXT_PROC
   Depends on [n]: NET [=n] && WIRELESS [=n] && PROC_FS [=y] && WEXT_CORE [=y]
   Selected by [y]:
   - GKI_LEGACY_WEXT_ALLCONFIG [=y] && 64BIT [=y]
   WARNING: unmet direct dependencies detected for DIMLIB
   Depends on [n]: NET [=n]
   Selected by [y]:
   - GKI_HIDDEN_VIRTUAL_CONFIGS [=y] && 64BIT [=y]
   WARNING: unmet direct dependencies detected for SND_PCM_ELD
   Depends on [n]: SOUND [=n] && SND [=n]
   Selected by [y]:
   - GKI_HIDDEN_SND_CONFIGS [=y] && 64BIT [=y]
   WARNING: unmet direct dependencies detected for PAGE_POOL
   Depends on [n]: NET [=n]
   Selected by [y]:
   - GKI_HIDDEN_NET_CONFIGS [=y] && 64BIT [=y]
   WARNING: unmet direct dependencies detected for WEXT_PRIV
   Depends on [n]: NET [=n] && WIRELESS [=n]
   Selected by [y]:
   - GKI_LEGACY_WEXT_ALLCONFIG [=y] && 64BIT [=y]
   WARNING: unmet direct dependencies detected for NET_PTP_CLASSIFY
   Depends on [n]: NET [=n]
   Selected by [y]:
   - GKI_HIDDEN_NET_CONFIGS [=y] && 64BIT [=y]
   WARNING: unmet direct dependencies detected for DRM_MIPI_DSI
   Depends on [n]: HAS_IOMEM [=y] && DRM [=n]
   Selected by [y]:
   - GKI_HIDDEN_DRM_CONFIGS [=y] && 64BIT [=y]
   WARNING: unmet direct dependencies detected for SND_PCM_IEC958
   Depends on [n]: SOUND [=n] && SND [=n]
   Selected by [y]:
   - GKI_HIDDEN_SND_SOC_CONFIGS [=y] && 64BIT [=y]
   WARNING: unmet direct dependencies detected for WIRELESS_EXT
   Depends on [n]: NET [=n] && WIRELESS [=n]
   Selected by [y]:
   - GKI_LEGACY_WEXT_ALLCONFIG [=y] && 64BIT [=y]
   WARNING: unmet direct dependencies detected for WEXT_CORE
   Depends on [n]: NET [=n] && WIRELESS [=n] && (CFG80211_WEXT [=n] || WIRELESS_EXT [=y])
   Selected by [y]:
   - GKI_LEGACY_WEXT_ALLCONFIG [=y] && 64BIT [=y]
   WARNING: unmet direct dependencies detected for SND_JACK
   Depends on [n]: SOUND [=n] && SND [=n]
   Selected by [y]:
   - GKI_HIDDEN_SND_CONFIGS [=y] && 64BIT [=y]
   WARNING: unmet direct dependencies detected for SND_VMASTER
   Depends on [n]: SOUND [=n] && SND [=n]
   Selected by [y]:
   - GKI_HIDDEN_SND_CONFIGS [=y] && 64BIT [=y]
   WARNING: unmet direct dependencies detected for CAN_RX_OFFLOAD
   Depends on [n]: NETDEVICES [=n] && CAN_DEV [=n] && CAN_NETLINK [=n]
   Selected by [y]:
   - GKI_HIDDEN_MCP251XFD_CONFIGS [=y] && 64BIT [=y]
   WARNING: unmet direct dependencies detected for WEXT_SPY
   Depends on [n]: NET [=n] && WIRELESS [=n]
   Selected by [y]:
   - GKI_LEGACY_WEXT_ALLCONFIG [=y] && 64BIT [=y]


vim +/module_refcount +173 drivers/virt/gunyah/vm_mgr.c

     7	
     8	#include <linux/anon_inodes.h>
   > 9	#include <linux/compat.h>
    10	#include <linux/file.h>
    11	#include <linux/miscdevice.h>
    12	#include <linux/module.h>
    13	#include <linux/xarray.h>
    14	
    15	#include <uapi/linux/gunyah.h>
    16	
    17	#include "rsc_mgr.h"
    18	#include "vm_mgr.h"
    19	
    20	static DEFINE_XARRAY(gunyah_vm_functions);
    21	
    22	static void gunyah_vm_put_function(struct gunyah_vm_function *fn)
    23	{
    24		module_put(fn->mod);
    25	}
    26	
    27	static struct gunyah_vm_function *gunyah_vm_get_function(u32 type)
    28	{
    29		struct gunyah_vm_function *fn;
    30	
    31		fn = xa_load(&gunyah_vm_functions, type);
    32		if (!fn) {
    33			request_module("ghfunc:%d", type);
    34	
    35			fn = xa_load(&gunyah_vm_functions, type);
    36		}
    37	
    38		if (!fn || !try_module_get(fn->mod))
    39			fn = ERR_PTR(-ENOENT);
    40	
    41		return fn;
    42	}
    43	
    44	static void
    45	gunyah_vm_remove_function_instance(struct gunyah_vm_function_instance *inst)
    46		__must_hold(&inst->ghvm->fn_lock)
    47	{
    48		inst->fn->unbind(inst);
    49		list_del(&inst->vm_list);
    50		gunyah_vm_put_function(inst->fn);
    51		kfree(inst->argp);
    52		kfree(inst);
    53	}
    54	
    55	static void gunyah_vm_remove_functions(struct gunyah_vm *ghvm)
    56	{
    57		struct gunyah_vm_function_instance *inst, *iiter;
    58	
    59		mutex_lock(&ghvm->fn_lock);
    60		list_for_each_entry_safe(inst, iiter, &ghvm->functions, vm_list) {
    61			gunyah_vm_remove_function_instance(inst);
    62		}
    63		mutex_unlock(&ghvm->fn_lock);
    64	}
    65	
    66	static long gunyah_vm_add_function_instance(struct gunyah_vm *ghvm,
    67						    struct gunyah_fn_desc *f)
    68	{
    69		struct gunyah_vm_function_instance *inst;
    70		void __user *argp;
    71		long r = 0;
    72	
    73		if (f->arg_size > GUNYAH_FN_MAX_ARG_SIZE) {
    74			dev_err_ratelimited(ghvm->parent, "%s: arg_size > %d\n",
    75					    __func__, GUNYAH_FN_MAX_ARG_SIZE);
    76			return -EINVAL;
    77		}
    78	
    79		inst = kzalloc(sizeof(*inst), GFP_KERNEL);
    80		if (!inst)
    81			return -ENOMEM;
    82	
    83		inst->arg_size = f->arg_size;
    84		if (inst->arg_size) {
    85			inst->argp = kzalloc(inst->arg_size, GFP_KERNEL);
    86			if (!inst->argp) {
    87				r = -ENOMEM;
    88				goto free;
    89			}
    90	
    91			argp = u64_to_user_ptr(f->arg);
    92			if (copy_from_user(inst->argp, argp, f->arg_size)) {
    93				r = -EFAULT;
    94				goto free_arg;
    95			}
    96		}
    97	
    98		inst->fn = gunyah_vm_get_function(f->type);
    99		if (IS_ERR(inst->fn)) {
   100			r = PTR_ERR(inst->fn);
   101			goto free_arg;
   102		}
   103	
   104		inst->ghvm = ghvm;
   105		inst->rm = ghvm->rm;
   106	
   107		mutex_lock(&ghvm->fn_lock);
   108		r = inst->fn->bind(inst);
   109		if (r < 0) {
   110			mutex_unlock(&ghvm->fn_lock);
   111			gunyah_vm_put_function(inst->fn);
   112			goto free_arg;
   113		}
   114	
   115		list_add(&inst->vm_list, &ghvm->functions);
   116		mutex_unlock(&ghvm->fn_lock);
   117	
   118		return r;
   119	free_arg:
   120		kfree(inst->argp);
   121	free:
   122		kfree(inst);
   123		return r;
   124	}
   125	
   126	static long gunyah_vm_rm_function_instance(struct gunyah_vm *ghvm,
   127						   struct gunyah_fn_desc *f)
   128	{
   129		struct gunyah_vm_function_instance *inst, *iter;
   130		void __user *user_argp;
   131		void *argp __free(kfree) = NULL;
   132		long r = 0;
   133	
   134		if (f->arg_size) {
   135			argp = kzalloc(f->arg_size, GFP_KERNEL);
   136			if (!argp)
   137				return -ENOMEM;
   138	
   139			user_argp = u64_to_user_ptr(f->arg);
   140			if (copy_from_user(argp, user_argp, f->arg_size))
   141				return -EFAULT;
   142		}
   143	
   144		r = mutex_lock_interruptible(&ghvm->fn_lock);
   145		if (r)
   146			return r;
   147	
   148		r = -ENOENT;
   149		list_for_each_entry_safe(inst, iter, &ghvm->functions, vm_list) {
   150			if (inst->fn->type == f->type &&
   151			    inst->fn->compare(inst, argp, f->arg_size)) {
   152				gunyah_vm_remove_function_instance(inst);
   153				r = 0;
   154			}
   155		}
   156	
   157		mutex_unlock(&ghvm->fn_lock);
   158		return r;
   159	}
   160	
   161	int gunyah_vm_function_register(struct gunyah_vm_function *fn)
   162	{
   163		if (!fn->bind || !fn->unbind)
   164			return -EINVAL;
   165	
   166		return xa_err(xa_store(&gunyah_vm_functions, fn->type, fn, GFP_KERNEL));
   167	}
   168	EXPORT_SYMBOL_GPL(gunyah_vm_function_register);
   169	
   170	void gunyah_vm_function_unregister(struct gunyah_vm_function *fn)
   171	{
   172		/* Expecting unregister to only come when unloading a module */
 > 173		WARN_ON(fn->mod && module_refcount(fn->mod));
   174		xa_erase(&gunyah_vm_functions, fn->type);
   175	}
   176	EXPORT_SYMBOL_GPL(gunyah_vm_function_unregister);
   177	

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

                 reply	other threads:[~2026-03-11 13:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=202603112157.1TTCB2vY-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=cros-kernel-buildreports@googlegroups.com \
    --cc=oe-kbuild-all@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.