[gourryinverse:scratch/gourry/cxl/compression/file_cleancache 85/98] mm/cram.c:785:9: error: call to undeclared function 'add_private_memory_driver_managed'; ISO C99 and later do not support implicit function declarations

kernel test robot <[email protected]>
Newsgroups dev.linux.lists.llvm,dev.linux.lists.oe-kbuild-all
Message-ID <[email protected]>
tree:   https://github.com/gourryinverse/linux scratch/gourry/cxl/compression/file_cleancache
head:   bcd0bfca5b64d6cbb5aadb07554b9bd218e0df85
commit: b91721666fdaddeaac4caa01b7f220f13ad984d6 [85/98] mm/cram: core compressed-RAM tier API
config: sparc64-allmodconfig (https://download.01.org/0day-ci/archive/20260711/[email protected]/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260711/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

>> mm/cram.c:785:9: error: call to undeclared function 'add_private_memory_driver_managed'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     785 |                 ret = add_private_memory_driver_managed(nid, ranges[i].start,
         |                       ^
>> mm/cram.c:787:5: error: use of undeclared identifier 'MHP_MERGE_RESOURCE'
     787 |                                 MHP_MERGE_RESOURCE, MMOP_ONLINE_MOVABLE, &cn->np);
         |                                 ^
   2 errors generated.


vim +/add_private_memory_driver_managed +785 mm/cram.c

   711	
   712	/**
   713	 * cram_register() - donate physical region(s) to CRAM as a private node
   714	 * @nid:         target NUMA node
   715	 * @ranges:      perceived physical regions to donate (struct range, end-inclusive)
   716	 * @n:           number of ranges
   717	 * @zratio:      hw compression ratio, per-mille N:1 (3:1 => 3000, 1:1 => 1000)
   718	 * @ops:         driver callbacks.  ops.owner (= THIS_MODULE) pins the module for
   719	 *               the node's lifetime.  Stored by value.
   720	 * @driver_data: the driver's per-node object, the ops callback cookie and np
   721	 *               owner.  Opaque to CRAM (keyed operations use @nid).
   722	 *
   723	 * CRAM owns the node lifecycle.  It hotplugs each range as an N_MEMORY_PRIVATE
   724	 * node (caps = CRAM_NP_CAPS, backed by &cn->np), onlines movable, and starts
   725	 * kswapd for LRU aging / writeback.  The driver does no hotplug of its own.
   726	 *
   727	 * Return: 0 on success.  -errno on failure (nothing left onlined on failure).
   728	 */
   729	int cram_register(int nid, const struct range *ranges, unsigned int n,
   730			  u32 zratio, struct cram_ops ops, void *driver_data)
   731	{
   732		struct cram_node *cn;
   733		unsigned int i, added = 0;
   734		int ret;
   735	
   736		if (!cram_valid_nid(nid) || !ranges || !n)
   737			return -EINVAL;
   738	
   739		/* Pin the driver module for the node's lifetime (NULL = built-in). */
   740		if (!try_module_get(ops.owner))
   741			return -EBUSY;
   742	
   743		cn = kzalloc(sizeof(*cn), GFP_KERNEL);
   744		if (!cn) {
   745			ret = -ENOMEM;
   746			goto err_module;
   747		}
   748		cn->ranges = kmemdup(ranges, n * sizeof(*ranges), GFP_KERNEL);
   749		if (!cn->ranges) {
   750			ret = -ENOMEM;
   751			goto err_free;
   752		}
   753		cn->nr_ranges = n;
   754		cn->zratio = zratio;
   755		cn->current_ratio = zratio;	/* assume configured ratio until reported */
   756		cn->alloc_allowed = true;	/* demotions permitted until the driver revokes */
   757		cn->ops = ops;
   758		cn->driver_data = driver_data;
   759		cn->nid = nid;
   760		cn->np.owner = driver_data;
   761		cn->np.caps = CRAM_NP_CAPS;
   762		refcount_set(&cn->refcount, 1);
   763		INIT_WORK(&cn->wmark_work, cram_wmark_work_fn);
   764		INIT_WORK(&cn->promote_work, cram_promote_work_fn);
   765		spin_lock_init(&cn->promote_lock);
   766		INIT_LIST_HEAD(&cn->balloon_pages);
   767		mutex_init(&cn->balloon_mutex);
   768	
   769		mutex_lock(&cram_mutex);
   770	
   771		/* Accretion / re-register onto an existing node is not yet supported. */
   772		if (cram_nodes[nid]) {
   773			mutex_unlock(&cram_mutex);
   774			ret = -EBUSY;
   775			goto err_ranges;
   776		}
   777	
   778		/*
   779		 * CRAM owns the node.  Hotplug each range as a private node (the first
   780		 * call node_private_register()s &cn->np) and online it movable.  On a
   781		 * failure roll back the ranges already added (fresh/empty, so the atomic
   782		 * ranges-offline succeeds).
   783		 */
   784		for (i = 0; i < n; i++) {
 > 785			ret = add_private_memory_driver_managed(nid, ranges[i].start,
   786					range_len(&ranges[i]), "System RAM (cram)",
 > 787					MHP_MERGE_RESOURCE, MMOP_ONLINE_MOVABLE, &cn->np);
   788			if (ret) {
   789				if (added)
   790					offline_and_remove_memory_ranges(cn->ranges, added);
   791				mutex_unlock(&cram_mutex);
   792				goto err_ranges;
   793			}
   794			added++;
   795		}
   796	
   797		/*
   798		 * Publish the control node first, then arm the CRAM mask last.  Once
   799		 * node_is_cram() / cram_pick_node() observe the node, cram_nodes[nid] is
   800		 * already valid.  Teardown clears the mask first, the mirror image.
   801		 */
   802		static_branch_inc(&cram_enabled);
   803		rcu_assign_pointer(cram_nodes[nid], cn);
   804		node_set(nid, cram_node_mask);
   805	
   806		/* Start kswapd on the private node for LRU aging and writeback */
   807		kswapd_run(nid);
   808	
   809		mutex_unlock(&cram_mutex);
   810		return 0;
   811	
   812	err_ranges:
   813		kfree(cn->ranges);
   814	err_free:
   815		kfree(cn);
   816	err_module:
   817		module_put(ops.owner);
   818		return ret;
   819	}
   820	EXPORT_SYMBOL_GPL(cram_register);
   821	

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.