From: kbuild test robot <lkp@intel.com>
To: buddy.zhang@aliyun.com
Cc: kbuild-all@lists.01.org, akpm@linux-foundation.org,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
BuddyZhang <buddy.zhang@aliyun.com>
Subject: Re: [PATCH] mm/cma.c: find a named CMA area by name
Date: Thu, 16 Jan 2020 12:21:21 +0800 [thread overview]
Message-ID: <202001161259.EgPfyQMU%lkp@intel.com> (raw)
In-Reply-To: <20200114075147.30672-1-buddy.zhang@aliyun.com>
[-- Attachment #1: Type: text/plain, Size: 10081 bytes --]
Hi,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on mmotm/master]
[also build test ERROR on linus/master v5.5-rc6 next-20200110]
[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/buddy-zhang-aliyun-com/mm-cma-c-find-a-named-CMA-area-by-name/20200114-155334
base: git://git.cmpxchg.org/linux-mmotm.git master
config: i386-randconfig-a002-20200115 (attached as .config)
compiler: gcc-7 (Debian 7.5.0-3) 7.5.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
mm/cma.c:55:1: error: expected ';' before 'phys_addr_t'
phys_addr_t cma_get_base(const struct cma *cma)
^~~~~~~~~~~
mm/cma.c: In function 'cma_alloc':
mm/cma.c:449:9: error: implicit declaration of function 'cma_bitmap_aligned_mask'; did you mean 'cma_bitmap_maxno'? [-Werror=implicit-function-declaration]
mask = cma_bitmap_aligned_mask(cma, align);
^~~~~~~~~~~~~~~~~~~~~~~
cma_bitmap_maxno
mm/cma.c:450:11: error: implicit declaration of function 'cma_bitmap_aligned_offset'; did you mean 'cma_bitmap_maxno'? [-Werror=implicit-function-declaration]
offset = cma_bitmap_aligned_offset(cma, align);
^~~~~~~~~~~~~~~~~~~~~~~~~
cma_bitmap_maxno
mm/cma.c:452:17: error: implicit declaration of function 'cma_bitmap_pages_to_bits'; did you mean 'cma_bitmap_maxno'? [-Werror=implicit-function-declaration]
bitmap_count = cma_bitmap_pages_to_bits(cma, count);
^~~~~~~~~~~~~~~~~~~~~~~~
cma_bitmap_maxno
>> mm/cma.c:484:3: error: implicit declaration of function 'cma_clear_bitmap'; did you mean 'cr4_clear_bits'? [-Werror=implicit-function-declaration]
cma_clear_bitmap(cma, pfn, count);
^~~~~~~~~~~~~~~~
cr4_clear_bits
cc1: some warnings being treated as errors
vim +484 mm/cma.c
dbe43d4d2837da Jaewon Kim 2017-02-24 418
a254129e8686bf Joonsoo Kim 2014-08-06 419 /**
a254129e8686bf Joonsoo Kim 2014-08-06 420 * cma_alloc() - allocate pages from contiguous area
a254129e8686bf Joonsoo Kim 2014-08-06 421 * @cma: Contiguous memory region for which the allocation is performed.
a254129e8686bf Joonsoo Kim 2014-08-06 422 * @count: Requested number of pages.
a254129e8686bf Joonsoo Kim 2014-08-06 423 * @align: Requested alignment of pages (in PAGE_SIZE order).
6518202970c105 Marek Szyprowski 2018-08-17 424 * @no_warn: Avoid printing message about failed allocation
a254129e8686bf Joonsoo Kim 2014-08-06 425 *
a254129e8686bf Joonsoo Kim 2014-08-06 426 * This function allocates part of contiguous memory on specific
a254129e8686bf Joonsoo Kim 2014-08-06 427 * contiguous memory area.
a254129e8686bf Joonsoo Kim 2014-08-06 428 */
e2f466e32f56c8 Lucas Stach 2017-02-24 429 struct page *cma_alloc(struct cma *cma, size_t count, unsigned int align,
6518202970c105 Marek Szyprowski 2018-08-17 430 bool no_warn)
a254129e8686bf Joonsoo Kim 2014-08-06 431 {
3acaea6804b3a1 Andrew Morton 2015-11-05 432 unsigned long mask, offset;
3acaea6804b3a1 Andrew Morton 2015-11-05 433 unsigned long pfn = -1;
3acaea6804b3a1 Andrew Morton 2015-11-05 434 unsigned long start = 0;
a254129e8686bf Joonsoo Kim 2014-08-06 435 unsigned long bitmap_maxno, bitmap_no, bitmap_count;
2813b9c0296259 Andrey Konovalov 2018-12-28 436 size_t i;
a254129e8686bf Joonsoo Kim 2014-08-06 437 struct page *page = NULL;
dbe43d4d2837da Jaewon Kim 2017-02-24 438 int ret = -ENOMEM;
a254129e8686bf Joonsoo Kim 2014-08-06 439
a254129e8686bf Joonsoo Kim 2014-08-06 440 if (!cma || !cma->count)
a254129e8686bf Joonsoo Kim 2014-08-06 441 return NULL;
a254129e8686bf Joonsoo Kim 2014-08-06 442
67a2e213e7e937 Rohit Vaswani 2015-10-22 443 pr_debug("%s(cma %p, count %zu, align %d)\n", __func__, (void *)cma,
a254129e8686bf Joonsoo Kim 2014-08-06 444 count, align);
a254129e8686bf Joonsoo Kim 2014-08-06 445
a254129e8686bf Joonsoo Kim 2014-08-06 446 if (!count)
a254129e8686bf Joonsoo Kim 2014-08-06 447 return NULL;
a254129e8686bf Joonsoo Kim 2014-08-06 448
a254129e8686bf Joonsoo Kim 2014-08-06 449 mask = cma_bitmap_aligned_mask(cma, align);
b5be83e308f70e Gregory Fong 2014-12-12 @450 offset = cma_bitmap_aligned_offset(cma, align);
a254129e8686bf Joonsoo Kim 2014-08-06 451 bitmap_maxno = cma_bitmap_maxno(cma);
a254129e8686bf Joonsoo Kim 2014-08-06 452 bitmap_count = cma_bitmap_pages_to_bits(cma, count);
a254129e8686bf Joonsoo Kim 2014-08-06 453
6b36ba599d602d Shiraz Hashim 2016-11-10 454 if (bitmap_count > bitmap_maxno)
6b36ba599d602d Shiraz Hashim 2016-11-10 455 return NULL;
6b36ba599d602d Shiraz Hashim 2016-11-10 456
a254129e8686bf Joonsoo Kim 2014-08-06 457 for (;;) {
a254129e8686bf Joonsoo Kim 2014-08-06 458 mutex_lock(&cma->lock);
b5be83e308f70e Gregory Fong 2014-12-12 459 bitmap_no = bitmap_find_next_zero_area_off(cma->bitmap,
b5be83e308f70e Gregory Fong 2014-12-12 460 bitmap_maxno, start, bitmap_count, mask,
b5be83e308f70e Gregory Fong 2014-12-12 461 offset);
a254129e8686bf Joonsoo Kim 2014-08-06 462 if (bitmap_no >= bitmap_maxno) {
a254129e8686bf Joonsoo Kim 2014-08-06 463 mutex_unlock(&cma->lock);
a254129e8686bf Joonsoo Kim 2014-08-06 464 break;
a254129e8686bf Joonsoo Kim 2014-08-06 465 }
a254129e8686bf Joonsoo Kim 2014-08-06 466 bitmap_set(cma->bitmap, bitmap_no, bitmap_count);
a254129e8686bf Joonsoo Kim 2014-08-06 467 /*
a254129e8686bf Joonsoo Kim 2014-08-06 468 * It's safe to drop the lock here. We've marked this region for
a254129e8686bf Joonsoo Kim 2014-08-06 469 * our exclusive use. If the migration fails we will take the
a254129e8686bf Joonsoo Kim 2014-08-06 470 * lock again and unmark it.
a254129e8686bf Joonsoo Kim 2014-08-06 471 */
a254129e8686bf Joonsoo Kim 2014-08-06 472 mutex_unlock(&cma->lock);
a254129e8686bf Joonsoo Kim 2014-08-06 473
a254129e8686bf Joonsoo Kim 2014-08-06 474 pfn = cma->base_pfn + (bitmap_no << cma->order_per_bit);
a254129e8686bf Joonsoo Kim 2014-08-06 475 mutex_lock(&cma_mutex);
ca96b625341027 Lucas Stach 2017-02-24 476 ret = alloc_contig_range(pfn, pfn + count, MIGRATE_CMA,
6518202970c105 Marek Szyprowski 2018-08-17 477 GFP_KERNEL | (no_warn ? __GFP_NOWARN : 0));
a254129e8686bf Joonsoo Kim 2014-08-06 478 mutex_unlock(&cma_mutex);
a254129e8686bf Joonsoo Kim 2014-08-06 479 if (ret == 0) {
a254129e8686bf Joonsoo Kim 2014-08-06 480 page = pfn_to_page(pfn);
a254129e8686bf Joonsoo Kim 2014-08-06 481 break;
a254129e8686bf Joonsoo Kim 2014-08-06 482 }
b7155e76a702d9 Joonsoo Kim 2014-08-06 483
a254129e8686bf Joonsoo Kim 2014-08-06 @484 cma_clear_bitmap(cma, pfn, count);
b7155e76a702d9 Joonsoo Kim 2014-08-06 485 if (ret != -EBUSY)
b7155e76a702d9 Joonsoo Kim 2014-08-06 486 break;
b7155e76a702d9 Joonsoo Kim 2014-08-06 487
a254129e8686bf Joonsoo Kim 2014-08-06 488 pr_debug("%s(): memory range at %p is busy, retrying\n",
a254129e8686bf Joonsoo Kim 2014-08-06 489 __func__, pfn_to_page(pfn));
a254129e8686bf Joonsoo Kim 2014-08-06 490 /* try again with a bit different memory target */
a254129e8686bf Joonsoo Kim 2014-08-06 491 start = bitmap_no + mask + 1;
a254129e8686bf Joonsoo Kim 2014-08-06 492 }
a254129e8686bf Joonsoo Kim 2014-08-06 493
3acaea6804b3a1 Andrew Morton 2015-11-05 494 trace_cma_alloc(pfn, page, count, align);
99e8ea6cd2210c Stefan Strogin 2015-04-15 495
2813b9c0296259 Andrey Konovalov 2018-12-28 496 /*
2813b9c0296259 Andrey Konovalov 2018-12-28 497 * CMA can allocate multiple page blocks, which results in different
2813b9c0296259 Andrey Konovalov 2018-12-28 498 * blocks being marked with different tags. Reset the tags to ignore
2813b9c0296259 Andrey Konovalov 2018-12-28 499 * those page blocks.
2813b9c0296259 Andrey Konovalov 2018-12-28 500 */
2813b9c0296259 Andrey Konovalov 2018-12-28 501 if (page) {
2813b9c0296259 Andrey Konovalov 2018-12-28 502 for (i = 0; i < count; i++)
2813b9c0296259 Andrey Konovalov 2018-12-28 503 page_kasan_tag_reset(page + i);
2813b9c0296259 Andrey Konovalov 2018-12-28 504 }
2813b9c0296259 Andrey Konovalov 2018-12-28 505
6518202970c105 Marek Szyprowski 2018-08-17 506 if (ret && !no_warn) {
5984af1082f3b1 Pintu Agarwal 2017-11-15 507 pr_err("%s: alloc failed, req-size: %zu pages, ret: %d\n",
dbe43d4d2837da Jaewon Kim 2017-02-24 508 __func__, count, ret);
dbe43d4d2837da Jaewon Kim 2017-02-24 509 cma_debug_show_areas(cma);
dbe43d4d2837da Jaewon Kim 2017-02-24 510 }
dbe43d4d2837da Jaewon Kim 2017-02-24 511
a254129e8686bf Joonsoo Kim 2014-08-06 512 pr_debug("%s(): returned %p\n", __func__, page);
a254129e8686bf Joonsoo Kim 2014-08-06 513 return page;
a254129e8686bf Joonsoo Kim 2014-08-06 514 }
a254129e8686bf Joonsoo Kim 2014-08-06 515
:::::: The code at line 484 was first introduced by commit
:::::: a254129e8686bff7a340b58f35241b04927e81c0 CMA: generalize CMA reserved area management functionality
:::::: TO: Joonsoo Kim <iamjoonsoo.kim@lge.com>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 37413 bytes --]
next prev parent reply other threads:[~2020-01-16 4:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20200114075147.30672-1-buddy.zhang@aliyun.com>
2020-01-14 9:02 ` [PATCH] mm/cma.c: find a named CMA area by name David Hildenbrand
2020-01-16 4:21 ` kbuild test robot [this message]
2020-01-17 4:17 ` kbuild test robot
[not found] <20200116101322.17795-1-buddy.zhang@aliyun.com>
2020-01-16 12:12 ` Michal Hocko
[not found] ` <6EE060CC-A19D-4F9D-BE36-14CB20C44AE2@aliyun.com>
2020-01-17 6:28 ` Michal Hocko
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=202001161259.EgPfyQMU%lkp@intel.com \
--to=lkp@intel.com \
--cc=akpm@linux-foundation.org \
--cc=buddy.zhang@aliyun.com \
--cc=kbuild-all@lists.01.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).