Re: [PATCH 3/3] virtio_balloon: Introduce memory recover

From: kernel test robot
Date: Fri May 20 2022 - 08:48:57 EST


Hi zhenwei,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on akpm-mm/mm-everything]
[also build test WARNING on next-20220519]
[cannot apply to linux/master linus/master v5.18-rc7]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/intel-lab-lkp/linux/commits/zhenwei-pi/recover-hardware-corrupted-page-by-virtio-balloon/20220520-151328
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
config: hexagon-randconfig-r041-20220519 (https://download.01.org/0day-ci/archive/20220520/202205202014.mgqgBrKd-lkp@xxxxxxxxx/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project e00cbbec06c08dc616a0d52a20f678b8fbd4e304)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/a42127073dd4adb6354649c8235c5cde033d01f2
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review zhenwei-pi/recover-hardware-corrupted-page-by-virtio-balloon/20220520-151328
git checkout a42127073dd4adb6354649c8235c5cde033d01f2
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/virtio/

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

All warnings (new ones prefixed by >>):

>> drivers/virtio/virtio_balloon.c:654:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
default:
^
drivers/virtio/virtio_balloon.c:654:2: note: insert 'break;' to avoid fall-through
default:
^
break;
1 warning generated.


vim +654 drivers/virtio/virtio_balloon.c

593
594 static void recover_vq_handle_response(struct virtio_balloon *vb, unsigned int len)
595 {
596 struct __virtio_balloon_recover *in_vbr;
597 struct virtio_balloon_recover *vbr;
598 struct page *page;
599 unsigned int pfns;
600 u32 pfn0, pfn1;
601 __u8 status;
602
603 /* the response is not expected */
604 if (unlikely(len != sizeof(struct __virtio_balloon_recover)))
605 return;
606
607 in_vbr = &vb->in_vbr;
608 vbr = &in_vbr->vbr;
609 if (unlikely(vbr->cmd != VIRTIO_BALLOON_R_CMD_RESPONSE))
610 return;
611
612 /* to make sure the contiguous balloon PFNs */
613 for (pfns = 1; pfns < VIRTIO_BALLOON_PAGES_PER_PAGE; pfns++) {
614 pfn0 = virtio32_to_cpu(vb->vdev, in_vbr->pfns[pfns - 1]);
615 pfn1 = virtio32_to_cpu(vb->vdev, in_vbr->pfns[pfns]);
616 if (pfn1 - pfn0 != 1)
617 return;
618 }
619
620 pfn0 = virtio32_to_cpu(vb->vdev, in_vbr->pfns[0]);
621 if (!pfn_valid(pfn0))
622 return;
623
624 pfn1 = -1;
625 spin_lock(&vb->recover_page_list_lock);
626 list_for_each_entry(page, &vb->corrupted_page_list, lru) {
627 pfn1 = page_to_pfn(page);
628 if (pfn1 == pfn0)
629 break;
630 }
631 spin_unlock(&vb->recover_page_list_lock);
632
633 status = vbr->status;
634 switch (status) {
635 case VIRTIO_BALLOON_R_STATUS_RECOVERED:
636 if (pfn1 == pfn0) {
637 spin_lock(&vb->recover_page_list_lock);
638 list_del(&page->lru);
639 balloon_page_push(&vb->recovered_page_list, page);
640 spin_unlock(&vb->recover_page_list_lock);
641 queue_work(system_freezable_wq, &vb->unpoison_memory_work);
642 dev_info_ratelimited(&vb->vdev->dev, "recovered pfn 0x%x", pfn0);
643 }
644 break;
645 case VIRTIO_BALLOON_R_STATUS_FAILED:
646 /* the hypervisor can't fix this corrupted page, balloon puts page */
647 if (pfn1 == pfn0) {
648 spin_lock(&vb->recover_page_list_lock);
649 list_del(&page->lru);
650 spin_unlock(&vb->recover_page_list_lock);
651 put_page(page);
652 dev_info_ratelimited(&vb->vdev->dev, "failed to recover pfn 0x%x", pfn0);
653 }
> 654 default:
655 break;
656 };
657
658 /* continue to get response from host side if the response gets handled successfully */
659 recover_vq_get_response(vb);
660 }
661

--
0-DAY CI Kernel Test Service
https://01.org/lkp