2020-08-08 11:45:55

by kernel test robot

[permalink] [raw]
Subject: drivers/virtio/virtio_mem.c:1031 virtio_mem_mb_plug_any_sb() error: uninitialized symbol 'rc'.

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 449dc8c97089a6e09fb2dac4d92b1b7ac0eb7c1e
commit: 5f1f79bbc9e26fa9412fa9522f957bb8f030c442 virtio-mem: Paravirtualized memory hotplug
date: 9 weeks ago
config: x86_64-randconfig-m001-20200808 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

New smatch warnings:
drivers/virtio/virtio_mem.c:1031 virtio_mem_mb_plug_any_sb() error: uninitialized symbol 'rc'.
drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dce_calcs.c:1607 calculate_bandwidth() warn: Function too hairy. No more merges.

Old smatch warnings:
drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dce_calcs.c:3387 bw_calcs() warn: inconsistent indenting

vim +/rc +1031 drivers/virtio/virtio_mem.c

978
979 /*
980 * Try to plug the desired number of subblocks of a memory block that
981 * is already added to Linux.
982 *
983 * Will modify the state of the memory block.
984 *
985 * Note: Can fail after some subblocks were successfully plugged.
986 */
987 static int virtio_mem_mb_plug_any_sb(struct virtio_mem *vm, unsigned long mb_id,
988 uint64_t *nb_sb, bool online)
989 {
990 unsigned long pfn, nr_pages;
991 int sb_id, count;
992 int rc;
993
994 if (WARN_ON_ONCE(!*nb_sb))
995 return -EINVAL;
996
997 while (*nb_sb) {
998 sb_id = virtio_mem_mb_first_unplugged_sb(vm, mb_id);
999 if (sb_id >= vm->nb_sb_per_mb)
1000 break;
1001 count = 1;
1002 while (count < *nb_sb &&
1003 sb_id + count < vm->nb_sb_per_mb &&
1004 !virtio_mem_mb_test_sb_plugged(vm, mb_id, sb_id + count,
1005 1))
1006 count++;
1007
1008 rc = virtio_mem_mb_plug_sb(vm, mb_id, sb_id, count);
1009 if (rc)
1010 return rc;
1011 *nb_sb -= count;
1012 if (!online)
1013 continue;
1014
1015 /* fake-online the pages if the memory block is online */
1016 pfn = PFN_DOWN(virtio_mem_mb_id_to_phys(mb_id) +
1017 sb_id * vm->subblock_size);
1018 nr_pages = PFN_DOWN(count * vm->subblock_size);
1019 virtio_mem_fake_online(pfn, nr_pages);
1020 }
1021
1022 if (virtio_mem_mb_test_sb_plugged(vm, mb_id, 0, vm->nb_sb_per_mb)) {
1023 if (online)
1024 virtio_mem_mb_set_state(vm, mb_id,
1025 VIRTIO_MEM_MB_STATE_ONLINE);
1026 else
1027 virtio_mem_mb_set_state(vm, mb_id,
1028 VIRTIO_MEM_MB_STATE_OFFLINE);
1029 }
1030
> 1031 return rc;
1032 }
1033

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]


Attachments:
(No filename) (2.77 kB)
.config.gz (48.42 kB)
Download all attachments

2020-08-08 12:45:42

by David Hildenbrand

[permalink] [raw]
Subject: Re: drivers/virtio/virtio_mem.c:1031 virtio_mem_mb_plug_any_sb() error: uninitialized symbol 'rc'.



> Am 08.08.2020 um 13:39 schrieb kernel test robot <[email protected]>:
>
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: 449dc8c97089a6e09fb2dac4d92b1b7ac0eb7c1e
> commit: 5f1f79bbc9e26fa9412fa9522f957bb8f030c442 virtio-mem: Paravirtualized memory hotplug
> date: 9 weeks ago
> config: x86_64-randconfig-m001-20200808 (attached as .config)
> compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <[email protected]>
>

Was there a delay in sending these out? The fix by Dan is long upstream: 1c3d69ab5348

