[boqun:dev/arm64 3/3] drivers/hv/hv_balloon.c:1750: undefined reference to `memory_block_size_bytes'

From: kernel test robot
Date: Sun Feb 13 2022 - 16:12:15 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/boqun/linux.git dev/arm64
head: 715cdf131dd8fcb33591dc7143d193050368ecc1
commit: 715cdf131dd8fcb33591dc7143d193050368ecc1 [3/3] Drivers: hv: balloon: Support memory hot add for larger page sizes
config: i386-randconfig-a002-20220105 (https://download.01.org/0day-ci/archive/20220214/202202140519.Djv5mqzC-lkp@xxxxxxxxx/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# https://git.kernel.org/pub/scm/linux/kernel/git/boqun/linux.git/commit/?id=715cdf131dd8fcb33591dc7143d193050368ecc1
git remote add boqun https://git.kernel.org/pub/scm/linux/kernel/git/boqun/linux.git
git fetch --no-tags boqun dev/arm64
git checkout 715cdf131dd8fcb33591dc7143d193050368ecc1
# save the config file to linux build tree
mkdir build_dir
make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash

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

All errors (new ones prefixed by >>):

ld: drivers/hv/hv_balloon.o: in function `balloon_connect_vsp':
>> drivers/hv/hv_balloon.c:1750: undefined reference to `memory_block_size_bytes'


vim +1750 drivers/hv/hv_balloon.c

1664
1665 static int balloon_connect_vsp(struct hv_device *dev)
1666 {
1667 struct dm_version_request version_req;
1668 struct dm_capabilities cap_msg;
1669 unsigned long t;
1670 int ret;
1671
1672 /*
1673 * max_pkt_size should be large enough for one vmbus packet header plus
1674 * our receive buffer size. Hyper-V sends messages up to
1675 * HV_HYP_PAGE_SIZE bytes long on balloon channel.
1676 */
1677 dev->channel->max_pkt_size = HV_HYP_PAGE_SIZE * 2;
1678
1679 ret = vmbus_open(dev->channel, dm_ring_size, dm_ring_size, NULL, 0,
1680 balloon_onchannelcallback, dev);
1681 if (ret)
1682 return ret;
1683
1684 /*
1685 * Initiate the hand shake with the host and negotiate
1686 * a version that the host can support. We start with the
1687 * highest version number and go down if the host cannot
1688 * support it.
1689 */
1690 memset(&version_req, 0, sizeof(struct dm_version_request));
1691 version_req.hdr.type = DM_VERSION_REQUEST;
1692 version_req.hdr.size = sizeof(struct dm_version_request);
1693 version_req.hdr.trans_id = atomic_inc_return(&trans_id);
1694 version_req.version.version = DYNMEM_PROTOCOL_VERSION_WIN10;
1695 version_req.is_last_attempt = 0;
1696 dm_device.version = version_req.version.version;
1697
1698 ret = vmbus_sendpacket(dev->channel, &version_req,
1699 sizeof(struct dm_version_request),
1700 (unsigned long)NULL, VM_PKT_DATA_INBAND, 0);
1701 if (ret)
1702 goto out;
1703
1704 t = wait_for_completion_timeout(&dm_device.host_event, 5*HZ);
1705 if (t == 0) {
1706 ret = -ETIMEDOUT;
1707 goto out;
1708 }
1709
1710 /*
1711 * If we could not negotiate a compatible version with the host
1712 * fail the probe function.
1713 */
1714 if (dm_device.state == DM_INIT_ERROR) {
1715 ret = -EPROTO;
1716 goto out;
1717 }
1718
1719 pr_info("Using Dynamic Memory protocol version %u.%u\n",
1720 DYNMEM_MAJOR_VERSION(dm_device.version),
1721 DYNMEM_MINOR_VERSION(dm_device.version));
1722
1723 /*
1724 * Now submit our capabilities to the host.
1725 */
1726 memset(&cap_msg, 0, sizeof(struct dm_capabilities));
1727 cap_msg.hdr.type = DM_CAPABILITIES_REPORT;
1728 cap_msg.hdr.size = sizeof(struct dm_capabilities);
1729 cap_msg.hdr.trans_id = atomic_inc_return(&trans_id);
1730
1731 /*
1732 * When hibernation (i.e. virtual ACPI S4 state) is enabled, the host
1733 * currently still requires the bits to be set, so we have to add code
1734 * to fail the host's hot-add and balloon up/down requests, if any.
1735 */
1736 cap_msg.caps.cap_bits.balloon = 1;
1737 cap_msg.caps.cap_bits.hot_add = 1;
1738
1739 /*
1740 * Specify our alignment requirements as it relates
1741 * memory hot-add. The alignment should be the same as the memory block
1742 * size, and Hyper-V expects 2 ^ hot_add_alignment * 1MB is the
1743 * alignment in bytes.
1744 */
1745 /*
1746 * XXX: memory_block_size_bytes() for ARM64 only is only implemented
1747 * when CONFIG_MEMORY_HOTPLUG=y, and for x86, it doesn't get exported
1748 */
1749 cap_msg.caps.cap_bits.hot_add_alignment =
> 1750 count_trailing_zeros(memory_block_size_bytes() / 0x100000);
1751
1752 /*
1753 * Currently the host does not use these
1754 * values and we set them to what is done in the
1755 * Windows driver.
1756 */
1757 cap_msg.min_page_cnt = 0;
1758 cap_msg.max_page_number = -1;
1759
1760 ret = vmbus_sendpacket(dev->channel, &cap_msg,
1761 sizeof(struct dm_capabilities),
1762 (unsigned long)NULL, VM_PKT_DATA_INBAND, 0);
1763 if (ret)
1764 goto out;
1765
1766 t = wait_for_completion_timeout(&dm_device.host_event, 5*HZ);
1767 if (t == 0) {
1768 ret = -ETIMEDOUT;
1769 goto out;
1770 }
1771
1772 /*
1773 * If the host does not like our capabilities,
1774 * fail the probe function.
1775 */
1776 if (dm_device.state == DM_INIT_ERROR) {
1777 ret = -EPROTO;
1778 goto out;
1779 }
1780
1781 return 0;
1782 out:
1783 vmbus_close(dev->channel);
1784 return ret;
1785 }
1786

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