video: hyperv: hyperv_fb: Use physical memory for fb on HyperV Gen 1 VMs.
Wei Hu
maintainerPATCH v2 1/1 video: hyperv: hyperv_fb: Use physical memory for fb on HyperV Gen 1 VMs.
On Hyper-V, Generation 1 VMs can directly use VM's physical memory for their framebuffers. This can improve the efficiency of framebuffer and overall performence for VM. The physical memory assigned to framebuffer must be contiguous. We use CMA allocator to get contiguouse physicial memory when the framebuffer size is greater than 4MB. For size under 4MB, we use alloc_pages to achieve this.
To enable framebuffer memory allocation from CMA, supply a kernel parameter to give enough space to CMA allocator at boot time. For example:
cma=130m
This gives 130MB memory to CAM allocator that can be allocated to framebuffer. If this fails, we fall back to the old way of using mmio for framebuffer.
---
v2: Incorporated review comments form [email protected], Michael Kelley and Dexuan Cui
- Use dma_alloc_coherent to allocate large contiguous memory
- Use phys_addr_t for physical addresses
- Corrected a few spelling errors and minor cleanups
- Also tested on 32 bit Ubuntu guest
drivers/video/fbdev/Kconfig | 1 + drivers/video/fbdev/hyperv_fb.c | 196 +++++++++++++++++++++++++------- 2 files changed, 158 insertions(+), 39 deletions(-)
drivers/video/fbdev/Kconfig +1 -0
@@ -2215,6 +2215,7 @@ config FB_HYPERV select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT select FB_DEFERRED_IO + select DMA_CMA if HAVE_DMA_CONTIGUOUS help This framebuffer driver supports Microsoft Hyper-V Synthetic Video.
drivers/video/fbdev/hyperv_fb.c +157 -39
301 lines not on this page · raw message
Signature · 1 line
2.20.1
kbuild test robot
build botI love your patch! Perhaps something to improve:
Hi Wei,
I love your patch! Perhaps something to improve:
[auto build test WARNING on next-20191122]
[cannot apply to linus/master v5.4-rc8 v5.4-rc7 v5.4-rc6 v5.4]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Wei-Hu/video-hyperv-hyperv_fb-Use-physical-memory-for-fb-on-HyperV-Gen-1-VMs/20191124-163533 base: b9d3d01405061bb42358fe53f824e894a1922ced config: i386-allmodconfig (attached as .config) compiler: gcc-7 (Debian 7.4.0-14) 7.4.0 reproduce: # save the attached .config to linux build tree make ARCH=i386
If you fix the issue, kindly add following tag
All warnings (new ones prefixed by >>):
In file included from include/linux/printk.h:7:0,
from include/linux/kernel.h:15,
from include/linux/list.h:9,
from include/linux/module.h:12,
from drivers/video/fbdev/hyperv_fb.c:48:
drivers/video/fbdev/hyperv_fb.c: In function 'hvfb_get_phymem':
include/linux/kern_levels.h:5:18: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 3 has type 'phys_addr_t {aka unsigned int}' [-Wformat=]
#define KERN_SOH "\001" /* ASCII Start Of Header */
^
include/linux/kern_levels.h:14:19: note: in expansion of macro 'KERN_SOH'
#define KERN_INFO KERN_SOH "6" /* informational */
^~~~~~~~
include/linux/printk.h:311:9: note: in expansion of macro 'KERN_INFO'
printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
^~~~~~~~~
>> drivers/video/fbdev/hyperv_fb.c:1003:2: note: in expansion of macro 'pr_info'
pr_info("Allocated %d pages starts at physical addr 0x%llx\n",
^~~~~~~vim +/pr_info +1003 drivers/video/fbdev/hyperv_fb.c
955
956 /*
957 * Allocate enough contiguous physical memory.
958 * Return physical address if succeeded or -1 if failed.
959 */
960 static phys_addr_t hvfb_get_phymem(struct hv_device *hdev,
961 unsigned int request_size)
962 {
963 struct page *page = NULL;
964 dma_addr_t dma_handle;
965 void *vmem;
966 unsigned int request_pages;
967 phys_addr_t paddr = 0;
968 unsigned int order = get_order(request_size);
969
970 if (request_size == 0)
971 return -1;
972
973 /* Try to call alloc_pages if the size is less than 2^MAX_ORDER */
974 if (order < MAX_ORDER) {
975 page = alloc_pages(GFP_KERNEL | __GFP_ZERO, order);
976 if (!page)
977 return -1;
978
979 paddr = (page_to_pfn(page) << PAGE_SHIFT);
980 request_pages = (1 << order);
981 goto get_phymem1;
982 }
983
984 /* Allocate from CMA */
985 if (hdev == NULL)
986 return -1;
987
988 hdev->device.coherent_dma_mask = DMA_BIT_MASK(64);
989
990 request_pages = (round_up(request_size, PAGE_SIZE) >> PAGE_SHIFT);
991
992 vmem = dma_alloc_coherent(&hdev->device,
993 request_pages * PAGE_SIZE,
994 &dma_handle,
995 GFP_KERNEL | __GFP_NOWARN);
996
997 if (!vmem)
998 return -1;
999
1000 paddr = virt_to_phys(vmem);
1001
1002 get_phymem1:
> 1003 pr_info("Allocated %d pages starts at physical addr 0x%llx\n", 1004 request_pages, paddr);
1005
1006 return paddr;
1007 }
1008
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/[email protected] Intel Corporation
kbuild test robot
build botI love your patch! Yet something to improve:
Hi Wei,
I love your patch! Yet something to improve:
[auto build test ERROR on next-20191122]
[cannot apply to linus/master v5.4-rc8 v5.4-rc7 v5.4-rc6 v5.4]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Wei-Hu/video-hyperv-hyperv_fb-Use-physical-memory-for-fb-on-HyperV-Gen-1-VMs/20191124-163533 base: b9d3d01405061bb42358fe53f824e894a1922ced config: i386-randconfig-b003-20191125 (attached as .config) compiler: gcc-7 (Debian 7.4.0-14) 7.4.0 reproduce: # save the attached .config to linux build tree make ARCH=i386
If you fix the issue, kindly add following tag
All errors (new ones prefixed by >>):
ld: kernel/dma/contiguous.o: in function `dma_alloc_from_contiguous':
>> kernel/dma/contiguous.c:199: undefined reference to `cma_alloc' >> ld: kernel/dma/contiguous.c:199: undefined reference to `cma_alloc' ld: kernel/dma/contiguous.o: in function `dma_release_from_contiguous': >> kernel/dma/contiguous.c:215: undefined reference to `cma_release' >> ld: kernel/dma/contiguous.c:215: undefined reference to `cma_release' ld: kernel/dma/contiguous.o: in function `dma_alloc_contiguous': kernel/dma/contiguous.c:248: undefined reference to `cma_alloc' ld: kernel/dma/contiguous.o: in function `dma_free_contiguous': kernel/dma/contiguous.c:267: undefined reference to `cma_release' ld: kernel/dma/contiguous.c:267: undefined reference to `cma_release' ld: kernel/dma/contiguous.o: in function `dma_contiguous_reserve_area': >> kernel/dma/contiguous.c:169: undefined reference to `cma_declare_contiguous' >> ld: kernel/dma/contiguous.c:175: undefined reference to `cma_get_size' >> ld: kernel/dma/contiguous.c:175: undefined reference to `cma_get_base'
vim +199 kernel/dma/contiguous.c
c64be2bb1c6eb4 drivers/base/dma-contiguous.c Marek Szyprowski 2011-12-29 145
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 146 /**
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 147 * dma_contiguous_reserve_area() - reserve custom contiguous area
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 148 * @size: Size of the reserved area (in bytes),
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 149 * @base: Base address of the reserved area optional, use 0 for any
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 150 * @limit: End address of the reserved memory (optional, 0 for any).
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 151 * @res_cma: Pointer to store the created cma region.
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 152 * @fixed: hint about where to place the reserved area
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 153 *
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 154 * This function reserves memory from early allocator. It should be
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 155 * called by arch specific code once the early allocator (memblock or bootmem)
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 156 * has been activated and all other subsystems have already allocated/reserved
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 157 * memory. This function allows to create custom reserved areas for specific
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 158 * devices.
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 159 *
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 160 * If @fixed is true, reserve contiguous area at exactly @base. If false,
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 161 * reserve in range from @base to @limit.
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 162 */
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 163 int __init dma_contiguous_reserve_area(phys_addr_t size, phys_addr_t base,
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 164 phys_addr_t limit, struct cma **res_cma,
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 165 bool fixed)
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 166 {
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 167 int ret;
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 168
f318dd083c8128 drivers/base/dma-contiguous.c Laura Abbott 2017-04-18 @169 ret = cma_declare_contiguous(base, size, limit, 0, 0, fixed,
f318dd083c8128 drivers/base/dma-contiguous.c Laura Abbott 2017-04-18 170 "reserved", res_cma);
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 171 if (ret)
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 172 return ret;
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 173
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 174 /* Architecture specific contiguous memory fixup. */
a254129e8686bf drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 @175 dma_contiguous_early_fixup(cma_get_base(*res_cma),
a254129e8686bf drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 176 cma_get_size(*res_cma));
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 177
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 178 return 0;
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 179 }
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 180
c64be2bb1c6eb4 drivers/base/dma-contiguous.c Marek Szyprowski 2011-12-29 181 /**
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 182 * dma_alloc_from_contiguous() - allocate pages from contiguous area
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 183 * @dev: Pointer to device for which the allocation is performed.
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 184 * @count: Requested number of pages.
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 185 * @align: Requested alignment of pages (in PAGE_SIZE order).
d834c5ab83febf kernel/dma/contiguous.c Marek Szyprowski 2018-08-17 186 * @no_warn: Avoid printing message about failed allocation.
c64be2bb1c6eb4 drivers/base/dma-contiguous.c Marek Szyprowski 2011-12-29 187 *
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 188 * This function allocates memory buffer for specified device. It uses
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 189 * device specific contiguous memory area if available or the default
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 190 * global one. Requires architecture specific dev_get_cma_area() helper
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 191 * function.
c64be2bb1c6eb4 drivers/base/dma-contiguous.c Marek Szyprowski 2011-12-29 192 */
67a2e213e7e937 drivers/base/dma-contiguous.c Rohit Vaswani 2015-10-22 193 struct page *dma_alloc_from_contiguous(struct device *dev, size_t count,
d834c5ab83febf kernel/dma/contiguous.c Marek Szyprowski 2018-08-17 194 unsigned int align, bool no_warn)
c64be2bb1c6eb4 drivers/base/dma-contiguous.c Marek Szyprowski 2011-12-29 195 {
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 196 if (align > CONFIG_CMA_ALIGNMENT)
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 197 align = CONFIG_CMA_ALIGNMENT;
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 198
d834c5ab83febf kernel/dma/contiguous.c Marek Szyprowski 2018-08-17 @199 return cma_alloc(dev_get_cma_area(dev), count, align, no_warn);
c64be2bb1c6eb4 drivers/base/dma-contiguous.c Marek Szyprowski 2011-12-29 200 }
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 201
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 202 /**
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 203 * dma_release_from_contiguous() - release allocated pages
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 204 * @dev: Pointer to device for which the pages were allocated.
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 205 * @pages: Allocated pages.
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 206 * @count: Number of allocated pages.
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 207 *
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 208 * This function releases memory allocated by dma_alloc_from_contiguous().
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 209 * It returns false when provided pages do not belong to contiguous area and
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 210 * true otherwise.
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 211 */
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 212 bool dma_release_from_contiguous(struct device *dev, struct page *pages,
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 213 int count)
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 214 {
a254129e8686bf drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 @215 return cma_release(dev_get_cma_area(dev), pages, count);
3162bbd7e65b9c drivers/base/dma-contiguous.c Joonsoo Kim 2014-08-06 216 }de9e14eebf33a6 drivers/base/dma-contiguous.c Marek Szyprowski 2014-10-13 217
:::::: The code at line 199 was first introduced by commit
:::::: d834c5ab83febf9624ad3b16c3c348aa1e02014c kernel/dma: remove unsupported gfp_mask parameter from dma_alloc_from_contiguous()
:::::: TO: Marek Szyprowski <[email protected]> :::::: CC: Linus Torvalds <[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/[email protected] Intel Corporation
Wei Hu
maintainerHello
Quoted 223 lines
-----Original Message-----
From: kbuild test robot <[email protected]>
Sent: Monday, November 25, 2019 9:08 PM
To: Wei Hu <[email protected]>
Cc: kbuild-all(a)lists.01.org; b.zolnierkie(a)samsung.com; KY Srinivasan <[email protected]>; Haiyang Zhang <[email protected]>; Stephen Hemminger <[email protected]>; sashal(a)kernel.org; hch(a)lst.de; m.szyprowski(a)samsung.com; mchehab+samsung(a)kernel.org; sam(a)ravnborg.org; gregkh(a)linuxfoundation.org; alexandre.belloni(a)bootlin.com; info(a)metux.net; arnd(a)arndb.de; dri- devel(a)lists.freedesktop.org; linux-fbdev(a)vger.kernel.org; linux- kernel(a)vger.kernel.org; linux-hyperv(a)vger.kernel.org; Dexuan Cui <[email protected]>; Michael Kelley <[email protected]>; Wei Hu <[email protected]>
Subject: [EXTERNAL] Re: [PATCH v2] video: hyperv:hyperv_fb: Use physical memory for fb on HyperV Gen 1 VMs.Hi Wei,
I love your patch! Yet something to improve:
[auto build test ERROR on next-20191122] [cannot apply to linus/master v5.4- rc8 v5.4-rc7 v5.4-rc6 v5.4] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see
https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstackov
erflow.com%2Fa%2F37406982&data=02%7C01%7Cweh%40microsoft.co m%7C0a066e2f4f2540c2a06808d771a89108%7C72f988bf86f141af91ab2d7cd 011db47%7C1%7C0%7C637102843751160438&sdata=CdmaSvX3I3TaGks ve9R7N0Z3Sx1ln5Z3CYHuL5thLrI%3D&reserved=0]url:
https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.
com%2F0day-ci%2Flinux%2Fcommits%2FWei-Hu%2Fvideo-hyperv-hyperv_fb- Use-physical-memory-for-fb-on-HyperV-Gen-1-VMs%2F20191124- 163533&data=02%7C01%7Cweh%40microsoft.com%7C0a066e2f4f2540c 2a06808d771a89108%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7 C637102843751160438&sdata=eDTZuM3ZJmVw6FXgcl9adf9qH9wMboNr aFC1KTjb6YE%3D&reserved=0
base:b9d3d01405061bb42358fe53f824e894a1922ced
config: i386-randconfig-b003-20191125 (attached as .config)
compiler: gcc-7 (Debian 7.4.0-14) 7.4.0
reproduce:# save the attached .config to linux build tree make ARCH=i386If you fix the issue, kindly add following tag
Reported-by kbuild test robot <[email protected]>All errors (new ones prefixed by >>):
ld:
kernel/dma/contiguous.o: in function `dma_alloc_from_contiguous':Quoted 2 lines
Quoted 2 lines
kernel/dma/contiguous.c:199: undefined reference to `cma_alloc'
ld:kernel/dma/contiguous.c:199: undefined reference to `cma_alloc'ld:
kernel/dma/contiguous.o: in function `dma_release_from_contiguous':Quoted 2 lines
Quoted 2 lines
kernel/dma/contiguous.c:215: undefined reference to `cma_release'
ld:kernel/dma/contiguous.c:215: undefined reference to `cma_release'ld:
kernel/dma/contiguous.o: in function `dma_alloc_contiguous':
kernel/dma/contiguous.c:248: undefined reference to `cma_alloc'
ld:kernel/dma/contiguous.o: in function `dma_free_contiguous':
kernel/dma/contiguous.c:267: undefined reference to `cma_release'
ld:kernel/dma/contiguous.c:267: undefined reference to `cma_release'
ld:kernel/dma/contiguous.o: in function `dma_contiguous_reserve_area':Quoted 1 line
Quoted 1 line
kernel/dma/contiguous.c:169: undefined reference to`cma_declare_contiguous'
Quoted 2 lines
Quoted 2 lines
ld:
kernel/dma/contiguous.c:175: undefined reference to `cma_get_size'
ld:kernel/dma/contiguous.c:175: undefined reference to `cma_get_base'vim +199
kernel/dma/contiguous.c
c64be2bb1c6eb4drivers/base/dma-contiguous.cMarek Szyprowski 2011-12-29 1453162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
146 /**3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
147 *dma_contiguous_reserve_area()- reserve custom contiguous area3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
148 * @size: Size of the reserved area (in bytes),3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
149 * @base: Base address of the reserved area optional, use 0 for any3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
150 * @limit: End address of the reserved memory (optional, 0 for any).3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
151 * @res_cma: Pointer to store the created cma region.3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
152 * @fixed: hint about where to place the reserved area3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
153 *3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
154 * This function reserves memory from early allocator. It should be3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
155 * called by arch specific code once the early allocator (memblock or
bootmem)3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
156 * has been activated and all other subsystems have already
allocated/reserved3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
157 * memory. This function allows to create custom reserved areas for
specific3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
158 * devices.3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
159 *3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
160 * If @fixed is true, reserve contiguous area at exactly @base. If false,3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
161 * reserve in range from @base to @limit.3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
162 */3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
163 int__initdma_contiguous_reserve_area(phys_addr_t size,phys_addr_tbase,3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
164phys_addr_tlimit, struct cma **res_cma,3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
165 bool fixed)3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
166 {3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
167 int ret;3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
168f318dd083c8128drivers/base/dma-contiguous.cLaura Abbott 2017-04-18
@169 ret = cma_declare_contiguous(base, size, limit, 0, 0, fixed,f318dd083c8128drivers/base/dma-contiguous.cLaura Abbott 2017-04-18
170 "reserved",res_cma);3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
171 if (ret)3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
172 return ret;3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
1733162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
174 /* Architecture specific contiguous memory fixup. */a254129e8686bfdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
@175 dma_contiguous_early_fixup(cma_get_base(*res_cma),a254129e8686bfdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
176cma_get_size(*res_cma));3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
1773162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
178 return 0;3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
179 }3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
180c64be2bb1c6eb4drivers/base/dma-contiguous.cMarek Szyprowski 2011-12-29 181 /**3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
182 *dma_alloc_from_contiguous()- allocate pages from contiguous area3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
183 * @dev: Pointer to device for which the allocation is performed.3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
184 * @count: Requested number of pages.3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
185 * @align: Requested alignment of pages (inPAGE_SIZEorder).d834c5ab83febfkernel/dma/contiguous.cMarek Szyprowski 2018-08-17
186 * @no_warn: Avoid printing message about failed allocation.c64be2bb1c6eb4drivers/base/dma-contiguous.cMarek Szyprowski 2011-12-29
187 *3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
188 * This function allocates memory buffer for specified device. It uses3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
189 * device specific contiguous memory area if available or the default3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
190 * global one. Requires architecture specificdev_get_cma_area()helper3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
191 * function.c64be2bb1c6eb4drivers/base/dma-contiguous.cMarek Szyprowski 2011-12-29
192 */67a2e213e7e937drivers/base/dma-contiguous.cRohit Vaswani 2015-10-22
193 struct page *dma_alloc_from_contiguous(struct device *dev,size_tcount,d834c5ab83febfkernel/dma/contiguous.cMarek Szyprowski 2018-08-17
194 unsigned int align, boolno_warn)c64be2bb1c6eb4drivers/base/dma-contiguous.cMarek Szyprowski 2011-12-29 195 {3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
196 if (align >CONFIG_CMA_ALIGNMENT)3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
197 align =CONFIG_CMA_ALIGNMENT;3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
198d834c5ab83febfkernel/dma/contiguous.cMarek Szyprowski 2018-08-17
@199 returncma_alloc(dev_get_cma_area(dev), count, align, no_warn);c64be2bb1c6eb4drivers/base/dma-contiguous.cMarek Szyprowski 2011-12-29 200 }3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
2013162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
202 /**3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
203 *dma_release_from_contiguous()- release allocated pages3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
204 * @dev: Pointer to device for which the pages were allocated.3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
205 * @pages: Allocated pages.3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
206 * @count: Number of allocated pages.3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
207 *3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
208 * This function releases memory allocated bydma_alloc_from_contiguous().3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
209 * It returns false when provided pages do not belong to contiguous area
and3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
210 * true otherwise.3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
211 */3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
212 bool dma_release_from_contiguous(struct device *dev, struct page *pages,3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
213 int count)3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
214 {a254129e8686bfdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
@215 returncma_release(dev_get_cma_area(dev), pages, count);3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
216 }de9e14eebf33a6drivers/base/dma-contiguous.cMarek Szyprowski 2014-10-13 217
Quoted 7 lines
:::::: The code at line 199 was first introduced by commit ::::::
d834c5ab83febf9624ad3b16c3c348aa1e02014ckernel/dma: remove unsupportedgfp_maskparameter fromdma_alloc_from_contiguous():::::: TO: Marek Szyprowski <[email protected]> :::::: CC: Linus Torvalds <[email protected]>
I am trying to figure out why these errors happened with my patch. My patch didn't Change kernel/dma/contiguous.c, though the patch did involve a Kconfig file change In drivers/video/fbdev/Kconfig:
select DMA_CMA if HAVE_DMA_CONTIGUOUS
I didn't see such errors in my build env. Can you share some insights on how this Happens?
Thanks,
Wei
Quoted 231 lines · Wei Hu
Hello
Quoted 222 lines
-----Original Message-----
From: kbuild test robot <[email protected]>
Sent: Monday, November 25, 2019 9:08 PM
To: Wei Hu <[email protected]>
Cc: kbuild-all(a)lists.01.org; b.zolnierkie(a)samsung.com; KY Srinivasan <[email protected]>; Haiyang Zhang <[email protected]>; Stephen Hemminger <[email protected]>; sashal(a)kernel.org; hch(a)lst.de; m.szyprowski(a)samsung.com; mchehab+samsung(a)kernel.org; sam(a)ravnborg.org; gregkh(a)linuxfoundation.org; alexandre.belloni(a)bootlin.com; info(a)metux.net; arnd(a)arndb.de; dri- devel(a)lists.freedesktop.org; linux-fbdev(a)vger.kernel.org; linux- kernel(a)vger.kernel.org; linux-hyperv(a)vger.kernel.org; Dexuan Cui <[email protected]>; Michael Kelley <[email protected]>; Wei Hu <[email protected]>
Subject: [EXTERNAL] Re: [PATCH v2] video: hyperv:hyperv_fb: Use physical memory for fb on HyperV Gen 1 VMs.Hi Wei,
I love your patch! Yet something to improve:
[auto build test ERROR on next-20191122] [cannot apply to linus/master v5.4- rc8 v5.4-rc7 v5.4-rc6 v5.4] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see
https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstackov
erflow.com%2Fa%2F37406982&data=02%7C01%7Cweh%40microsoft.co m%7C0a066e2f4f2540c2a06808d771a89108%7C72f988bf86f141af91ab2d7cd 011db47%7C1%7C0%7C637102843751160438&sdata=CdmaSvX3I3TaGks ve9R7N0Z3Sx1ln5Z3CYHuL5thLrI%3D&reserved=0]url:
https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.
com%2F0day-ci%2Flinux%2Fcommits%2FWei-Hu%2Fvideo-hyperv-hyperv_fb- Use-physical-memory-for-fb-on-HyperV-Gen-1-VMs%2F20191124- 163533&data=02%7C01%7Cweh%40microsoft.com%7C0a066e2f4f2540c 2a06808d771a89108%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7 C637102843751160438&sdata=eDTZuM3ZJmVw6FXgcl9adf9qH9wMboNr aFC1KTjb6YE%3D&reserved=0
base:b9d3d01405061bb42358fe53f824e894a1922ced
config: i386-randconfig-b003-20191125 (attached as .config)
compiler: gcc-7 (Debian 7.4.0-14) 7.4.0
reproduce:# save the attached .config to linux build tree make ARCH=i386If you fix the issue, kindly add following tag
Reported-by kbuild test robot <[email protected]>All errors (new ones prefixed by >>):
ld:
kernel/dma/contiguous.o: in function `dma_alloc_from_contiguous':Quoted 2 lines
Quoted 2 lines
kernel/dma/contiguous.c:199: undefined reference to `cma_alloc'
ld:kernel/dma/contiguous.c:199: undefined reference to `cma_alloc'ld:
kernel/dma/contiguous.o: in function `dma_release_from_contiguous':Quoted 2 lines
Quoted 2 lines
kernel/dma/contiguous.c:215: undefined reference to `cma_release'
ld:kernel/dma/contiguous.c:215: undefined reference to `cma_release'ld:
kernel/dma/contiguous.o: in function `dma_alloc_contiguous':
kernel/dma/contiguous.c:248: undefined reference to `cma_alloc'
ld:kernel/dma/contiguous.o: in function `dma_free_contiguous':
kernel/dma/contiguous.c:267: undefined reference to `cma_release'
ld:kernel/dma/contiguous.c:267: undefined reference to `cma_release'
ld:kernel/dma/contiguous.o: in function `dma_contiguous_reserve_area':Quoted 1 line
Quoted 1 line
kernel/dma/contiguous.c:169: undefined reference to`cma_declare_contiguous'
Quoted 2 lines
Quoted 2 lines
ld:
kernel/dma/contiguous.c:175: undefined reference to `cma_get_size'
ld:kernel/dma/contiguous.c:175: undefined reference to `cma_get_base'vim +199
kernel/dma/contiguous.c
c64be2bb1c6eb4drivers/base/dma-contiguous.cMarek Szyprowski 2011-12-29 1453162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
146 /**3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
147 *dma_contiguous_reserve_area()- reserve custom contiguous area3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
148 * @size: Size of the reserved area (in bytes),3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
149 * @base: Base address of the reserved area optional, use 0 for any3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
150 * @limit: End address of the reserved memory (optional, 0 for any).3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
151 * @res_cma: Pointer to store the created cma region.3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
152 * @fixed: hint about where to place the reserved area3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
153 *3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
154 * This function reserves memory from early allocator. It should be3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
155 * called by arch specific code once the early allocator (memblock or
bootmem)3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
156 * has been activated and all other subsystems have already
allocated/reserved3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
157 * memory. This function allows to create custom reserved areas for
specific3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
158 * devices.3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
159 *3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
160 * If @fixed is true, reserve contiguous area at exactly @base. If false,3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
161 * reserve in range from @base to @limit.3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
162 */3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
163 int__initdma_contiguous_reserve_area(phys_addr_t size,phys_addr_tbase,3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
164phys_addr_tlimit, struct cma **res_cma,3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
165 bool fixed)3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
166 {3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
167 int ret;3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
168f318dd083c8128drivers/base/dma-contiguous.cLaura Abbott 2017-04-18
@169 ret = cma_declare_contiguous(base, size, limit, 0, 0, fixed,f318dd083c8128drivers/base/dma-contiguous.cLaura Abbott 2017-04-18
170 "reserved",res_cma);3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
171 if (ret)3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
172 return ret;3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
1733162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
174 /* Architecture specific contiguous memory fixup. */a254129e8686bfdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
@175 dma_contiguous_early_fixup(cma_get_base(*res_cma),a254129e8686bfdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
176cma_get_size(*res_cma));. this patch introduced3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
1773162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
178 return 0;3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
179 }3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
180c64be2bb1c6eb4drivers/base/dma-contiguous.cMarek Szyprowski 2011-12-29 181 /**3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
182 *dma_alloc_from_contiguous()- allocate pages from contiguous area3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
183 * @dev: Pointer to device for which the allocation is performed.3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
184 * @count: Requested number of pages.3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
185 * @align: Requested alignment of pages (inPAGE_SIZEorder).d834c5ab83febfkernel/dma/contiguous.cMarek Szyprowski 2018-08-17
186 * @no_warn: Avoid printing message about failed allocation.c64be2bb1c6eb4drivers/base/dma-contiguous.cMarek Szyprowski 2011-12-29
187 *3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
188 * This function allocates memory buffer for specified device. It uses3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
189 * device specific contiguous memory area if available or the default3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
190 * global one. Requires architecture specificdev_get_cma_area()helper3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
191 * function.c64be2bb1c6eb4drivers/base/dma-contiguous.cMarek Szyprowski 2011-12-29
192 */67a2e213e7e937drivers/base/dma-contiguous.cRohit Vaswani 2015-10-22
193 struct page *dma_alloc_from_contiguous(struct device *dev,size_tcount,d834c5ab83febfkernel/dma/contiguous.cMarek Szyprowski 2018-08-17
194 unsigned int align, boolno_warn)c64be2bb1c6eb4drivers/base/dma-contiguous.cMarek Szyprowski 2011-12-29 195 {3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
196 if (align >CONFIG_CMA_ALIGNMENT)3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
197 align =CONFIG_CMA_ALIGNMENT;3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
198d834c5ab83febfkernel/dma/contiguous.cMarek Szyprowski 2018-08-17
@199 returncma_alloc(dev_get_cma_area(dev), count, align, no_warn);c64be2bb1c6eb4drivers/base/dma-contiguous.cMarek Szyprowski 2011-12-29 200 }3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
2013162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
202 /**3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
203 *dma_release_from_contiguous()- release allocated pages3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
204 * @dev: Pointer to device for which the pages were allocated.3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
205 * @pages: Allocated pages.3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
206 * @count: Number of allocated pages.3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
207 *3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
208 * This function releases memory allocated bydma_alloc_from_contiguous().3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
209 * It returns false when provided pages do not belong to contiguous area
and3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
210 * true otherwise.3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
211 */3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
212 bool dma_release_from_contiguous(struct device *dev, struct page *pages,3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
213 int count)3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
214 {a254129e8686bfdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
@215 returncma_release(dev_get_cma_area(dev), pages, count);3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
216 }de9e14eebf33a6drivers/base/dma-contiguous.cMarek Szyprowski 2014-10-13 217Quoted 7 lines
:::::: The code at line 199 was first introduced by commit ::::::
d834c5ab83febf9624ad3b16c3c348aa1e02014ckernel/dma: remove unsupportedgfp_maskparameter fromdma_alloc_from_contiguous():::::: TO: Marek Szyprowski <[email protected]> :::::: CC: Linus Torvalds <[email protected]>
Quoted 7 lines
I am trying to figure out why these errors happened with my patch. My patch didn't Change
kernel/dma/contiguous.c, though the patch did involve aKconfigfile change Indrivers/video/fbdev/Kconfig:
selectDMA_CMAifHAVE_DMA_CONTIGUOUSI didn't see such errors in my build env. Can you share some insights on how this Happens?
Hi Wei,
We can reproduce the issue with attached config file, CONFIG_CMA is not set in the config,
I think it maybe the root cause and it's a kconfig dependency problem.
Best Regards,
Rong Chen
Quoted 6 lines
Thanks,
Wei
_______________________________________________
kbuild-all mailing list -- kbuild-all(a)lists.01.org To unsubscribe send an email to kbuild-all-leave(a)lists.01.org
Wei Hu
maintainerQuoted 262 lines
-----Original Message-----
From: Rong Chen <[email protected]>
Sent: 2019年11月27日 15:40
To: Wei Hu <[email protected]>; kbuild test robot <[email protected]>
Cc: kbuild-all(a)lists.01.org
Subject: Re: [kbuild-all] Re: [EXTERNAL] Re: [PATCH v2] video: hyperv:hyperv_fb:
Use physical memory for fb on HyperV Gen 1 VMs.Quoted 8 lines · Wei Hu
Hello
Quoted 6 lines
Hi Wei,
I love your patch! Yet something to improve:
[auto build test ERROR on next-20191122] [cannot apply to linus/master
v5.4-
Quoted 1 line
Quoted 1 line
rc8 v5.4-rc7 v5.4-rc6 v5.4] [if your patch is applied to the wrong git tree,
please
Quoted 1 line
Quoted 1 line
drop us a note to help improve the system. BTW, we also suggest to use '--
base'
Quoted 2 lines
Quoted 2 lines
option to specify the base tree in git format-patch, please see
https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstackov
Quoted 1 line
Quoted 1 line
erflow.com%2Fa%2F37406982&data=02%7C01%7Cweh%40microsoft.co
Quoted 1 line
Quoted 1 line
m%7C0a066e2f4f2540c2a06808d771a89108%7C72f988bf86f141af91ab2d7cd
Quoted 1 line
Quoted 1 line
011db47%7C1%7C0%7C637102843751160438&sdata=CdmaSvX3I3TaGks
Quoted 4 lines
Quoted 4 lines
ve9R7N0Z3Sx1ln5Z3CYHuL5thLrI%3D&reserved=0]
url:
https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.
Quoted 1 line
Quoted 1 line
com%2F0day-ci%2Flinux%2Fcommits%2FWei-Hu%2Fvideo-hyperv-
hyperv_fb-
Quoted 2 lines
Quoted 2 lines
Use-physical-memory-for-fb-on-HyperV-Gen-1-VMs%2F20191124-
163533&data=02%7C01%7Cweh%40microsoft.com%7C0a066e2f4f2540c
Quoted 2 lines
Quoted 2 lines
2a06808d771a89108%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7
C637102843751160438&sdata=eDTZuM3ZJmVw6FXgcl9adf9qH9wMboNr
Quoted 25 lines
Quoted 25 lines
aFC1KTjb6YE%3D&reserved=0
base:b9d3d01405061bb42358fe53f824e894a1922ced
config: i386-randconfig-b003-20191125 (attached as .config)
compiler: gcc-7 (Debian 7.4.0-14) 7.4.0
reproduce:# save the attached .config to linux build tree make ARCH=i386If you fix the issue, kindly add following tag
Reported-by kbuild test robot <[email protected]>All errors (new ones prefixed by >>):
ld:
kernel/dma/contiguous.o: in function `dma_alloc_from_contiguous':Quoted 2 lines
Quoted 2 lines
kernel/dma/contiguous.c:199: undefined reference to `cma_alloc'
ld:kernel/dma/contiguous.c:199: undefined reference to `cma_alloc'ld:
kernel/dma/contiguous.o: in function `dma_release_from_contiguous':Quoted 2 lines
Quoted 2 lines
kernel/dma/contiguous.c:215: undefined reference to `cma_release'
ld:kernel/dma/contiguous.c:215: undefined reference to `cma_release'ld:
kernel/dma/contiguous.o: in function `dma_alloc_contiguous':
kernel/dma/contiguous.c:248: undefined reference to `cma_alloc'
ld:kernel/dma/contiguous.o: in function `dma_free_contiguous':
kernel/dma/contiguous.c:267: undefined reference to `cma_release'
ld:kernel/dma/contiguous.c:267: undefined reference to `cma_release'
ld:kernel/dma/contiguous.o: in function `dma_contiguous_reserve_area':Quoted 7 lines
Quoted 7 lines
Quoted 1 line
Quoted 1 line
kernel/dma/contiguous.c:169: undefined reference to`cma_declare_contiguous'
Quoted 2 lines
Quoted 2 lines
ld:
kernel/dma/contiguous.c:175: undefined reference to `cma_get_size'
ld:kernel/dma/contiguous.c:175: undefined reference to `cma_get_base'vim +199
kernel/dma/contiguous.c
c64be2bb1c6eb4drivers/base/dma-contiguous.cMarek Szyprowski 2011-12-29
Quoted 59 lines
Quoted 59 lines
145
3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
146 /**3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
147 *dma_contiguous_reserve_area()- reserve custom contiguous area3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
148 * @size: Size of the reserved area (in bytes),3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
149 * @base: Base address of the reserved area optional, use 0 for any3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
150 * @limit: End address of the reserved memory (optional, 0 for any).3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
151 * @res_cma: Pointer to store the created cma region.3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
152 * @fixed: hint about where to place the reserved area3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
153 *3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
154 * This function reserves memory from early allocator. It should be3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
155 * called by arch specific code once the early allocator (memblock or
bootmem)3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
156 * has been activated and all other subsystems have already
allocated/reserved3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
157 * memory. This function allows to create custom reserved areas for
specific3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
158 * devices.3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
159 *3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
160 * If @fixed is true, reserve contiguous area at exactly @base. If false,3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
161 * reserve in range from @base to @limit.3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
162 */3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
163 int__initdma_contiguous_reserve_area(phys_addr_t size,phys_addr_tbase,3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
164phys_addr_tlimit, struct cma **res_cma,3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
165 bool fixed)3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
166 {3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
167 int ret;3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
168f318dd083c8128drivers/base/dma-contiguous.cLaura Abbott 2017-04-18
@169 ret = cma_declare_contiguous(base, size, limit, 0, 0, fixed,f318dd083c8128drivers/base/dma-contiguous.cLaura Abbott 2017-04-18
170 "reserved",res_cma);3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
171 if (ret)3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
172 return ret;Quoted 8 lines
Quoted 8 lines
3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
1733162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
174 /* Architecture specific contiguous memory fixup. */a254129e8686bfdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
@175 dma_contiguous_early_fixup(cma_get_base(*res_cma),a254129e8686bfdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
176cma_get_size(*res_cma));. this patchintroduced
Quoted 9 lines
Quoted 9 lines
3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
1773162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
178 return 0;3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
179 }3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
180c64be2bb1c6eb4drivers/base/dma-contiguous.cMarek Szyprowski 2011-12-29
Quoted 4 lines
Quoted 4 lines
181 /**
3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
182 *dma_alloc_from_contiguous()- allocate pages from contiguous area3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06Quoted 8 lines
Quoted 8 lines
183 * @dev: Pointer to device for which the allocation is performed.
3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
184 * @count: Requested number of pages.3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
185 * @align: Requested alignment of pages (inPAGE_SIZEorder).d834c5ab83febfkernel/dma/contiguous.cMarek Szyprowski 2018-08-17
186 * @no_warn: Avoid printing message about failed allocation.c64be2bb1c6eb4drivers/base/dma-contiguous.cMarek Szyprowski 2011-12-29
Quoted 10 lines
Quoted 10 lines
187 *
3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
188 * This function allocates memory buffer for specified device. It uses3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
189 * device specific contiguous memory area if available or the default3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
190 * global one. Requires architecture specificdev_get_cma_area()helper3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
191 * function.c64be2bb1c6eb4drivers/base/dma-contiguous.cMarek Szyprowski 2011-12-29
Quoted 2 lines
Quoted 2 lines
192 */
67a2e213e7e937drivers/base/dma-contiguous.cRohit Vaswani 2015-10-22
Quoted 1 line
Quoted 1 line
193 struct page *dma_alloc_from_contiguous(struct device *dev,
size_tcount,
Quoted 3 lines
Quoted 3 lines
d834c5ab83febfkernel/dma/contiguous.cMarek Szyprowski 2018-08-17
194 unsigned int align, boolno_warn)c64be2bb1c6eb4drivers/base/dma-contiguous.cMarek Szyprowski 2011-12-29
Quoted 9 lines
Quoted 9 lines
195 {
3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
196 if (align >CONFIG_CMA_ALIGNMENT)3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
197 align =CONFIG_CMA_ALIGNMENT;3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
198d834c5ab83febfkernel/dma/contiguous.cMarek Szyprowski 2018-08-17
@199 return cma_alloc(dev_get_cma_area(dev), count, align,
no_warn);Quoted 1 line
Quoted 1 line
c64be2bb1c6eb4drivers/base/dma-contiguous.cMarek Szyprowski 2011-12-29
Quoted 19 lines
Quoted 19 lines
200 }
3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
2013162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
202 /**3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
203 *dma_release_from_contiguous()- release allocated pages3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
204 * @dev: Pointer to device for which the pages were allocated.3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
205 * @pages: Allocated pages.3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
206 * @count: Number of allocated pages.3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
207 *3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
208 * This function releases memory allocated bydma_alloc_from_contiguous().3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06Quoted 8 lines
Quoted 8 lines
209 * It returns false when provided pages do not belong to contiguous area
and3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
210 * true otherwise.3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
211 */3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
212 bool dma_release_from_contiguous(struct device *dev, struct page*pages,
Quoted 9 lines
Quoted 9 lines
3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
213 int count)3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
214 {a254129e8686bfdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
@215 returncma_release(dev_get_cma_area(dev), pages, count);3162bbd7e65b9cdrivers/base/dma-contiguous.cJoonsoo Kim 2014-08-06
216 }de9e14eebf33a6drivers/base/dma-contiguous.cMarek Szyprowski 2014-10-13
Quoted 10 lines
Quoted 9 lines
217
:::::: The code at line 199 was first introduced by commit ::::::
d834c5ab83febf9624ad3b16c3c348aa1e02014ckernel/dma: remove unsupportedgfp_maskparameter fromdma_alloc_from_contiguous():::::: TO: Marek Szyprowski <[email protected]> :::::: CC: Linus Torvalds <[email protected]>
I am trying to figure out why these errors happened with my patch. My patch
didn't
Quoted 1 line
Change
kernel/dma/contiguous.c, though the patch did involve aKconfigfilechange
Quoted 4 lines
In
drivers/video/fbdev/Kconfig:
selectDMA_CMAifHAVE_DMA_CONTIGUOUSI didn't see such errors in my build env. Can you share some insights on how
this
Quoted 1 line
Happens?
Quoted 8 lines
Hi Wei,
We can reproduce the issue with attached config file,
CONFIG_CMAis not set in the config,
I think it maybe the root cause and it's a kconfig dependency problem.Best Regards,
Rong Chen
Thanks Rong. Would you let me know if you hit this only when building 32 bit kernel, or when building both 32 and 64 bit?
The .config file you sent doesn't have CONFIG_CMA set. However, when I was building, the build process asked me about the CMA configurations. Hence, in my .config file have following lines:
CONFIG_CMA=yCONFIG_DMA_CMA=yCONFIG_HAVE_DMA_CONTIGUOUS=y
Why first two setting are no in your .config file?
Thanks,
Wei
Quoted 54 lines · Wei Hu
Quoted 54 lines
-----Original Message-----
From: Rong Chen <[email protected]>
Sent: 2019年11月27日 15:40
To: Wei Hu <[email protected]>; kbuild test robot <[email protected]>
Cc: kbuild-all(a)lists.01.org
Subject: Re: [kbuild-all] Re: [EXTERNAL] Re: [PATCH v2] video: hyperv:hyperv_fb:
Use physical memory for fb on HyperV Gen 1 VMs.Quoted 7 lines · Wei Hu
Hello
Quoted 5 lines
Hi Wei,
I love your patch! Yet something to improve:
[auto build test ERROR on next-20191122] [cannot apply to linus/master
v5.4-
Quoted 1 line
Quoted 1 line
rc8 v5.4-rc7 v5.4-rc6 v5.4] [if your patch is applied to the wrong git tree,
please
Quoted 1 line
Quoted 1 line
drop us a note to help improve the system. BTW, we also suggest to use '--
base'
Quoted 2 lines
Quoted 2 lines
option to specify the base tree in git format-patch, please see
https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstackov
erflow.com%2Fa%2F37406982&data=02%7C01%7Cweh%40microsoft.co m%7C0a066e2f4f2540c2a06808d771a89108%7C72f988bf86f141af91ab2d7cd 011db47%7C1%7C0%7C637102843751160438&sdata=CdmaSvX3I3TaGksQuoted 4 lines
Quoted 4 lines
ve9R7N0Z3Sx1ln5Z3CYHuL5thLrI%3D&reserved=0]
url:
https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.
Quoted 1 line
Quoted 1 line
com%2F0day-ci%2Flinux%2Fcommits%2FWei-Hu%2Fvideo-hyperv-
hyperv_fb-
Quoted 2 lines
Quoted 2 lines
Use-physical-memory-for-fb-on-HyperV-Gen-1-VMs%2F20191124-
163533&data=02%7C01%7Cweh%40microsoft.com%7C0a066e2f4f2540c
Quoted 2 lines
Quoted 2 lines
2a06808d771a89108%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7
C637102843751160438&sdata=eDTZuM3ZJmVw6FXgcl9adf9qH9wMboNr
Quoted 11 lines
Quoted 11 lines
aFC1KTjb6YE%3D&reserved=0
base:b9d3d01405061bb42358fe53f824e894a1922ced
config: i386-randconfig-b003-20191125 (attached as .config)
compiler: gcc-7 (Debian 7.4.0-14) 7.4.0
reproduce:# save the attached .config to linux build tree make ARCH=i386If you fix the issue, kindly add following tag
Reported-by kbuild test robot <[email protected]>
...
Quoted 15 lines
Quoted 8 lines
Hi Wei,
We can reproduce the issue with attached config file,
CONFIG_CMAis not set in the config,
I think it maybe the root cause and it's a kconfig dependency problem.Best Regards,
Rong ChenThanks Rong. Would you let me know if you hit this only when building 32 bit kernel, or when building both 32 and 64 bit?
The .config file you sent doesn't have
CONFIG_CMAset. However, when I was building, the build process asked me about the CMA configurations. Hence, in my .config file have following lines:
Quoted 5 lines
CONFIG_CMA=yCONFIG_DMA_CMA=yCONFIG_HAVE_DMA_CONTIGUOUS=yWhy first two setting are no in your .config file?
Hi Wei,
The config was generated by randconfig, it means the current config dependency allows to not enable CONFIG_CMA.
Best Regards,
Rong Chen
Wei Hu
maintainerQuoted 97 lines
-----Original Message-----
From: Rong Chen <[email protected]>
Sent: 2019年11月27日 16:29
To: Wei Hu <[email protected]>; kbuild test robot <[email protected]>
Cc: kbuild-all(a)lists.01.org
Subject: Re: [kbuild-all] Re: [EXTERNAL] Re: [PATCH v2] video: hyperv:hyperv_fb:
Use physical memory for fb on HyperV Gen 1 VMs.Quoted 7 lines · Wei Hu
Quoted 7 lines
-----Original Message-----
From: Rong Chen <[email protected]>
Sent: 2019年11月27日 15:40
To: Wei Hu <[email protected]>; kbuild test robot <[email protected]>
Cc: kbuild-all(a)lists.01.org
Subject: Re: [kbuild-all] Re: [EXTERNAL] Re: [PATCH v2] video: hyperv:
hyperv_fb:Quoted 12 lines
Quoted 12 lines
Use physical memory for fb on HyperV Gen 1 VMs.
Quoted 7 lines · Wei Hu
Hello
Quoted 5 lines
Hi Wei,
I love your patch! Yet something to improve:
[auto build test ERROR on next-20191122] [cannot apply to linus/master
Quoted 8 lines
Quoted 8 lines
v5.4-
Quoted 1 line
Quoted 1 line
rc8 v5.4-rc7 v5.4-rc6 v5.4] [if your patch is applied to the wrong git tree,
please
Quoted 1 line
Quoted 1 line
drop us a note to help improve the system. BTW, we also suggest to use '--
base'
Quoted 2 lines
Quoted 2 lines
option to specify the base tree in git format-patch, please see
https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstackov
Quoted 1 line
Quoted 1 line
erflow.com%2Fa%2F37406982&data=02%7C01%7Cweh%40microsoft.co
Quoted 1 line
Quoted 1 line
m%7C0a066e2f4f2540c2a06808d771a89108%7C72f988bf86f141af91ab2d7cd
Quoted 1 line
Quoted 1 line
011db47%7C1%7C0%7C637102843751160438&sdata=CdmaSvX3I3TaGks
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
ve9R7N0Z3Sx1ln5Z3CYHuL5thLrI%3D&reserved=0]
url:
https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
Quoted 1 line
com%2F0day-ci%2Flinux%2Fcommits%2FWei-Hu%2Fvideo-hyperv-
hyperv_fb-
Quoted 2 lines
Quoted 2 lines
Use-physical-memory-for-fb-on-HyperV-Gen-1-VMs%2F20191124-
163533&data=02%7C01%7Cweh%40microsoft.com%7C0a066e2f4f2540c
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
2a06808d771a89108%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line
C637102843751160438&sdata=eDTZuM3ZJmVw6FXgcl9adf9qH9wMboNr
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
aFC1KTjb6YE%3D&reserved=0
base:b9d3d01405061bb42358fe53f824e894a1922ced
config: i386-randconfig-b003-20191125 (attached as .config)
compiler: gcc-7 (Debian 7.4.0-14) 7.4.0
reproduce:# save the attached .config to linux build tree make ARCH=i386If you fix the issue, kindly add following tag
Reported-by kbuild test robot <[email protected]>...
Quoted 19 lines
Quoted 8 lines
Hi Wei,
We can reproduce the issue with attached config file,
CONFIG_CMAis not set in the config,
I think it maybe the root cause and it's a kconfig dependency problem.Best Regards,
Rong ChenThanks Rong. Would you let me know if you hit this only when building 32 bit kernel, or when building both 32 and 64 bit?
The .config file you sent doesn't have
CONFIG_CMAset. However, when I was building, the build process asked me about the CMA configurations. Hence, in my .config file have following lines:
CONFIG_CMA=yCONFIG_DMA_CMA=yCONFIG_HAVE_DMA_CONTIGUOUS=y
Quoted 7 lines
Quoted 1 line
Why first two setting are no in your .config file?
Hi Wei,
The config was generated by randconfig, it means the current config dependency allows to not enable
CONFIG_CMA.
Ok. I will add "select CMA if HAVE_DMA_CONTIGUOUS" in the patch.
Thanks
Wei
From: Wei Hu <[email protected]> Sent: Friday, November 22, 2019 12:24 AM
Quoted 29 lines
On Hyper-V, Generation 1 VMs can directly use VM's physical memory for their framebuffers. This can improve the efficiency of framebuffer and overall performence for VM. The physical memory assigned to framebuffer must be contiguous. We use CMA allocator to get contiguouse physicial memory when the framebuffer size is greater than 4MB. For size under 4MB, we use
alloc_pagesto achieve this.To enable framebuffer memory allocation from CMA, supply a kernel parameter to give enough space to CMA allocator at boot time. For example:
cma=130mThis gives 130MB memory to CAM allocator that can be allocated to framebuffer. If this fails, we fall back to the old way of using mmio for framebuffer.
Signed-off-by Wei Hu <[email protected]>---
v2: Incorporated review comments form [email protected], Michael Kelley and Dexuan Cui
- Usedma_alloc_coherentto allocate large contiguous memory
- Usephys_addr_tfor physical addresses
- Corrected a few spelling errors and minor cleanups
- Also tested on 32 bit Ubuntu guestdrivers/video/fbdev/Kconfig | 1 + drivers/video/fbdev/hyperv_fb.c | 196 +++++++++++++++++++++++++------- 2 files changed, 158 insertions(+), 39 deletions(-)
[snip]
Quoted 17 lines
drivers/video/fbdev/hyperv_fb.c +17
-0+/* +* Allocate enough contiguous physical memory. +* Return physical address if succeeded or -1 if failed. +*/ +static phys_addr_t hvfb_get_phymem (struct hv_device *hdev, +unsigned int request_size) +{ +struct page *page =NULL ; +dma_addr_t dma_handle; +void *vmem; +unsigned int request_pages; +phys_addr_t paddr =0 ; +unsigned int order =get_order (request_size); + +if (request_size ==0 ) +return -1 ; +
drivers/video/fbdev/hyperv_fb.c static void hvfb_get_option(struct fb_info *info) · line 980
Quoted 10 lines
drivers/video/fbdev/hyperv_fb.c +10
-0+/* Try to call alloc_pages if the size is less than 2^MAX_ORDER */ +if (order <MAX_ORDER ) { + page =alloc_pages (GFP_KERNEL | __GFP_ZERO, order); +if (!page) +return -1 ; + + paddr = (page_to_pfn (page) <<PAGE_SHIFT ); + request_pages = (1 << order); + goto get_phymem1; + }
Could you use an 'else' clause here and eliminate the above 'goto' statement? I know that makes the below code be indented one level deeper, but that doesn't seem particularly problematic here. The reason we have 'else' clauses is to avoid 'goto's and labels. :-)
drivers/video/fbdev/hyperv_fb.c static void hvfb_get_option(struct fb_info *info) · line 984
Quoted 4 lines
drivers/video/fbdev/hyperv_fb.c +4
-0+ +/* Allocate from CMA */ +if (hdev ==NULL ) +return -1 ;
The above test seems unnecessary. A lot of things would have broken before getting to this function if hdev was NULL.
Quoted 8 lines
drivers/video/fbdev/hyperv_fb.c +8
-0+ + hdev->device.coherent_dma_mask =DMA_BIT_MASK (64 ); + + request_pages = (round_up (request_size,PAGE_SIZE ) >>PAGE_SHIFT ); + + vmem = dma_alloc_coherent(&hdev->device, + request_pages * PAGE_SIZE, + &dma_handle,
drivers/video/fbdev/hyperv_fb.c static void hvfb_get_option(struct fb_info *info) · line 1002
Quoted 10 lines
drivers/video/fbdev/hyperv_fb.c +10
-0+ GFP_KERNEL | __GFP_NOWARN); + +if (!vmem) +return -1 ; + + paddr =virt_to_phys (vmem); + +get_phymem1: +pr_info ("Allocated %d pages starts at physical addr 0x%llx\n" , + request_pages, paddr);
I wonder if we want to show the physical address here. The Linux kernel definitely does not show kernel virtual addresses due to security concerns, and I'm wondering if the same applies to physical addresses. What's the benefit to showing the physical address?
And in the message "starts" should be "starting".
Quoted 32 lines
drivers/video/fbdev/hyperv_fb.c +22
-0+ +return paddr; +} + +/* Release contiguous physical memory */ +static void hvfb_release_phymem (struct hv_device *hdev, +phys_addr_t paddr,unsigned int size) +{ +unsigned int order =get_order (size); + +if (order <MAX_ORDER ) +__free_pages (pfn_to_page (paddr >>PAGE_SHIFT ), order); +else +dma_free_coherent (&hdev->device, +round_up (size,PAGE_SIZE ), +phys_to_virt (paddr), + paddr); +} +/* Get framebuffer memory from Hyper-V video pci space */ static int hvfb_getmem (struct hv_device *hdev,struct fb_info *info)@@ -947,8 +1028,57 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info)void __iomem *fb_virt;int gen2vm =efi_enabled (EFI_BOOT );resource_size_t pot_start, pot_end; +phys_addr_t paddr;int ret; +if (!gen2vm) { + pdev = pci_get_device(PCI_VENDOR_ID_MICROSOFT,
drivers/video/fbdev/hyperv_fb.c static int hvfb_getmem(struct hv_device *hdev, struct fb_info · line 1046
Quoted 10 lines
drivers/video/fbdev/hyperv_fb.c +10
-0+ PCI_DEVICE_ID_HYPERV_VIDEO, NULL); +if (!pdev) { +pr_err ("Unable to find PCI Hyper-V video\n" ); +return -ENODEV ; + } + } + + info->apertures =alloc_apertures (1 ); +if (!info->apertures) + goto err1;
There's a small memory leak here. The apertures are never freed in any of the error cases in this function, or in hvfb_putmem(). This is not a bug you introduced -- the original code had the same leak.
Quoted 18 lines
drivers/video/fbdev/hyperv_fb.c +18
-0+ +if (gen2vm) { + info->apertures->ranges[0 ].base = screen_info.lfb_base; + info->apertures->ranges[0 ].size = screen_info.lfb_size; + }else { + info->apertures->ranges[0 ].base =pci_resource_start (pdev,0 ); + info->apertures->ranges[0 ].size =pci_resource_len (pdev,0 ); + } + +/* +* For Gen 1 VM, we can directly use the contiguous memory +* from VM. If we succeed, deferred IO happens directly +* on this allocated framebuffer memory, avoiding extra +* memory copy. +*/ +if (!gen2vm) { + paddr =hvfb_get_phymem (hdev, screen_fb_size); +if (paddr != (phys_addr_t) -1 ) {
drivers/video/fbdev/hyperv_fb.c static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info) · line 1073
Quoted 10 lines
drivers/video/fbdev/hyperv_fb.c +10
-0+ par->mmio_pp = paddr; + par->mmio_vp = par->dio_vp =__va (paddr); + + info->fix.smem_start = paddr; + info->fix.smem_len = screen_fb_size; + info->screen_base = par->mmio_vp; + info->screen_size = screen_fb_size; + + par->need_docopy = false; + goto getmem1;
Maybe change the 'getmem1' label to 'done' or something similarly indicative having successfully completed everything that needs to be done?
Review static int hvfb_getmem(struct hv_device *hdev, struct fb_info · line 1077
Quoted 3 lines
(quoted diff) +2
-0+ } + pr_info("Unable to allocate enough contiguous physical memory on Gen 1 VM. Use MMIO instead.\n");
I'd suggest changing the message to say "Using MMIO instead". This is just an informative message indicating what the driver is doing. "Use MMIO instead" sounds like a directive to the user to do something different, like change his kernel configuration, and that's not the intent.
Review static int hvfb_getmem(struct hv_device *hdev, struct fb_info · line 1078
Quoted 1 line
(quoted diff) +1
-0+ }
In the above code, there are three, almost consecutive, tests of the "gen2vm" variable. It seems like the apertures could be allocated first, and then the three tests combined into one test. Then you have one range of code for Gen 1 and another range for Gen 2 and fewer lines 'if' statements, 'else' statements, and curly braces.
Quoted 46 lines
drivers/video/fbdev/hyperv_fb.c +5
-0+ +/* +* Cannot use the contiguous physical memory. +* Allocate mmio space for framebuffer. +*/ dio_fb_size =drivers/video/fbdev/hyperv_fb.c +0
-7screen_width * screen_height * screen_depth /8 ;@@ -956,13 +1086,6 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info) pot_start =0 ; pot_end =-1 ; }else { - pdev =pci_get_device (PCI_VENDOR_ID_MICROSOFT , -PCI_DEVICE_ID_HYPERV_VIDEO ,NULL ); -if (!pdev) { -pr_err ("Unable to find PCI Hyper-V video\n" ); -return -ENODEV ; - } -if (!(pci_resource_flags (pdev,0 ) &IORESOURCE_MEM ) ||pci_resource_len (pdev,0 ) < screen_fb_size) {drivers/video/fbdev/hyperv_fb.c +0
-14pr_err("Resource not available or (0x%lx < 0x%lx)\n",@@ -991,20 +1114,6 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info)if (par->dio_vp ==NULL ) goto err3; - info->apertures =alloc_apertures (1 ); -if (!info->apertures) - goto err4; - -if (gen2vm) { - info->apertures->ranges[0 ].base = screen_info.lfb_base; - info->apertures->ranges[0 ].size = screen_info.lfb_size; -remove_conflicting_framebuffers (info->apertures, -KBUILD_MODNAME , false); - }else { - info->apertures->ranges[0 ].base =pci_resource_start (pdev,0 ); - info->apertures->ranges[0 ].size =pci_resource_len (pdev,0 ); - } -/* Physical address of FB device */ par->mmio_pp = par->mem->start;drivers/video/fbdev/hyperv_fb.c +0
-0/* Virtual address of FB device */
drivers/video/fbdev/hyperv_fb.c static int hvfb_getmem(struct hv_device *hdev, struct fb_info · line 1130
Quoted 7 lines
drivers/video/fbdev/hyperv_fb.c +3
-0@@ -1015,13 +1124,15 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info) info->screen_base = par->dio_vp; info->screen_size = dio_fb_size; +getmem1: +remove_conflicting_framebuffers (info->apertures, +KBUILD_MODNAME , false);
With your change, remove_conflicting_framebuffers() is called for both Gen 1 and Gen 2 VMs. In the old code, it was called only for Gen 2 VMs. Is this change intentional? If so, why? I haven't delved into the details of what remove_conflicting_framebuffers() does, so my question is more of a double-check rather than my definitely thinking something is wrong.
Quoted 24 lines
drivers/video/fbdev/hyperv_fb.c +1
-2+if (!gen2vm)pci_dev_put (pdev);return 0 ; -err4: -vfree (par->dio_vp); err3:iounmap (fb_virt);err2:
drivers/video/fbdev/hyperv_fb.c +1
-4@@ -1035,13 +1146,19 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info) }/* Release the framebuffer */ -static void hvfb_putmem (struct fb_info *info) +static void hvfb_putmem (struct hv_device *hdev,struct fb_info *info) {struct hvfb_par *par = info->par; -vfree (par->dio_vp); -iounmap (info->screen_base); -vmbus_free_mmio (par->mem->start, screen_fb_size);
drivers/video/fbdev/hyperv_fb.c static int hvfb_getmem(struct hv_device *hdev, struct fb_info · line 1163
Quoted 10 lines
drivers/video/fbdev/hyperv_fb.c +9
-0+if (par->need_docopy) { +vfree (par->dio_vp); +iounmap (info->screen_base); +vmbus_free_mmio (par->mem->start, screen_fb_size); + }else { +hvfb_release_phymem (hdev, info->fix.smem_start, + screen_fb_size); + } + par->mem =NULL ;
There's a small memory leak in the above statement. The data
structure pointed to by "mem" is not freed. The same problem
occurs in hvfb_getmem() in the "err2" path. This bug existed in
the old code as well, so it was not introduced by your changes.
Michael
Wei Hu
maintainerQuoted 112 lines
-----Original Message-----
From: Wei Hu
Sent: 2019年11月27日 19:26
To: Rong Chen <[email protected]>; kbuild test robot <[email protected]>
Cc: kbuild-all(a)lists.01.org
Subject: RE: [kbuild-all] Re: [EXTERNAL] Re: [PATCH v2] video: hyperv:hyperv_fb:
Use physical memory for fb on HyperV Gen 1 VMs.Quoted 6 lines
-----Original Message-----
From: Rong Chen <[email protected]>
Sent: 2019年11月27日 16:29
To: Wei Hu <[email protected]>; kbuild test robot <[email protected]>
Cc: kbuild-all(a)lists.01.org
Subject: Re: [kbuild-all] Re: [EXTERNAL] Re: [PATCH v2] video: hyperv:
hyperv_fb:Quoted 6 lines
Use physical memory for fb on HyperV Gen 1 VMs.
Quoted 1 line · Wei Hu
Quoted 23 lines
Quoted 6 lines
Quoted 6 lines
-----Original Message-----
From: Rong Chen <[email protected]>
Sent: 2019年11月27日 15:40
To: Wei Hu <[email protected]>; kbuild test robot <[email protected]>
Cc: kbuild-all(a)lists.01.org
Subject: Re: [kbuild-all] Re: [EXTERNAL] Re: [PATCH v2] video: hyperv:
hyperv_fb:Quoted 16 lines
Quoted 16 lines
Use physical memory for fb on HyperV Gen 1 VMs.
Quoted 7 lines · Wei Hu
Hello
Quoted 5 lines
Hi Wei,
I love your patch! Yet something to improve:
[auto build test ERROR on next-20191122] [cannot apply to linus/master
v5.4-
Quoted 1 line
Quoted 1 line
rc8 v5.4-rc7 v5.4-rc6 v5.4] [if your patch is applied to the wrong git tree,
please
Quoted 1 line
Quoted 1 line
drop us a note to help improve the system. BTW, we also suggest to use
'--
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
base'
Quoted 2 lines
Quoted 2 lines
option to specify the base tree in git format-patch, please see
https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstackov
Quoted 31 lines
Quoted 1 line
Quoted 1 line
erflow.com%2Fa%2F37406982&data=02%7C01%7Cweh%40microsoft.co
Quoted 1 line
Quoted 1 line
m%7C0a066e2f4f2540c2a06808d771a89108%7C72f988bf86f141af91ab2d7cd
Quoted 1 line
Quoted 1 line
011db47%7C1%7C0%7C637102843751160438&sdata=CdmaSvX3I3TaGks
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
ve9R7N0Z3Sx1ln5Z3CYHuL5thLrI%3D&reserved=0]
url:
https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
Quoted 1 line
com%2F0day-ci%2Flinux%2Fcommits%2FWei-Hu%2Fvideo-hyperv-
hyperv_fb-
Quoted 2 lines
Quoted 2 lines
Use-physical-memory-for-fb-on-HyperV-Gen-1-VMs%2F20191124-
163533&data=02%7C01%7Cweh%40microsoft.com%7C0a066e2f4f2540c
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
2a06808d771a89108%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line
C637102843751160438&sdata=eDTZuM3ZJmVw6FXgcl9adf9qH9wMboNr
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
aFC1KTjb6YE%3D&reserved=0
base:b9d3d01405061bb42358fe53f824e894a1922ced
config: i386-randconfig-b003-20191125 (attached as .config)
compiler: gcc-7 (Debian 7.4.0-14) 7.4.0
reproduce:# save the attached .config to linux build tree make ARCH=i386Quoted 17 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
If you fix the issue, kindly add following tag
Reported-by kbuild test robot <[email protected]>...
Quoted 12 lines
Quoted 8 lines
Hi Wei,
We can reproduce the issue with attached config file,
CONFIG_CMAis not set in the config,
I think it maybe the root cause and it's a kconfig dependency problem.Best Regards,
Rong ChenThanks Rong. Would you let me know if you hit this only when building 32 bit kernel, or when building both 32 and 64 bit?
The .config file you sent doesn't have
CONFIG_CMAset. However, when Iwas
Quoted 1 line
Quoted 1 line
building, the build process asked me about the CMA configurations. Hence,
in
Quoted 6 lines
Quoted 6 lines
my .config file have following lines:
CONFIG_CMA=yCONFIG_DMA_CMA=yCONFIG_HAVE_DMA_CONTIGUOUS=y
Quoted 9 lines
Quoted 7 lines
Quoted 1 line
Why first two setting are no in your .config file?
Hi Wei,
The config was generated by randconfig, it means the current config dependency allows to not enable
CONFIG_CMA.Ok. I will add "select CMA if
HAVE_DMA_CONTIGUOUS" in the patch.
Hello,
I was not able to reproduce this error with the .config file sent to me. Even with CONFIG_CMA not set, I can still successfully build the do 'make ARCH=i386' with out any error. Please provide the instructions to reproduce.
Thanks,
Wei