> New smatch warnings:
> drivers/virtio/virtio_mem.c:1031 virtio_mem_mb_plug_any_sb() error: uninitialized symbol 'rc'.
> drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dce_calcs.c:1607 calculate_bandwidth() warn: Function too hairy. No more merges.
>
> Old smatch warnings:
> drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dce_calcs.c:3387 bw_calcs() warn: inconsistent indenting
>
> vim +/rc +1031 drivers/virtio/virtio_mem.c
>
> 978
> 979 /*
> 980 * Try to plug the desired number of subblocks of a memory block that
> 981 * is already added to Linux.
> 982 *
> 983 * Will modify the state of the memory block.
> 984 *
> 985 * Note: Can fail after some subblocks were successfully plugged.
> 986 */
> 987 static int virtio_mem_mb_plug_any_sb(struct virtio_mem *vm, unsigned long mb_id,
> 988 uint64_t *nb_sb, bool online)
> 989 {
> 990 unsigned long pfn, nr_pages;
> 991 int sb_id, count;
> 992 int rc;
> 993
> 994 if (WARN_ON_ONCE(!*nb_sb))
> 995 return -EINVAL;
> 996
> 997 while (*nb_sb) {
> 998 sb_id = virtio_mem_mb_first_unplugged_sb(vm, mb_id);
> 999 if (sb_id >= vm->nb_sb_per_mb)
> 1000 break;
> 1001 count = 1;
> 1002 while (count < *nb_sb &&
> 1003 sb_id + count < vm->nb_sb_per_mb &&
> 1004 !virtio_mem_mb_test_sb_plugged(vm, mb_id, sb_id + count,
> 1005 1))
> 1006 count++;
> 1007
> 1008 rc = virtio_mem_mb_plug_sb(vm, mb_id, sb_id, count);
> 1009 if (rc)
> 1010 return rc;
> 1011 *nb_sb -= count;
> 1012 if (!online)
> 1013 continue;
> 1014
> 1015 /* fake-online the pages if the memory block is online */
> 1016 pfn = PFN_DOWN(virtio_mem_mb_id_to_phys(mb_id) +
> 1017 sb_id * vm->subblock_size);
> 1018 nr_pages = PFN_DOWN(count * vm->subblock_size);
> 1019 virtio_mem_fake_online(pfn, nr_pages);
> 1020 }
> 1021
> 1022 if (virtio_mem_mb_test_sb_plugged(vm, mb_id, 0, vm->nb_sb_per_mb)) {
> 1023 if (online)
> 1024 virtio_mem_mb_set_state(vm, mb_id,
> 1025 VIRTIO_MEM_MB_STATE_ONLINE);
> 1026 else
> 1027 virtio_mem_mb_set_state(vm, mb_id,
> 1028 VIRTIO_MEM_MB_STATE_OFFLINE);
> 1029 }
> 1030
>> 1031 return rc;
> 1032 }
> 1033
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/[email protected]
> <.config.gz>

2020-08-10 02:26:54

by Chen, Rong A

[permalink] [raw]
Subject: Re: [kbuild-all] Re: drivers/virtio/virtio_mem.c:1031 virtio_mem_mb_plug_any_sb() error: uninitialized symbol 'rc'.



On 8/8/20 8:44 PM, David Hildenbrand wrote:
>
>> Am 08.08.2020 um 13:39 schrieb kernel test robot <[email protected]>:
>>
>> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>> head: 449dc8c97089a6e09fb2dac4d92b1b7ac0eb7c1e
>> commit: 5f1f79bbc9e26fa9412fa9522f957bb8f030c442 virtio-mem: Paravirtualized memory hotplug
>> date: 9 weeks ago
>> config: x86_64-randconfig-m001-20200808 (attached as .config)
>> compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
>>
>> If you fix the issue, kindly add following tag as appropriate
>> Reported-by: kernel test robot <[email protected]>
>>
> Was there a delay in sending these out? The fix by Dan is long upstream: 1c3d69ab5348
Hi David,

Sorry for the inconvenience, the bot will check head commit before
reporting usually, we'll take a look.

Best Regards,
Rong Chen

>
>> New smatch warnings:
>> drivers/virtio/virtio_mem.c:1031 virtio_mem_mb_plug_any_sb() error: uninitialized symbol 'rc'.
>> drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dce_calcs.c:1607 calculate_bandwidth() warn: Function too hairy. No more merges.
>>
>> Old smatch warnings:
>> drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dce_calcs.c:3387 bw_calcs() warn: inconsistent indenting
>>
>> vim +/rc +1031 drivers/virtio/virtio_mem.c
>>
>> 978
>> 979 /*
>> 980 * Try to plug the desired number of subblocks of a memory block that
>> 981 * is already added to Linux.
>> 982 *
>> 983 * Will modify the state of the memory block.
>> 984 *
>> 985 * Note: Can fail after some subblocks were successfully plugged.
>> 986 */
>> 987 static int virtio_mem_mb_plug_any_sb(struct virtio_mem *vm, unsigned long mb_id,
>> 988 uint64_t *nb_sb, bool online)
>> 989 {
>> 990 unsigned long pfn, nr_pages;
>> 991 int sb_id, count;
>> 992 int rc;
>> 993
>> 994 if (WARN_ON_ONCE(!*nb_sb))
>> 995 return -EINVAL;
>> 996
>> 997 while (*nb_sb) {
>> 998 sb_id = virtio_mem_mb_first_unplugged_sb(vm, mb_id);
>> 999 if (sb_id >= vm->nb_sb_per_mb)
>> 1000 break;
>> 1001 count = 1;
>> 1002 while (count < *nb_sb &&
>> 1003 sb_id + count < vm->nb_sb_per_mb &&
>> 1004 !virtio_mem_mb_test_sb_plugged(vm, mb_id, sb_id + count,
>> 1005 1))
>> 1006 count++;
>> 1007
>> 1008 rc = virtio_mem_mb_plug_sb(vm, mb_id, sb_id, count);
>> 1009 if (rc)
>> 1010 return rc;
>> 1011 *nb_sb -= count;
>> 1012 if (!online)
>> 1013 continue;
>> 1014
>> 1015 /* fake-online the pages if the memory block is online */
>> 1016 pfn = PFN_DOWN(virtio_mem_mb_id_to_phys(mb_id) +
>> 1017 sb_id * vm->subblock_size);
>> 1018 nr_pages = PFN_DOWN(count * vm->subblock_size);
>> 1019 virtio_mem_fake_online(pfn, nr_pages);
>> 1020 }
>> 1021
>> 1022 if (virtio_mem_mb_test_sb_plugged(vm, mb_id, 0, vm->nb_sb_per_mb)) {
>> 1023 if (online)
>> 1024 virtio_mem_mb_set_state(vm, mb_id,
>> 1025 VIRTIO_MEM_MB_STATE_ONLINE);
>> 1026 else
>> 1027 virtio_mem_mb_set_state(vm, mb_id,
>> 1028 VIRTIO_MEM_MB_STATE_OFFLINE);
>> 1029 }
>> 1030
>>> 1031 return rc;
>> 1032 }
>> 1033
>>
>> ---
>> 0-DAY CI Kernel Test Service, Intel Corporation
>> https://lists.01.org/hyperkitty/list/[email protected]
>> <.config.gz>
> _______________________________________________
> kbuild-all mailing list -- [email protected]
> To unsubscribe send an email to [email protected]

2020-08-10 07:57:18

by David Hildenbrand

[permalink] [raw]
Subject: Re: [kbuild-all] Re: drivers/virtio/virtio_mem.c:1031 virtio_mem_mb_plug_any_sb() error: uninitialized symbol 'rc'.

On 10.08.20 04:24, Rong Chen wrote:
>
>
> On 8/8/20 8:44 PM, David Hildenbrand wrote:
>>
>>> Am 08.08.2020 um 13:39 schrieb kernel test robot <[email protected]>:
>>>
>>> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>>> head: 449dc8c97089a6e09fb2dac4d92b1b7ac0eb7c1e
>>> commit: 5f1f79bbc9e26fa9412fa9522f957bb8f030c442 virtio-mem: Paravirtualized memory hotplug
>>> date: 9 weeks ago
>>> config: x86_64-randconfig-m001-20200808 (attached as .config)
>>> compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
>>>
>>> If you fix the issue, kindly add following tag as appropriate
>>> Reported-by: kernel test robot <[email protected]>
>>>
>> Was there a delay in sending these out? The fix by Dan is long upstream: 1c3d69ab5348
> Hi David,

Hi Rong,

it also says "date: 9 weeks ago", which sounded kind of late for
"0-DAY CI" long after a kernel release, that's why I was wondering :)

--
Thanks,

David / dhildenb