Re: [syzbot] [virtualization?] linux-next boot error: WARNING: refcount bug in __free_pages_ok

2024-02-21 Thread Lei Yang
Hi All

I hit a similar issue when doing a regression testing from my side.
For the error messages please help review the attachment.

The latest commit:
commit c02197fc9076e7d991c8f6adc11759c5ba52ddc6 (HEAD -> master,
origin/master, origin/HEAD)
Merge: f2667e0c3240 0846dd77c834
Author: Linus Torvalds 
Date:   Sat Feb 17 16:59:31 2024 -0800

Merge tag 'powerpc-6.8-3' of
git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux

Pull powerpc fixes from Michael Ellerman:
 "This is a bit of a big batch for rc4, but just due to holiday hangover
  and because I didn't send any fixes last week due to a late revert
  request. I think next week should be back to normal.

Regards
Lei

On Mon, Feb 19, 2024 at 3:35 PM Michael S. Tsirkin  wrote:
>
> On Sun, Feb 18, 2024 at 09:06:18PM -0800, syzbot wrote:
> > Hello,
> >
> > syzbot found the following issue on:
> >
> > HEAD commit:d37e1e4c52bc Add linux-next specific files for 20240216
> > git tree:   linux-next
> > console output: https://syzkaller.appspot.com/x/log.txt?x=171ca65218
> > kernel config:  https://syzkaller.appspot.com/x/.config?x=4bc446d42a7d56c0
> > dashboard link: https://syzkaller.appspot.com/bug?extid=6f3c38e8a6a0297caa5a
> > compiler:   Debian clang version 15.0.6, GNU ld (GNU Binutils for 
> > Debian) 2.40
> >
> > Downloadable assets:
> > disk image: 
> > https://storage.googleapis.com/syzbot-assets/14d0894504b9/disk-d37e1e4c.raw.xz
> > vmlinux: 
> > https://storage.googleapis.com/syzbot-assets/6cda61e084ee/vmlinux-d37e1e4c.xz
> > kernel image: 
> > https://storage.googleapis.com/syzbot-assets/720c85283c05/bzImage-d37e1e4c.xz
> >
> > IMPORTANT: if you fix the issue, please add the following tag to the commit:
> > Reported-by: syzbot+6f3c38e8a6a0297ca...@syzkaller.appspotmail.com
> >
> > Key type pkcs7_test registered
> > Block layer SCSI generic (bsg) driver version 0.4 loaded (major 239)
> > io scheduler mq-deadline registered
> > io scheduler kyber registered
> > io scheduler bfq registered
> > input: Power Button as /devices/LNXSYSTM:00/LNXPWRBN:00/input/input0
> > ACPI: button: Power Button [PWRF]
> > input: Sleep Button as /devices/LNXSYSTM:00/LNXSLPBN:00/input/input1
> > ACPI: button: Sleep Button [SLPF]
> > ioatdma: Intel(R) QuickData Technology Driver 5.00
> > ACPI: \_SB_.LNKC: Enabled at IRQ 11
> > virtio-pci :00:03.0: virtio_pci: leaving for legacy driver
> > ACPI: \_SB_.LNKD: Enabled at IRQ 10
> > virtio-pci :00:04.0: virtio_pci: leaving for legacy driver
> > ACPI: \_SB_.LNKB: Enabled at IRQ 10
> > virtio-pci :00:06.0: virtio_pci: leaving for legacy driver
> > virtio-pci :00:07.0: virtio_pci: leaving for legacy driver
> > N_HDLC line discipline registered with maxframe=4096
> > Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
> > 00:03: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
> > 00:04: ttyS1 at I/O 0x2f8 (irq = 3, base_baud = 115200) is a 16550A
> > 00:05: ttyS2 at I/O 0x3e8 (irq = 6, base_baud = 115200) is a 16550A
> > 00:06: ttyS3 at I/O 0x2e8 (irq = 7, base_baud = 115200) is a 16550A
> > Non-volatile memory driver v1.3
> > Linux agpgart interface v0.103
> > ACPI: bus type drm_connector registered
> > [drm] Initialized vgem 1.0.0 20120112 for vgem on minor 0
> > [drm] Initialized vkms 1.0.0 20180514 for vkms on minor 1
> > Console: switching to colour frame buffer device 128x48
> > platform vkms: [drm] fb0: vkmsdrmfb frame buffer device
> > usbcore: registered new interface driver udl
> > brd: module loaded
> > loop: module loaded
> > zram: Added device: zram0
> > null_blk: disk nullb0 created
> > null_blk: module loaded
> > Guest personality initialized and is inactive
> > VMCI host device registered (name=vmci, major=10, minor=118)
> > Initialized host personality
> > usbcore: registered new interface driver rtsx_usb
> > usbcore: registered new interface driver viperboard
> > usbcore: registered new interface driver dln2
> > usbcore: registered new interface driver pn533_usb
> > nfcsim 0.2 initialized
> > usbcore: registered new interface driver port100
> > usbcore: registered new interface driver nfcmrvl
> > Loading iSCSI transport class v2.0-870.
> > virtio_scsi virtio0: 1/0/0 default/read/poll queues
> > [ cut here ]
> > refcount_t: decrement hit 0; leaking memory.
> > WARNING: CPU: 0 PID: 1 at lib/refcount.c:31 
> > refcount_warn_saturate+0xfa/0x1d0 lib/refcount.c:31
> > Modules linked in:
> > CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.8.0-rc4-next-20240216-syzkaller 
> > #0
> > Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS 
> > Google 01/25/2024
> > RIP: 0010:refcount_warn_saturate+0xfa/0x1d0 lib/refcount.c:31
> > Code: b2 00 00 00 e8 b7 94 f0 fc 5b 5d c3 cc cc cc cc e8 ab 94 f0 fc c6 05 
> > c6 16 ce 0a 01 90 48 c7 c7 a0 5a fe 8b e8 67 69 b4 fc 90 <0f> 0b 90 90 eb 
> > d9 e8 8b 94 f0 fc c6 05 a3 16 ce 0a 01 90 48 c7 c7
> > RSP: :c9066e10 EFLAGS: 00010246
> > RAX: 15c2c224c9b50400 RBX: 

Re: [PATCH v2] vdpa/mlx5: Allow CVQ size changes

2024-02-18 Thread Lei Yang
QE tested this patch's V2, qemu no longer print error messages
"qemu-system-x86_64: Insufficient written data (0)" after
enable/disable multi queues multi times inside guest. Both "x-svq=on
'' and without it are all test pass.

Tested-by: Lei Yang 

On Fri, Feb 16, 2024 at 10:25 PM Jonah Palmer  wrote:
>
> The MLX driver was not updating its control virtqueue size at set_vq_num
> and instead always initialized to MLX5_CVQ_MAX_ENT (16) at
> setup_cvq_vring.
>
> Qemu would try to set the size to 64 by default, however, because the
> CVQ size always was initialized to 16, an error would be thrown when
> sending >16 control messages (as used-ring entry 17 is initialized to 0).
> For example, starting a guest with x-svq=on and then executing the
> following command would produce the error below:
>
>  # for i in {1..20}; do ifconfig eth0 hw ether XX:xx:XX:xx:XX:XX; done
>
>  qemu-system-x86_64: Insufficient written data (0)
>  [  435.331223] virtio_net virtio0: Failed to set mac address by vq command.
>  SIOCSIFHWADDR: Invalid argument
>
> Acked-by: Dragos Tatulea 
> Acked-by: Eugenio Pérez 
> Signed-off-by: Jonah Palmer 
> ---
>  drivers/vdpa/mlx5/net/mlx5_vnet.c | 13 +
>  1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c 
> b/drivers/vdpa/mlx5/net/mlx5_vnet.c
> index 778821bab7d9..ecfc16151d61 100644
> --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c
> +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c
> @@ -151,8 +151,6 @@ static void teardown_driver(struct mlx5_vdpa_net *ndev);
>
>  static bool mlx5_vdpa_debug;
>
> -#define MLX5_CVQ_MAX_ENT 16
> -
>  #define MLX5_LOG_VIO_FLAG(_feature)  
>   \
> do {  
>  \
> if (features & BIT_ULL(_feature)) 
>  \
> @@ -2276,9 +2274,16 @@ static void mlx5_vdpa_set_vq_num(struct vdpa_device 
> *vdev, u16 idx, u32 num)
> struct mlx5_vdpa_net *ndev = to_mlx5_vdpa_ndev(mvdev);
> struct mlx5_vdpa_virtqueue *mvq;
>
> -   if (!is_index_valid(mvdev, idx) || is_ctrl_vq_idx(mvdev, idx))
> +   if (!is_index_valid(mvdev, idx))
> return;
>
> +if (is_ctrl_vq_idx(mvdev, idx)) {
> +struct mlx5_control_vq *cvq = >cvq;
> +
> +cvq->vring.vring.num = num;
> +return;
> +}
> +
> mvq = >vqs[idx];
> mvq->num_ent = num;
>  }
> @@ -2963,7 +2968,7 @@ static int setup_cvq_vring(struct mlx5_vdpa_dev *mvdev)
> u16 idx = cvq->vring.last_avail_idx;
>
> err = vringh_init_iotlb(>vring, mvdev->actual_features,
> -   MLX5_CVQ_MAX_ENT, false,
> +   cvq->vring.vring.num, false,
> (struct vring_desc 
> *)(uintptr_t)cvq->desc_addr,
> (struct vring_avail 
> *)(uintptr_t)cvq->driver_addr,
> (struct vring_used 
> *)(uintptr_t)cvq->device_addr);
> --
> 2.39.3
>




[PATCH v2] sysctl: kselftests: fix test_modprobe issue

2018-09-06 Thread Lei Yang
when CONFIG_TEST_SYSCTL=y, there is no "/sys/module/test_sysctl/"
when CONFIG_TEST_SYSCTL=m, checking /sys/module/test_sysctl/ is
before kernel module loading

you'll get below error message
root@intel-x86-64:/tmp/sysctl# ./sysctl.sh
Checking production write strict setting ... ok
./sysctl.sh: /sys/module/test_sysctl/ not present
You must have the following enabled in your kernel:

This patch will fix this issue.
when CONFIG_TEST_SYSCTL=y, it has no chance to check "/sys/module/test_sysctl/"
when CONFIG_TEST_SYSCTL=m, it will load kernel module first before checking sys
interface.

Signed-off-by: Lei Yang 
---
 tools/testing/selftests/sysctl/sysctl.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/sysctl/sysctl.sh 
b/tools/testing/selftests/sysctl/sysctl.sh
index 584eb8e..08dc995 100755
--- a/tools/testing/selftests/sysctl/sysctl.sh
+++ b/tools/testing/selftests/sysctl/sysctl.sh
@@ -120,6 +120,7 @@ test_reqs()
 
 function load_req_mod()
 {
+trap "test_modprobe" EXIT
if [ ! -d $DIR ]; then
if ! modprobe -q -n $TEST_DRIVER; then
echo "$0: module $TEST_DRIVER not found [SKIP]"
@@ -770,7 +771,6 @@ function parse_args()
 test_reqs
 allow_user_defaults
 check_production_sysctl_writes_strict
-test_modprobe
 load_req_mod
 
 trap "test_finish" EXIT
-- 
1.9.1



[PATCH v2] sysctl: kselftests: fix test_modprobe issue

2018-09-06 Thread Lei Yang
when CONFIG_TEST_SYSCTL=y, there is no "/sys/module/test_sysctl/"
when CONFIG_TEST_SYSCTL=m, checking /sys/module/test_sysctl/ is
before kernel module loading

you'll get below error message
root@intel-x86-64:/tmp/sysctl# ./sysctl.sh
Checking production write strict setting ... ok
./sysctl.sh: /sys/module/test_sysctl/ not present
You must have the following enabled in your kernel:

This patch will fix this issue.
when CONFIG_TEST_SYSCTL=y, it has no chance to check "/sys/module/test_sysctl/"
when CONFIG_TEST_SYSCTL=m, it will load kernel module first before checking sys
interface.

Signed-off-by: Lei Yang 
---
 tools/testing/selftests/sysctl/sysctl.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/sysctl/sysctl.sh 
b/tools/testing/selftests/sysctl/sysctl.sh
index 584eb8e..08dc995 100755
--- a/tools/testing/selftests/sysctl/sysctl.sh
+++ b/tools/testing/selftests/sysctl/sysctl.sh
@@ -120,6 +120,7 @@ test_reqs()
 
 function load_req_mod()
 {
+trap "test_modprobe" EXIT
if [ ! -d $DIR ]; then
if ! modprobe -q -n $TEST_DRIVER; then
echo "$0: module $TEST_DRIVER not found [SKIP]"
@@ -770,7 +771,6 @@ function parse_args()
 test_reqs
 allow_user_defaults
 check_production_sysctl_writes_strict
-test_modprobe
 load_req_mod
 
 trap "test_finish" EXIT
-- 
1.9.1



Re: [PATCH] sysctl: kselftests: use kernel module instead of built-in

2018-09-05 Thread lei yang




On 2018年09月06日 00:47, Shuah Khan wrote:

On 09/04/2018 08:20 PM, Lei Yang wrote:

It uses modprobe $TEST_DRIVER in sysctl.sh, so update
config to use "m" instead

Signed-off-by: Lei Yang 
---
  tools/testing/selftests/sysctl/config | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/sysctl/config 
b/tools/testing/selftests/sysctl/config
index 6ca1480..fc263ef 100644
--- a/tools/testing/selftests/sysctl/config
+++ b/tools/testing/selftests/sysctl/config
@@ -1 +1 @@
-CONFIG_TEST_SYSCTL=y
+CONFIG_TEST_SYSCTL=m


What happens if it is a built-in? Can you elaborate in the changelog

On that note we might have other cases that do modprobe in scripts and
run into the same issue you are trying to solve. :)


I double-checked again, found that it doesn't work on either with 
built-in or kernel module
if it's built-in, modprobe test_sysctl still return 0, so it doesn't 
matter it's a built-in or module.


but the problem is that test_modprobe check module load before modprobe 
execute , I'll sent a V2 patch to fix this and keep its build-in config 
untouched



if changes nothing

1) when  CONFIG_TEST_SYSCTL=y
root@intel-x86-64:/tmp/sysctl# ./sysctl.sh
Checking production write strict setting ... ok
./sysctl.sh: /sys/module/test_sysctl/ not present
You must have the following enabled in your kernel:
CONFIG_TEST_SYSCTL=y
root@intel-x86-64:/tmp/sysctl# zcat /proc/config.gz |grep TEST_SYS
CONFIG_TEST_SYSCTL=y



2) when CONFIG_TEST_SYSCTL=m
root@intel-x86-64:/tmp/sysctl# ./sysctl.sh
Checking production write strict setting ... ok
./sysctl.sh: /sys/module/test_sysctl/ not present
You must have the following enabled in your kernel:
CONFIG_TEST_SYSCTL=y
root@intel-x86-64:/tmp/sysctl# zcat /proc/config.gz |grep TEST_SYS
CONFIG_TEST_SYSCTL=m


Lei


thanks,



-- Shuah




Re: [PATCH] sysctl: kselftests: use kernel module instead of built-in

2018-09-05 Thread lei yang




On 2018年09月06日 00:47, Shuah Khan wrote:

On 09/04/2018 08:20 PM, Lei Yang wrote:

It uses modprobe $TEST_DRIVER in sysctl.sh, so update
config to use "m" instead

Signed-off-by: Lei Yang 
---
  tools/testing/selftests/sysctl/config | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/sysctl/config 
b/tools/testing/selftests/sysctl/config
index 6ca1480..fc263ef 100644
--- a/tools/testing/selftests/sysctl/config
+++ b/tools/testing/selftests/sysctl/config
@@ -1 +1 @@
-CONFIG_TEST_SYSCTL=y
+CONFIG_TEST_SYSCTL=m


What happens if it is a built-in? Can you elaborate in the changelog

On that note we might have other cases that do modprobe in scripts and
run into the same issue you are trying to solve. :)


I double-checked again, found that it doesn't work on either with 
built-in or kernel module
if it's built-in, modprobe test_sysctl still return 0, so it doesn't 
matter it's a built-in or module.


but the problem is that test_modprobe check module load before modprobe 
execute , I'll sent a V2 patch to fix this and keep its build-in config 
untouched



if changes nothing

1) when  CONFIG_TEST_SYSCTL=y
root@intel-x86-64:/tmp/sysctl# ./sysctl.sh
Checking production write strict setting ... ok
./sysctl.sh: /sys/module/test_sysctl/ not present
You must have the following enabled in your kernel:
CONFIG_TEST_SYSCTL=y
root@intel-x86-64:/tmp/sysctl# zcat /proc/config.gz |grep TEST_SYS
CONFIG_TEST_SYSCTL=y



2) when CONFIG_TEST_SYSCTL=m
root@intel-x86-64:/tmp/sysctl# ./sysctl.sh
Checking production write strict setting ... ok
./sysctl.sh: /sys/module/test_sysctl/ not present
You must have the following enabled in your kernel:
CONFIG_TEST_SYSCTL=y
root@intel-x86-64:/tmp/sysctl# zcat /proc/config.gz |grep TEST_SYS
CONFIG_TEST_SYSCTL=m


Lei


thanks,



-- Shuah




[PATCH v2] cgroup: kselftests: add test_core to .gitignore

2018-09-05 Thread Lei Yang
Update .gitignore file.

Signed-off-by: Lei Yang 
---
 tools/testing/selftests/cgroup/.gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/cgroup/.gitignore 
b/tools/testing/selftests/cgroup/.gitignore
index 95eb3a5..adacda5 100644
--- a/tools/testing/selftests/cgroup/.gitignore
+++ b/tools/testing/selftests/cgroup/.gitignore
@@ -1 +1,2 @@
 test_memcontrol
+test_core
-- 
1.9.1



[PATCH v2] cgroup: kselftests: add test_core to .gitignore

2018-09-05 Thread Lei Yang
Update .gitignore file.

Signed-off-by: Lei Yang 
---
 tools/testing/selftests/cgroup/.gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/cgroup/.gitignore 
b/tools/testing/selftests/cgroup/.gitignore
index 95eb3a5..adacda5 100644
--- a/tools/testing/selftests/cgroup/.gitignore
+++ b/tools/testing/selftests/cgroup/.gitignore
@@ -1 +1,2 @@
 test_memcontrol
+test_core
-- 
1.9.1



[PATCH] selftests: memory-hotplug: add required configs

2018-09-05 Thread Lei Yang
add CONFIG_MEMORY_HOTREMOVE=y in config
without this config, /sys/devices/system/memory/memory*/removable
always return 0, I endup getting an early skip during test

Signed-off-by: Lei Yang 
---
 tools/testing/selftests/memory-hotplug/config | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/memory-hotplug/config 
b/tools/testing/selftests/memory-hotplug/config
index 2fde301..a7e8cd5 100644
--- a/tools/testing/selftests/memory-hotplug/config
+++ b/tools/testing/selftests/memory-hotplug/config
@@ -2,3 +2,4 @@ CONFIG_MEMORY_HOTPLUG=y
 CONFIG_MEMORY_HOTPLUG_SPARSE=y
 CONFIG_NOTIFIER_ERROR_INJECTION=y
 CONFIG_MEMORY_NOTIFIER_ERROR_INJECT=m
+CONFIG_MEMORY_HOTREMOVE=y
-- 
1.9.1



[PATCH] selftests: memory-hotplug: add required configs

2018-09-05 Thread Lei Yang
add CONFIG_MEMORY_HOTREMOVE=y in config
without this config, /sys/devices/system/memory/memory*/removable
always return 0, I endup getting an early skip during test

Signed-off-by: Lei Yang 
---
 tools/testing/selftests/memory-hotplug/config | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/memory-hotplug/config 
b/tools/testing/selftests/memory-hotplug/config
index 2fde301..a7e8cd5 100644
--- a/tools/testing/selftests/memory-hotplug/config
+++ b/tools/testing/selftests/memory-hotplug/config
@@ -2,3 +2,4 @@ CONFIG_MEMORY_HOTPLUG=y
 CONFIG_MEMORY_HOTPLUG_SPARSE=y
 CONFIG_NOTIFIER_ERROR_INJECTION=y
 CONFIG_MEMORY_NOTIFIER_ERROR_INJECT=m
+CONFIG_MEMORY_HOTREMOVE=y
-- 
1.9.1



[PATCH] selftests/efivarfs: add required kernel configs

2018-09-04 Thread Lei Yang
add config file

Signed-off-by: Lei Yang 
---
 tools/testing/selftests/efivarfs/config | 1 +
 1 file changed, 1 insertion(+)
 create mode 100644 tools/testing/selftests/efivarfs/config

diff --git a/tools/testing/selftests/efivarfs/config 
b/tools/testing/selftests/efivarfs/config
new file mode 100644
index 000..4e151f1
--- /dev/null
+++ b/tools/testing/selftests/efivarfs/config
@@ -0,0 +1 @@
+CONFIG_EFIVAR_FS=y
-- 
1.9.1



[PATCH] selftests/efivarfs: add required kernel configs

2018-09-04 Thread Lei Yang
add config file

Signed-off-by: Lei Yang 
---
 tools/testing/selftests/efivarfs/config | 1 +
 1 file changed, 1 insertion(+)
 create mode 100644 tools/testing/selftests/efivarfs/config

diff --git a/tools/testing/selftests/efivarfs/config 
b/tools/testing/selftests/efivarfs/config
new file mode 100644
index 000..4e151f1
--- /dev/null
+++ b/tools/testing/selftests/efivarfs/config
@@ -0,0 +1 @@
+CONFIG_EFIVAR_FS=y
-- 
1.9.1



Re: [PATCH] sysctl: kselftests: add test_core to .gitignore

2018-09-04 Thread lei yang
sorry, the title should be :"cgroup: kselftests: add test_core to 
.gitignore"


Lei



On 2018年09月05日 10:39, Lei Yang wrote:

Update .gitignore files.

Signed-off-by: Lei Yang 
---
  tools/testing/selftests/cgroup/.gitignore | 1 +
  1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/cgroup/.gitignore 
b/tools/testing/selftests/cgroup/.gitignore
index 95eb3a5..adacda5 100644
--- a/tools/testing/selftests/cgroup/.gitignore
+++ b/tools/testing/selftests/cgroup/.gitignore
@@ -1 +1,2 @@
  test_memcontrol
+test_core




Re: [PATCH] sysctl: kselftests: add test_core to .gitignore

2018-09-04 Thread lei yang
sorry, the title should be :"cgroup: kselftests: add test_core to 
.gitignore"


Lei



On 2018年09月05日 10:39, Lei Yang wrote:

Update .gitignore files.

Signed-off-by: Lei Yang 
---
  tools/testing/selftests/cgroup/.gitignore | 1 +
  1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/cgroup/.gitignore 
b/tools/testing/selftests/cgroup/.gitignore
index 95eb3a5..adacda5 100644
--- a/tools/testing/selftests/cgroup/.gitignore
+++ b/tools/testing/selftests/cgroup/.gitignore
@@ -1 +1,2 @@
  test_memcontrol
+test_core




[PATCH] sysctl: kselftests: add test_core to .gitignore

2018-09-04 Thread Lei Yang
Update .gitignore files.

Signed-off-by: Lei Yang 
---
 tools/testing/selftests/cgroup/.gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/cgroup/.gitignore 
b/tools/testing/selftests/cgroup/.gitignore
index 95eb3a5..adacda5 100644
--- a/tools/testing/selftests/cgroup/.gitignore
+++ b/tools/testing/selftests/cgroup/.gitignore
@@ -1 +1,2 @@
 test_memcontrol
+test_core
-- 
1.9.1



[PATCH] sysctl: kselftests: add test_core to .gitignore

2018-09-04 Thread Lei Yang
Update .gitignore files.

Signed-off-by: Lei Yang 
---
 tools/testing/selftests/cgroup/.gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/cgroup/.gitignore 
b/tools/testing/selftests/cgroup/.gitignore
index 95eb3a5..adacda5 100644
--- a/tools/testing/selftests/cgroup/.gitignore
+++ b/tools/testing/selftests/cgroup/.gitignore
@@ -1 +1,2 @@
 test_memcontrol
+test_core
-- 
1.9.1



[PATCH] sysctl: kselftests: use kernel module instead of built-in

2018-09-04 Thread Lei Yang
It uses modprobe $TEST_DRIVER in sysctl.sh, so update
config to use "m" instead

Signed-off-by: Lei Yang 
---
 tools/testing/selftests/sysctl/config | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/sysctl/config 
b/tools/testing/selftests/sysctl/config
index 6ca1480..fc263ef 100644
--- a/tools/testing/selftests/sysctl/config
+++ b/tools/testing/selftests/sysctl/config
@@ -1 +1 @@
-CONFIG_TEST_SYSCTL=y
+CONFIG_TEST_SYSCTL=m
-- 
1.9.1



[PATCH] sysctl: kselftests: use kernel module instead of built-in

2018-09-04 Thread Lei Yang
It uses modprobe $TEST_DRIVER in sysctl.sh, so update
config to use "m" instead

Signed-off-by: Lei Yang 
---
 tools/testing/selftests/sysctl/config | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/sysctl/config 
b/tools/testing/selftests/sysctl/config
index 6ca1480..fc263ef 100644
--- a/tools/testing/selftests/sysctl/config
+++ b/tools/testing/selftests/sysctl/config
@@ -1 +1 @@
-CONFIG_TEST_SYSCTL=y
+CONFIG_TEST_SYSCTL=m
-- 
1.9.1



[PATCH]] zram: kselftests: correct README

2018-08-29 Thread Lei Yang
CONFIG_ZRAM=y should be CONFIG_ZRAM=m
it obviously uses zram kernel module in the testing

Signed-off-by: Lei Yang 
---
 tools/testing/selftests/zram/README | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/zram/README 
b/tools/testing/selftests/zram/README
index 7972cc5..501223a 100644
--- a/tools/testing/selftests/zram/README
+++ b/tools/testing/selftests/zram/README
@@ -12,7 +12,7 @@ Statistics for individual zram devices are exported through 
sysfs nodes at
 /sys/block/zram/
 
 Kconfig required:
-CONFIG_ZRAM=y
+CONFIG_ZRAM=m
 CONFIG_CRYPTO_LZ4=y
 CONFIG_ZPOOL=y
 CONFIG_ZSMALLOC=y
-- 
1.9.1



[PATCH]] zram: kselftests: correct README

2018-08-29 Thread Lei Yang
CONFIG_ZRAM=y should be CONFIG_ZRAM=m
it obviously uses zram kernel module in the testing

Signed-off-by: Lei Yang 
---
 tools/testing/selftests/zram/README | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/zram/README 
b/tools/testing/selftests/zram/README
index 7972cc5..501223a 100644
--- a/tools/testing/selftests/zram/README
+++ b/tools/testing/selftests/zram/README
@@ -12,7 +12,7 @@ Statistics for individual zram devices are exported through 
sysfs nodes at
 /sys/block/zram/
 
 Kconfig required:
-CONFIG_ZRAM=y
+CONFIG_ZRAM=m
 CONFIG_CRYPTO_LZ4=y
 CONFIG_ZPOOL=y
 CONFIG_ZSMALLOC=y
-- 
1.9.1



[PATCH]] kvm: selftests: use -pthread instead of -lpthread

2018-08-29 Thread Lei Yang
I run into the following error

testing/selftests/kvm/dirty_log_test.c:285: undefined reference to 
`pthread_create'
testing/selftests/kvm/dirty_log_test.c:297: undefined reference to 
`pthread_join'
collect2: error: ld returned 1 exit status

my gcc version is gcc version 4.8.4
"-pthread" would work everywhere

Signed-off-by: Lei Yang 
---
 tools/testing/selftests/kvm/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/kvm/Makefile 
b/tools/testing/selftests/kvm/Makefile
index 03b0f55..48c970c 100644
--- a/tools/testing/selftests/kvm/Makefile
+++ b/tools/testing/selftests/kvm/Makefile
@@ -20,7 +20,7 @@ INSTALL_HDR_PATH = $(top_srcdir)/usr
 LINUX_HDR_PATH = $(INSTALL_HDR_PATH)/include/
 LINUX_TOOL_INCLUDE = $(top_srcdir)tools/include
 CFLAGS += -O2 -g -std=gnu99 -I$(LINUX_TOOL_INCLUDE) -I$(LINUX_HDR_PATH) 
-Iinclude -I$(

[PATCH]] kvm: selftests: use -pthread instead of -lpthread

2018-08-29 Thread Lei Yang
I run into the following error

testing/selftests/kvm/dirty_log_test.c:285: undefined reference to 
`pthread_create'
testing/selftests/kvm/dirty_log_test.c:297: undefined reference to 
`pthread_join'
collect2: error: ld returned 1 exit status

my gcc version is gcc version 4.8.4
"-pthread" would work everywhere

Signed-off-by: Lei Yang 
---
 tools/testing/selftests/kvm/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/kvm/Makefile 
b/tools/testing/selftests/kvm/Makefile
index 03b0f55..48c970c 100644
--- a/tools/testing/selftests/kvm/Makefile
+++ b/tools/testing/selftests/kvm/Makefile
@@ -20,7 +20,7 @@ INSTALL_HDR_PATH = $(top_srcdir)/usr
 LINUX_HDR_PATH = $(INSTALL_HDR_PATH)/include/
 LINUX_TOOL_INCLUDE = $(top_srcdir)tools/include
 CFLAGS += -O2 -g -std=gnu99 -I$(LINUX_TOOL_INCLUDE) -I$(LINUX_HDR_PATH) 
-Iinclude -I$(

Re: [PATCH] selftests: memory-hotplug: delete RUN_TESTS and EMIT_TESTS overrides

2018-05-09 Thread lei yang


On 2018年05月03日 05:18, Shuah Khan (Samsung OSG) wrote:

Delete RUN_TESTS and EMIT_TESTS overrides and use common defines in
lib.mk. Common defines work after making the change the test to run
with ratio=2 as the default mode to be able to invoke the test without
the "-r 2" argument from the common RUN_TESTS and EMIT_TESTS.

The run_full_tests target now calls the test with "-r 10".

Signed-off-by: Shuah Khan (Samsung OSG) 


Reviewed-by: lei.y...@windriver.com

Lei




---
  tools/testing/selftests/memory-hotplug/Makefile   | 5 +
  tools/testing/selftests/memory-hotplug/mem-on-off-test.sh | 3 ++-
  2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/tools/testing/selftests/memory-hotplug/Makefile 
b/tools/testing/selftests/memory-hotplug/Makefile
index 686da510f989..e0a625e34f40 100644
--- a/tools/testing/selftests/memory-hotplug/Makefile
+++ b/tools/testing/selftests/memory-hotplug/Makefile
@@ -4,11 +4,8 @@ all:
  include ../lib.mk
  
  TEST_PROGS := mem-on-off-test.sh

-override RUN_TESTS := @./mem-on-off-test.sh -r 2 && echo "selftests: memory-hotplug 
[PASS]" || echo "selftests: memory-hotplug [FAIL]"
-
-override EMIT_TESTS := echo "$(subst @,,$(RUN_TESTS))"
  
  run_full_test:

-   @/bin/bash ./mem-on-off-test.sh && echo "memory-hotplug selftests: [PASS]" || 
echo "memory-hotplug selftests: [FAIL]"
+   @/bin/bash ./mem-on-off-test.sh -r 10 && echo "memory-hotplug selftests: [PASS]" 
|| echo "memory-hotplug selftests: [FAIL]"
  
  clean:

diff --git a/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh 
b/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh
index ae2c790d0880..ff4991704d07 100755
--- a/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh
+++ b/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh
@@ -133,7 +133,8 @@ offline_memory_expect_fail()
  
  error=-12

  priority=0
-ratio=10
+# Run with default of ratio=2 for Kselftest run
+ratio=2
  retval=0
  
  while getopts e:hp:r: opt; do




Re: [PATCH] selftests: memory-hotplug: delete RUN_TESTS and EMIT_TESTS overrides

2018-05-09 Thread lei yang


On 2018年05月03日 05:18, Shuah Khan (Samsung OSG) wrote:

Delete RUN_TESTS and EMIT_TESTS overrides and use common defines in
lib.mk. Common defines work after making the change the test to run
with ratio=2 as the default mode to be able to invoke the test without
the "-r 2" argument from the common RUN_TESTS and EMIT_TESTS.

The run_full_tests target now calls the test with "-r 10".

Signed-off-by: Shuah Khan (Samsung OSG) 


Reviewed-by: lei.y...@windriver.com

Lei




---
  tools/testing/selftests/memory-hotplug/Makefile   | 5 +
  tools/testing/selftests/memory-hotplug/mem-on-off-test.sh | 3 ++-
  2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/tools/testing/selftests/memory-hotplug/Makefile 
b/tools/testing/selftests/memory-hotplug/Makefile
index 686da510f989..e0a625e34f40 100644
--- a/tools/testing/selftests/memory-hotplug/Makefile
+++ b/tools/testing/selftests/memory-hotplug/Makefile
@@ -4,11 +4,8 @@ all:
  include ../lib.mk
  
  TEST_PROGS := mem-on-off-test.sh

-override RUN_TESTS := @./mem-on-off-test.sh -r 2 && echo "selftests: memory-hotplug 
[PASS]" || echo "selftests: memory-hotplug [FAIL]"
-
-override EMIT_TESTS := echo "$(subst @,,$(RUN_TESTS))"
  
  run_full_test:

-   @/bin/bash ./mem-on-off-test.sh && echo "memory-hotplug selftests: [PASS]" || 
echo "memory-hotplug selftests: [FAIL]"
+   @/bin/bash ./mem-on-off-test.sh -r 10 && echo "memory-hotplug selftests: [PASS]" 
|| echo "memory-hotplug selftests: [FAIL]"
  
  clean:

diff --git a/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh 
b/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh
index ae2c790d0880..ff4991704d07 100755
--- a/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh
+++ b/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh
@@ -133,7 +133,8 @@ offline_memory_expect_fail()
  
  error=-12

  priority=0
-ratio=10
+# Run with default of ratio=2 for Kselftest run
+ratio=2
  retval=0
  
  while getopts e:hp:r: opt; do




Re: [PATCH] selftests: futex: fix compilation error

2017-11-07 Thread lei yang



On 2017年11月08日 06:57, Shuah Khan wrote:

On 11/06/2017 06:18 PM, lei yang wrote:


On 2017年11月07日 07:48, Shuah Khan wrote:

On 11/06/2017 04:45 PM, Shuah Khan wrote:

On 11/05/2017 09:03 PM, Lei Yang wrote:

I run into below error when building futext
/bin/sh: -c: line 5: syntax error: unexpected end of file

the closing ";" and "\" are necessary.
My OS is "Ubuntu 14.04.5 LTS"

Signed-off-by: Lei Yang <lei.y...@windriver.com>
---
   tools/testing/selftests/futex/Makefile | 6 +++---
   1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/futex/Makefile 
b/tools/testing/selftests/futex/Makefile
index f0c0369..943f3a2 100644
--- a/tools/testing/selftests/futex/Makefile
+++ b/tools/testing/selftests/futex/Makefile
@@ -11,9 +11,9 @@ all:
   BUILD_TARGET=$(OUTPUT)/$$DIR;\
   mkdir $$BUILD_TARGET  -p;\
   make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\
-if [ -e $$DIR/$(TEST_PROGS) ]; then
-rsync -a $$DIR/$(TEST_PROGS) $$BUILD_TARGET/;
-fi
+if [ -e $$DIR/$(TEST_PROGS) ]; then \
+rsync -a $$DIR/$(TEST_PROGS) $$BUILD_TARGET/; \
+fi \
   done
 override define RUN_TESTS


Hmm. I don't see this error on linux_4.14-rc8?

Can you give more details on the gcc version you are using?

I meant gnumake version? I am not seeing the failure with what I am
using

$ make -v
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for x86_64-pc-linux-gnu


Lei


I can't take patches that aren't tested on the latest kernel release.
3.16 is very old. I am not going reply to other patches you sent.

Please make sure the patches are based on the latest release and tested
on it as well.


this error only happens when use old version "make", it has nothing to 
do with the new or old kernel.


so the question is  do we need to be compatible with old "make" ?

Lei





thanks,
-- Shuah



--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html




Re: [PATCH] selftests: futex: fix compilation error

2017-11-07 Thread lei yang



On 2017年11月08日 06:57, Shuah Khan wrote:

On 11/06/2017 06:18 PM, lei yang wrote:


On 2017年11月07日 07:48, Shuah Khan wrote:

On 11/06/2017 04:45 PM, Shuah Khan wrote:

On 11/05/2017 09:03 PM, Lei Yang wrote:

I run into below error when building futext
/bin/sh: -c: line 5: syntax error: unexpected end of file

the closing ";" and "\" are necessary.
My OS is "Ubuntu 14.04.5 LTS"

Signed-off-by: Lei Yang 
---
   tools/testing/selftests/futex/Makefile | 6 +++---
   1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/futex/Makefile 
b/tools/testing/selftests/futex/Makefile
index f0c0369..943f3a2 100644
--- a/tools/testing/selftests/futex/Makefile
+++ b/tools/testing/selftests/futex/Makefile
@@ -11,9 +11,9 @@ all:
   BUILD_TARGET=$(OUTPUT)/$$DIR;\
   mkdir $$BUILD_TARGET  -p;\
   make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\
-if [ -e $$DIR/$(TEST_PROGS) ]; then
-rsync -a $$DIR/$(TEST_PROGS) $$BUILD_TARGET/;
-fi
+if [ -e $$DIR/$(TEST_PROGS) ]; then \
+rsync -a $$DIR/$(TEST_PROGS) $$BUILD_TARGET/; \
+fi \
   done
 override define RUN_TESTS


Hmm. I don't see this error on linux_4.14-rc8?

Can you give more details on the gcc version you are using?

I meant gnumake version? I am not seeing the failure with what I am
using

$ make -v
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for x86_64-pc-linux-gnu


Lei


I can't take patches that aren't tested on the latest kernel release.
3.16 is very old. I am not going reply to other patches you sent.

Please make sure the patches are based on the latest release and tested
on it as well.


this error only happens when use old version "make", it has nothing to 
do with the new or old kernel.


so the question is  do we need to be compatible with old "make" ?

Lei





thanks,
-- Shuah



--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[PATCH] selftests: kselftest.h: fix compilation errors

2017-11-07 Thread Lei Yang
In next branch, Various build failed with:

In file included from membarrier_test.c:8:0:
../kselftest.h: In function ‘ksft_print_header’:
../kselftest.h:61:3: error: expected ‘)’ before ‘printf’
   printf("TAP version 13\n");
   ^
../kselftest.h:62:1: error: expected expression before ‘}’ token
 }
 ^

Signed-off-by: Lei Yang <lei.y...@windriver.com>
---
 tools/testing/selftests/kselftest.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/kselftest.h 
b/tools/testing/selftests/kselftest.h
index d6732ba312ef..acc98a5c3d73 100644
--- a/tools/testing/selftests/kselftest.h
+++ b/tools/testing/selftests/kselftest.h
@@ -57,7 +57,7 @@ static inline int ksft_get_error_cnt(void) { return 
ksft_cnt.ksft_error; }
 
 static inline void ksft_print_header(void)
 {
-   if (!(getenv("KSFT_TAP_LEVEL"))
+   if (!(getenv("KSFT_TAP_LEVEL")))
printf("TAP version 13\n");
 }
 
-- 
2.11.0



[PATCH] selftests: kselftest.h: fix compilation errors

2017-11-07 Thread Lei Yang
In next branch, Various build failed with:

In file included from membarrier_test.c:8:0:
../kselftest.h: In function ‘ksft_print_header’:
../kselftest.h:61:3: error: expected ‘)’ before ‘printf’
   printf("TAP version 13\n");
   ^
../kselftest.h:62:1: error: expected expression before ‘}’ token
 }
 ^

Signed-off-by: Lei Yang 
---
 tools/testing/selftests/kselftest.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/kselftest.h 
b/tools/testing/selftests/kselftest.h
index d6732ba312ef..acc98a5c3d73 100644
--- a/tools/testing/selftests/kselftest.h
+++ b/tools/testing/selftests/kselftest.h
@@ -57,7 +57,7 @@ static inline int ksft_get_error_cnt(void) { return 
ksft_cnt.ksft_error; }
 
 static inline void ksft_print_header(void)
 {
-   if (!(getenv("KSFT_TAP_LEVEL"))
+   if (!(getenv("KSFT_TAP_LEVEL")))
printf("TAP version 13\n");
 }
 
-- 
2.11.0



Re: [PATCH] selftests: memfd_test.c: fix compilation warning.

2017-11-07 Thread lei yang
I got the same warning even with ubuntu new distro, this patch fixed 
this issue.


$ gcc --version
gcc (Ubuntu 6.3.0-12ubuntu2) 6.3.0 20170406
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ make -v
GNU Make 4.1
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
<http://gnu.org/licenses/gpl.html>

This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
$ uname -a
Linux pek-lyang0-u17 4.10.0-38-generic #42-Ubuntu SMP Tue Oct 10 
13:24:27 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux



-

memfd_test.c: In function mfd_assert_grow_write:
memfd_test.c:517:19: warning: format %d expects argument of type int, 
but argument 2 has type size_t {aka long unsigned int} [-Wformat=]

   printf("malloc(%d) failed: %m\n", mfd_def_size * 8);
   ^
memfd_test.c: In function mfd_fail_grow_write:
memfd_test.c:537:19: warning: format %d expects argument of type int, 
but argument 2 has type size_t {aka long unsigned int} [-Wformat=]

   printf("malloc(%d) failed: %m\n", mfd_def_size * 8);



Lei


On 2017年11月07日 07:46, Shuah Khan wrote:

On 11/05/2017 03:56 AM, Lei Yang wrote:

Replace '%d' by '%zu' to fix the following compilation warning.

memfd_test.c:517:3: warning: format ‘%d’ expects argument of
type ‘int’,but argument 2 has type ‘size_t’ [-Wformat=]
printf("malloc(%d) failed: %m\n", mfd_def_size * 8);
^
memfd_test.c: In function ‘mfd_fail_grow_write’:
memfd_test.c:537:3: warning: format ‘%d’ expects argument
of type ‘int’,but argument 2 has type ‘size_t’ [-Wformat=]
printf("malloc(%d) failed: %m\n", mfd_def_size * 8);

Signed-off-by: Lei Yang <lei.y...@windriver.com>
---
  tools/testing/selftests/memfd/memfd_test.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/memfd/memfd_test.c 
b/tools/testing/selftests/memfd/memfd_test.c
index f94c6d1..95df9e6 100644
--- a/tools/testing/selftests/memfd/memfd_test.c
+++ b/tools/testing/selftests/memfd/memfd_test.c
@@ -514,7 +514,7 @@ static void mfd_assert_grow_write(int fd)
  
  	buf = malloc(mfd_def_size * 8);

if (!buf) {
-   printf("malloc(%d) failed: %m\n", mfd_def_size * 8);
+   printf("malloc(%zu) failed: %m\n", mfd_def_size * 8);
abort();
}
  
@@ -534,7 +534,7 @@ static void mfd_fail_grow_write(int fd)
  
  	buf = malloc(mfd_def_size * 8);

if (!buf) {
-   printf("malloc(%d) failed: %m\n", mfd_def_size * 8);
+   printf("malloc(%zu) failed: %m\n", mfd_def_size * 8);
abort();
}
  


Relates to gcc version perhaps. What's your gcc version?

thanks,
-- Shuah




Re: [PATCH] selftests: memfd_test.c: fix compilation warning.

2017-11-07 Thread lei yang
I got the same warning even with ubuntu new distro, this patch fixed 
this issue.


$ gcc --version
gcc (Ubuntu 6.3.0-12ubuntu2) 6.3.0 20170406
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ make -v
GNU Make 4.1
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
<http://gnu.org/licenses/gpl.html>

This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
$ uname -a
Linux pek-lyang0-u17 4.10.0-38-generic #42-Ubuntu SMP Tue Oct 10 
13:24:27 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux



-

memfd_test.c: In function mfd_assert_grow_write:
memfd_test.c:517:19: warning: format %d expects argument of type int, 
but argument 2 has type size_t {aka long unsigned int} [-Wformat=]

   printf("malloc(%d) failed: %m\n", mfd_def_size * 8);
   ^
memfd_test.c: In function mfd_fail_grow_write:
memfd_test.c:537:19: warning: format %d expects argument of type int, 
but argument 2 has type size_t {aka long unsigned int} [-Wformat=]

   printf("malloc(%d) failed: %m\n", mfd_def_size * 8);



Lei


On 2017年11月07日 07:46, Shuah Khan wrote:

On 11/05/2017 03:56 AM, Lei Yang wrote:

Replace '%d' by '%zu' to fix the following compilation warning.

memfd_test.c:517:3: warning: format ‘%d’ expects argument of
type ‘int’,but argument 2 has type ‘size_t’ [-Wformat=]
printf("malloc(%d) failed: %m\n", mfd_def_size * 8);
^
memfd_test.c: In function ‘mfd_fail_grow_write’:
memfd_test.c:537:3: warning: format ‘%d’ expects argument
of type ‘int’,but argument 2 has type ‘size_t’ [-Wformat=]
printf("malloc(%d) failed: %m\n", mfd_def_size * 8);

Signed-off-by: Lei Yang 
---
  tools/testing/selftests/memfd/memfd_test.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/memfd/memfd_test.c 
b/tools/testing/selftests/memfd/memfd_test.c
index f94c6d1..95df9e6 100644
--- a/tools/testing/selftests/memfd/memfd_test.c
+++ b/tools/testing/selftests/memfd/memfd_test.c
@@ -514,7 +514,7 @@ static void mfd_assert_grow_write(int fd)
  
  	buf = malloc(mfd_def_size * 8);

if (!buf) {
-   printf("malloc(%d) failed: %m\n", mfd_def_size * 8);
+   printf("malloc(%zu) failed: %m\n", mfd_def_size * 8);
abort();
}
  
@@ -534,7 +534,7 @@ static void mfd_fail_grow_write(int fd)
  
  	buf = malloc(mfd_def_size * 8);

if (!buf) {
-   printf("malloc(%d) failed: %m\n", mfd_def_size * 8);
+   printf("malloc(%zu) failed: %m\n", mfd_def_size * 8);
abort();
}
  


Relates to gcc version perhaps. What's your gcc version?

thanks,
-- Shuah




Re: [PATCH] selftests: futex: fix compilation error

2017-11-06 Thread lei yang



On 2017年11月07日 07:48, Shuah Khan wrote:

On 11/06/2017 04:45 PM, Shuah Khan wrote:

On 11/05/2017 09:03 PM, Lei Yang wrote:

I run into below error when building futext
/bin/sh: -c: line 5: syntax error: unexpected end of file

the closing ";" and "\" are necessary.
My OS is "Ubuntu 14.04.5 LTS"

Signed-off-by: Lei Yang <lei.y...@windriver.com>
---
  tools/testing/selftests/futex/Makefile | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/futex/Makefile 
b/tools/testing/selftests/futex/Makefile
index f0c0369..943f3a2 100644
--- a/tools/testing/selftests/futex/Makefile
+++ b/tools/testing/selftests/futex/Makefile
@@ -11,9 +11,9 @@ all:
BUILD_TARGET=$(OUTPUT)/$$DIR;   \
mkdir $$BUILD_TARGET  -p;   \
make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\
-   if [ -e $$DIR/$(TEST_PROGS) ]; then
-   rsync -a $$DIR/$(TEST_PROGS) $$BUILD_TARGET/;
-   fi
+   if [ -e $$DIR/$(TEST_PROGS) ]; then \
+   rsync -a $$DIR/$(TEST_PROGS) $$BUILD_TARGET/; \
+   fi \
done
  
  override define RUN_TESTS



Hmm. I don't see this error on linux_4.14-rc8?

Can you give more details on the gcc version you are using?


I meant gnumake version? I am not seeing the failure with what I am
using


$ make -v
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for x86_64-pc-linux-gnu


Lei



thanks,
-- Shuah





Re: [PATCH] selftests: futex: fix compilation error

2017-11-06 Thread lei yang



On 2017年11月07日 07:48, Shuah Khan wrote:

On 11/06/2017 04:45 PM, Shuah Khan wrote:

On 11/05/2017 09:03 PM, Lei Yang wrote:

I run into below error when building futext
/bin/sh: -c: line 5: syntax error: unexpected end of file

the closing ";" and "\" are necessary.
My OS is "Ubuntu 14.04.5 LTS"

Signed-off-by: Lei Yang 
---
  tools/testing/selftests/futex/Makefile | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/futex/Makefile 
b/tools/testing/selftests/futex/Makefile
index f0c0369..943f3a2 100644
--- a/tools/testing/selftests/futex/Makefile
+++ b/tools/testing/selftests/futex/Makefile
@@ -11,9 +11,9 @@ all:
BUILD_TARGET=$(OUTPUT)/$$DIR;   \
mkdir $$BUILD_TARGET  -p;   \
make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\
-   if [ -e $$DIR/$(TEST_PROGS) ]; then
-   rsync -a $$DIR/$(TEST_PROGS) $$BUILD_TARGET/;
-   fi
+   if [ -e $$DIR/$(TEST_PROGS) ]; then \
+   rsync -a $$DIR/$(TEST_PROGS) $$BUILD_TARGET/; \
+   fi \
done
  
  override define RUN_TESTS



Hmm. I don't see this error on linux_4.14-rc8?

Can you give more details on the gcc version you are using?


I meant gnumake version? I am not seeing the failure with what I am
using


$ make -v
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for x86_64-pc-linux-gnu


Lei



thanks,
-- Shuah





Re: [PATCH] selftests: futex: fix compilation error

2017-11-06 Thread lei yang



On 2017年11月07日 07:45, Shuah Khan wrote:

On 11/05/2017 09:03 PM, Lei Yang wrote:

I run into below error when building futext
/bin/sh: -c: line 5: syntax error: unexpected end of file

the closing ";" and "\" are necessary.
My OS is "Ubuntu 14.04.5 LTS"

Signed-off-by: Lei Yang <lei.y...@windriver.com>
---
  tools/testing/selftests/futex/Makefile | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/futex/Makefile 
b/tools/testing/selftests/futex/Makefile
index f0c0369..943f3a2 100644
--- a/tools/testing/selftests/futex/Makefile
+++ b/tools/testing/selftests/futex/Makefile
@@ -11,9 +11,9 @@ all:
BUILD_TARGET=$(OUTPUT)/$$DIR;   \
mkdir $$BUILD_TARGET  -p;   \
make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\
-   if [ -e $$DIR/$(TEST_PROGS) ]; then
-   rsync -a $$DIR/$(TEST_PROGS) $$BUILD_TARGET/;
-   fi
+   if [ -e $$DIR/$(TEST_PROGS) ]; then \
+   rsync -a $$DIR/$(TEST_PROGS) $$BUILD_TARGET/; \
+   fi \
done
  
  override define RUN_TESTS



Hmm. I don't see this error on linux_4.14-rc8?

Can you give more details on the gcc version you are using?


$ cat /proc/version
Linux version 3.16.0-30-generic (buildd@kissel) (gcc version 4.8.2 
(Ubuntu 4.8.2-19ubuntu1) ) #40~14.04.1-Ubuntu SMP Thu Jan 15 17:43:14 
UTC 2015


$ uname -a
Linux pek-lyang0-d1 3.16.0-30-generic #40~14.04.1-Ubuntu SMP Thu Jan 15 
17:43:14 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux


I'm also surprised why nobody report this ? I thought it's because 
ksefltest community  is not active :-)


Lei


thanks,
-- Shuah




Re: [PATCH] selftests: futex: fix compilation error

2017-11-06 Thread lei yang



On 2017年11月07日 07:45, Shuah Khan wrote:

On 11/05/2017 09:03 PM, Lei Yang wrote:

I run into below error when building futext
/bin/sh: -c: line 5: syntax error: unexpected end of file

the closing ";" and "\" are necessary.
My OS is "Ubuntu 14.04.5 LTS"

Signed-off-by: Lei Yang 
---
  tools/testing/selftests/futex/Makefile | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/futex/Makefile 
b/tools/testing/selftests/futex/Makefile
index f0c0369..943f3a2 100644
--- a/tools/testing/selftests/futex/Makefile
+++ b/tools/testing/selftests/futex/Makefile
@@ -11,9 +11,9 @@ all:
BUILD_TARGET=$(OUTPUT)/$$DIR;   \
mkdir $$BUILD_TARGET  -p;   \
make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\
-   if [ -e $$DIR/$(TEST_PROGS) ]; then
-   rsync -a $$DIR/$(TEST_PROGS) $$BUILD_TARGET/;
-   fi
+   if [ -e $$DIR/$(TEST_PROGS) ]; then \
+   rsync -a $$DIR/$(TEST_PROGS) $$BUILD_TARGET/; \
+   fi \
done
  
  override define RUN_TESTS



Hmm. I don't see this error on linux_4.14-rc8?

Can you give more details on the gcc version you are using?


$ cat /proc/version
Linux version 3.16.0-30-generic (buildd@kissel) (gcc version 4.8.2 
(Ubuntu 4.8.2-19ubuntu1) ) #40~14.04.1-Ubuntu SMP Thu Jan 15 17:43:14 
UTC 2015


$ uname -a
Linux pek-lyang0-d1 3.16.0-30-generic #40~14.04.1-Ubuntu SMP Thu Jan 15 
17:43:14 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux


I'm also surprised why nobody report this ? I thought it's because 
ksefltest community  is not active :-)


Lei


thanks,
-- Shuah




Re: [PATCH] selftests: fix compile error for sync

2017-11-06 Thread lei yang



On 2017年11月07日 07:35, Shuah Khan wrote:

On 11/05/2017 03:08 AM, Lei Yang wrote:

I got below error message when building sync test:

make[1]: Entering directory `tools/testing/selftests/sync'
gcc -c sync.c -o tools/testing/selftests/sync/sync.o
sync.c:42:29: fatal error: linux/sync_file.h: No such file or directory
  #include 

obviously, CFLAGS and LDFLAGS are not used when comipling.

Signed-off-by: Lei Yang <lei.y...@windriver.com>
---
  tools/testing/selftests/sync/Makefile | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/sync/Makefile 
b/tools/testing/selftests/sync/Makefile
index 8e04d0a..46cbcc3 100644
--- a/tools/testing/selftests/sync/Makefile
+++ b/tools/testing/selftests/sync/Makefile
@@ -29,9 +29,9 @@ $(TEST_CUSTOM_PROGS): $(TESTS) $(OBJS)
$(CC) -o $(TEST_CUSTOM_PROGS) $(OBJS) $(TESTS) $(CFLAGS) $(LDFLAGS)
  
  $(OBJS): $(OUTPUT)/%.o: %.c

-   $(CC) -c $^ -o $@
+   $(CC) -c $^ -o $@ $(CFLAGS) $(LDFLAGS)
  
  $(TESTS): $(OUTPUT)/%.o: %.c

-   $(CC) -c $^ -o $@
+   $(CC) -c $^ -o $@ $(CFLAGS) $(LDFLAGS)
  
  EXTRA_CLEAN := $(TEST_CUSTOM_PROGS) $(OBJS) $(TESTS)



How are you building the test? I am not seeing the error on linux-4.14.0-rc8


make -C tools/testing/selftests

Lei



thanks,
-- Shuah
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html




Re: [PATCH] selftests: fix compile error for sync

2017-11-06 Thread lei yang



On 2017年11月07日 07:35, Shuah Khan wrote:

On 11/05/2017 03:08 AM, Lei Yang wrote:

I got below error message when building sync test:

make[1]: Entering directory `tools/testing/selftests/sync'
gcc -c sync.c -o tools/testing/selftests/sync/sync.o
sync.c:42:29: fatal error: linux/sync_file.h: No such file or directory
  #include 

obviously, CFLAGS and LDFLAGS are not used when comipling.

Signed-off-by: Lei Yang 
---
  tools/testing/selftests/sync/Makefile | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/sync/Makefile 
b/tools/testing/selftests/sync/Makefile
index 8e04d0a..46cbcc3 100644
--- a/tools/testing/selftests/sync/Makefile
+++ b/tools/testing/selftests/sync/Makefile
@@ -29,9 +29,9 @@ $(TEST_CUSTOM_PROGS): $(TESTS) $(OBJS)
$(CC) -o $(TEST_CUSTOM_PROGS) $(OBJS) $(TESTS) $(CFLAGS) $(LDFLAGS)
  
  $(OBJS): $(OUTPUT)/%.o: %.c

-   $(CC) -c $^ -o $@
+   $(CC) -c $^ -o $@ $(CFLAGS) $(LDFLAGS)
  
  $(TESTS): $(OUTPUT)/%.o: %.c

-   $(CC) -c $^ -o $@
+   $(CC) -c $^ -o $@ $(CFLAGS) $(LDFLAGS)
  
  EXTRA_CLEAN := $(TEST_CUSTOM_PROGS) $(OBJS) $(TESTS)



How are you building the test? I am not seeing the error on linux-4.14.0-rc8


make -C tools/testing/selftests

Lei



thanks,
-- Shuah
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html




Re: [PATCH] selftests: memfd_test.c: fix compilation warning.

2017-11-06 Thread lei yang



On 2017年11月07日 07:46, Shuah Khan wrote:

On 11/05/2017 03:56 AM, Lei Yang wrote:

Replace '%d' by '%zu' to fix the following compilation warning.

memfd_test.c:517:3: warning: format ‘%d’ expects argument of
type ‘int’,but argument 2 has type ‘size_t’ [-Wformat=]
printf("malloc(%d) failed: %m\n", mfd_def_size * 8);
^
memfd_test.c: In function ‘mfd_fail_grow_write’:
memfd_test.c:537:3: warning: format ‘%d’ expects argument
of type ‘int’,but argument 2 has type ‘size_t’ [-Wformat=]
printf("malloc(%d) failed: %m\n", mfd_def_size * 8);

Signed-off-by: Lei Yang <lei.y...@windriver.com>
---
  tools/testing/selftests/memfd/memfd_test.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/memfd/memfd_test.c 
b/tools/testing/selftests/memfd/memfd_test.c
index f94c6d1..95df9e6 100644
--- a/tools/testing/selftests/memfd/memfd_test.c
+++ b/tools/testing/selftests/memfd/memfd_test.c
@@ -514,7 +514,7 @@ static void mfd_assert_grow_write(int fd)
  
  	buf = malloc(mfd_def_size * 8);

if (!buf) {
-   printf("malloc(%d) failed: %m\n", mfd_def_size * 8);
+   printf("malloc(%zu) failed: %m\n", mfd_def_size * 8);
abort();
}
  
@@ -534,7 +534,7 @@ static void mfd_fail_grow_write(int fd)
  
  	buf = malloc(mfd_def_size * 8);

if (!buf) {
-   printf("malloc(%d) failed: %m\n", mfd_def_size * 8);
+   printf("malloc(%zu) failed: %m\n", mfd_def_size * 8);
abort();
}
  


Relates to gcc version perhaps. What's your gcc version?


$ cat /proc/version
Linux version 3.16.0-30-generic (buildd@kissel) (gcc version 4.8.2 
(Ubuntu 4.8.2-19ubuntu1) ) #40~14.04.1-Ubuntu SMP Thu Jan 15 17:43:14 
UTC 2015



Lei




thanks,
-- Shuah




Re: [PATCH] selftests: memfd_test.c: fix compilation warning.

2017-11-06 Thread lei yang



On 2017年11月07日 07:46, Shuah Khan wrote:

On 11/05/2017 03:56 AM, Lei Yang wrote:

Replace '%d' by '%zu' to fix the following compilation warning.

memfd_test.c:517:3: warning: format ‘%d’ expects argument of
type ‘int’,but argument 2 has type ‘size_t’ [-Wformat=]
printf("malloc(%d) failed: %m\n", mfd_def_size * 8);
^
memfd_test.c: In function ‘mfd_fail_grow_write’:
memfd_test.c:537:3: warning: format ‘%d’ expects argument
of type ‘int’,but argument 2 has type ‘size_t’ [-Wformat=]
printf("malloc(%d) failed: %m\n", mfd_def_size * 8);

Signed-off-by: Lei Yang 
---
  tools/testing/selftests/memfd/memfd_test.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/memfd/memfd_test.c 
b/tools/testing/selftests/memfd/memfd_test.c
index f94c6d1..95df9e6 100644
--- a/tools/testing/selftests/memfd/memfd_test.c
+++ b/tools/testing/selftests/memfd/memfd_test.c
@@ -514,7 +514,7 @@ static void mfd_assert_grow_write(int fd)
  
  	buf = malloc(mfd_def_size * 8);

if (!buf) {
-   printf("malloc(%d) failed: %m\n", mfd_def_size * 8);
+   printf("malloc(%zu) failed: %m\n", mfd_def_size * 8);
abort();
}
  
@@ -534,7 +534,7 @@ static void mfd_fail_grow_write(int fd)
  
  	buf = malloc(mfd_def_size * 8);

if (!buf) {
-   printf("malloc(%d) failed: %m\n", mfd_def_size * 8);
+   printf("malloc(%zu) failed: %m\n", mfd_def_size * 8);
abort();
}
  


Relates to gcc version perhaps. What's your gcc version?


$ cat /proc/version
Linux version 3.16.0-30-generic (buildd@kissel) (gcc version 4.8.2 
(Ubuntu 4.8.2-19ubuntu1) ) #40~14.04.1-Ubuntu SMP Thu Jan 15 17:43:14 
UTC 2015



Lei




thanks,
-- Shuah




[PATCH] selftests: futex: fix compilation error

2017-11-05 Thread Lei Yang
I run into below error when building futext
/bin/sh: -c: line 5: syntax error: unexpected end of file

the closing ";" and "\" are necessary.
My OS is "Ubuntu 14.04.5 LTS"

Signed-off-by: Lei Yang <lei.y...@windriver.com>
---
 tools/testing/selftests/futex/Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/futex/Makefile 
b/tools/testing/selftests/futex/Makefile
index f0c0369..943f3a2 100644
--- a/tools/testing/selftests/futex/Makefile
+++ b/tools/testing/selftests/futex/Makefile
@@ -11,9 +11,9 @@ all:
BUILD_TARGET=$(OUTPUT)/$$DIR;   \
mkdir $$BUILD_TARGET  -p;   \
make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\
-   if [ -e $$DIR/$(TEST_PROGS) ]; then
-   rsync -a $$DIR/$(TEST_PROGS) $$BUILD_TARGET/;
-   fi
+   if [ -e $$DIR/$(TEST_PROGS) ]; then \
+   rsync -a $$DIR/$(TEST_PROGS) $$BUILD_TARGET/; \
+   fi \
done
 
 override define RUN_TESTS
-- 
1.9.1



[PATCH] selftests: futex: fix compilation error

2017-11-05 Thread Lei Yang
I run into below error when building futext
/bin/sh: -c: line 5: syntax error: unexpected end of file

the closing ";" and "\" are necessary.
My OS is "Ubuntu 14.04.5 LTS"

Signed-off-by: Lei Yang 
---
 tools/testing/selftests/futex/Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/futex/Makefile 
b/tools/testing/selftests/futex/Makefile
index f0c0369..943f3a2 100644
--- a/tools/testing/selftests/futex/Makefile
+++ b/tools/testing/selftests/futex/Makefile
@@ -11,9 +11,9 @@ all:
BUILD_TARGET=$(OUTPUT)/$$DIR;   \
mkdir $$BUILD_TARGET  -p;   \
make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\
-   if [ -e $$DIR/$(TEST_PROGS) ]; then
-   rsync -a $$DIR/$(TEST_PROGS) $$BUILD_TARGET/;
-   fi
+   if [ -e $$DIR/$(TEST_PROGS) ]; then \
+   rsync -a $$DIR/$(TEST_PROGS) $$BUILD_TARGET/; \
+   fi \
done
 
 override define RUN_TESTS
-- 
1.9.1



[PATCH] selftests: memfd_test.c: fix compilation warning.

2017-11-05 Thread Lei Yang
Replace '%d' by '%zu' to fix the following compilation warning.

memfd_test.c:517:3: warning: format ‘%d’ expects argument of
type ‘int’,but argument 2 has type ‘size_t’ [-Wformat=]
   printf("malloc(%d) failed: %m\n", mfd_def_size * 8);
   ^
memfd_test.c: In function ‘mfd_fail_grow_write’:
memfd_test.c:537:3: warning: format ‘%d’ expects argument
of type ‘int’,but argument 2 has type ‘size_t’ [-Wformat=]
   printf("malloc(%d) failed: %m\n", mfd_def_size * 8);

Signed-off-by: Lei Yang <lei.y...@windriver.com>
---
 tools/testing/selftests/memfd/memfd_test.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/memfd/memfd_test.c 
b/tools/testing/selftests/memfd/memfd_test.c
index f94c6d1..95df9e6 100644
--- a/tools/testing/selftests/memfd/memfd_test.c
+++ b/tools/testing/selftests/memfd/memfd_test.c
@@ -514,7 +514,7 @@ static void mfd_assert_grow_write(int fd)
 
buf = malloc(mfd_def_size * 8);
if (!buf) {
-   printf("malloc(%d) failed: %m\n", mfd_def_size * 8);
+   printf("malloc(%zu) failed: %m\n", mfd_def_size * 8);
abort();
}
 
@@ -534,7 +534,7 @@ static void mfd_fail_grow_write(int fd)
 
buf = malloc(mfd_def_size * 8);
if (!buf) {
-   printf("malloc(%d) failed: %m\n", mfd_def_size * 8);
+   printf("malloc(%zu) failed: %m\n", mfd_def_size * 8);
abort();
}
 
-- 
1.9.1



[PATCH] selftests: memfd_test.c: fix compilation warning.

2017-11-05 Thread Lei Yang
Replace '%d' by '%zu' to fix the following compilation warning.

memfd_test.c:517:3: warning: format ‘%d’ expects argument of
type ‘int’,but argument 2 has type ‘size_t’ [-Wformat=]
   printf("malloc(%d) failed: %m\n", mfd_def_size * 8);
   ^
memfd_test.c: In function ‘mfd_fail_grow_write’:
memfd_test.c:537:3: warning: format ‘%d’ expects argument
of type ‘int’,but argument 2 has type ‘size_t’ [-Wformat=]
   printf("malloc(%d) failed: %m\n", mfd_def_size * 8);

Signed-off-by: Lei Yang 
---
 tools/testing/selftests/memfd/memfd_test.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/memfd/memfd_test.c 
b/tools/testing/selftests/memfd/memfd_test.c
index f94c6d1..95df9e6 100644
--- a/tools/testing/selftests/memfd/memfd_test.c
+++ b/tools/testing/selftests/memfd/memfd_test.c
@@ -514,7 +514,7 @@ static void mfd_assert_grow_write(int fd)
 
buf = malloc(mfd_def_size * 8);
if (!buf) {
-   printf("malloc(%d) failed: %m\n", mfd_def_size * 8);
+   printf("malloc(%zu) failed: %m\n", mfd_def_size * 8);
abort();
}
 
@@ -534,7 +534,7 @@ static void mfd_fail_grow_write(int fd)
 
buf = malloc(mfd_def_size * 8);
if (!buf) {
-   printf("malloc(%d) failed: %m\n", mfd_def_size * 8);
+   printf("malloc(%zu) failed: %m\n", mfd_def_size * 8);
abort();
}
 
-- 
1.9.1



[PATCH] selftests: fix compile error for sync

2017-11-05 Thread Lei Yang
I got below error message when building sync test:

make[1]: Entering directory `tools/testing/selftests/sync'
gcc -c sync.c -o tools/testing/selftests/sync/sync.o
sync.c:42:29: fatal error: linux/sync_file.h: No such file or directory
 #include 

obviously, CFLAGS and LDFLAGS are not used when comipling.

Signed-off-by: Lei Yang <lei.y...@windriver.com>
---
 tools/testing/selftests/sync/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/sync/Makefile 
b/tools/testing/selftests/sync/Makefile
index 8e04d0a..46cbcc3 100644
--- a/tools/testing/selftests/sync/Makefile
+++ b/tools/testing/selftests/sync/Makefile
@@ -29,9 +29,9 @@ $(TEST_CUSTOM_PROGS): $(TESTS) $(OBJS)
$(CC) -o $(TEST_CUSTOM_PROGS) $(OBJS) $(TESTS) $(CFLAGS) $(LDFLAGS)
 
 $(OBJS): $(OUTPUT)/%.o: %.c
-   $(CC) -c $^ -o $@
+   $(CC) -c $^ -o $@ $(CFLAGS) $(LDFLAGS)
 
 $(TESTS): $(OUTPUT)/%.o: %.c
-   $(CC) -c $^ -o $@
+   $(CC) -c $^ -o $@ $(CFLAGS) $(LDFLAGS)
 
 EXTRA_CLEAN := $(TEST_CUSTOM_PROGS) $(OBJS) $(TESTS)
-- 
1.9.1



[PATCH] selftests: fix compile error for sync

2017-11-05 Thread Lei Yang
I got below error message when building sync test:

make[1]: Entering directory `tools/testing/selftests/sync'
gcc -c sync.c -o tools/testing/selftests/sync/sync.o
sync.c:42:29: fatal error: linux/sync_file.h: No such file or directory
 #include 

obviously, CFLAGS and LDFLAGS are not used when comipling.

Signed-off-by: Lei Yang 
---
 tools/testing/selftests/sync/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/sync/Makefile 
b/tools/testing/selftests/sync/Makefile
index 8e04d0a..46cbcc3 100644
--- a/tools/testing/selftests/sync/Makefile
+++ b/tools/testing/selftests/sync/Makefile
@@ -29,9 +29,9 @@ $(TEST_CUSTOM_PROGS): $(TESTS) $(OBJS)
$(CC) -o $(TEST_CUSTOM_PROGS) $(OBJS) $(TESTS) $(CFLAGS) $(LDFLAGS)
 
 $(OBJS): $(OUTPUT)/%.o: %.c
-   $(CC) -c $^ -o $@
+   $(CC) -c $^ -o $@ $(CFLAGS) $(LDFLAGS)
 
 $(TESTS): $(OUTPUT)/%.o: %.c
-   $(CC) -c $^ -o $@
+   $(CC) -c $^ -o $@ $(CFLAGS) $(LDFLAGS)
 
 EXTRA_CLEAN := $(TEST_CUSTOM_PROGS) $(OBJS) $(TESTS)
-- 
1.9.1



[PATCH] selftests: add "PASS" status in log for mqueue

2017-11-05 Thread Lei Yang
It prints 'FAIL' status when test failed, but not print
'PASS' when test passed.

Signed-off-by: Lei Yang <lei.y...@windriver.com>
---
 tools/testing/selftests/mqueue/Makefile | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/testing/selftests/mqueue/Makefile 
b/tools/testing/selftests/mqueue/Makefile
index 0f5e347..437b048 100644
--- a/tools/testing/selftests/mqueue/Makefile
+++ b/tools/testing/selftests/mqueue/Makefile
@@ -5,12 +5,12 @@ TEST_GEN_PROGS := mq_open_tests mq_perf_tests
 include ../lib.mk
 
 override define RUN_TESTS
-   $(OUTPUT)/mq_open_tests /test1 || echo "selftests: mq_open_tests [FAIL]"
-   $(OUTPUT)//mq_perf_tests || echo "selftests: mq_perf_tests [FAIL]"
+   $(OUTPUT)/mq_open_tests /test1 && echo "selftests: mq_open_tests 
[PASS]" || echo "selftests: mq_open_tests [FAIL]"
+   $(OUTPUT)/mq_perf_tests && echo "selftests: mq_perf_tests [PASS]" || 
echo "selftests: mq_perf_tests [FAIL]"
 endef
 
 override define EMIT_TESTS
-   echo "./mq_open_tests /test1 || echo \"selftests: mq_open_tests 
[FAIL]\""
-   echo "./mq_perf_tests || echo \"selftests: mq_perf_tests [FAIL]\""
+   echo "./mq_open_tests /test1 && echo \"selftests: mq_open_tests 
[PASS]\" || echo \"selftests: mq_open_tests [FAIL]\""
+   echo "./mq_perf_tests && echo \"selftests: mq_perf_tests [PASS]\" || 
echo \"selftests: mq_perf_tests [FAIL]\""
 endef
 
-- 
1.9.1



[PATCH] selftests: add "PASS" status in log for mqueue

2017-11-05 Thread Lei Yang
It prints 'FAIL' status when test failed, but not print
'PASS' when test passed.

Signed-off-by: Lei Yang 
---
 tools/testing/selftests/mqueue/Makefile | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/testing/selftests/mqueue/Makefile 
b/tools/testing/selftests/mqueue/Makefile
index 0f5e347..437b048 100644
--- a/tools/testing/selftests/mqueue/Makefile
+++ b/tools/testing/selftests/mqueue/Makefile
@@ -5,12 +5,12 @@ TEST_GEN_PROGS := mq_open_tests mq_perf_tests
 include ../lib.mk
 
 override define RUN_TESTS
-   $(OUTPUT)/mq_open_tests /test1 || echo "selftests: mq_open_tests [FAIL]"
-   $(OUTPUT)//mq_perf_tests || echo "selftests: mq_perf_tests [FAIL]"
+   $(OUTPUT)/mq_open_tests /test1 && echo "selftests: mq_open_tests 
[PASS]" || echo "selftests: mq_open_tests [FAIL]"
+   $(OUTPUT)/mq_perf_tests && echo "selftests: mq_perf_tests [PASS]" || 
echo "selftests: mq_perf_tests [FAIL]"
 endef
 
 override define EMIT_TESTS
-   echo "./mq_open_tests /test1 || echo \"selftests: mq_open_tests 
[FAIL]\""
-   echo "./mq_perf_tests || echo \"selftests: mq_perf_tests [FAIL]\""
+   echo "./mq_open_tests /test1 && echo \"selftests: mq_open_tests 
[PASS]\" || echo \"selftests: mq_open_tests [FAIL]\""
+   echo "./mq_perf_tests && echo \"selftests: mq_perf_tests [PASS]\" || 
echo \"selftests: mq_perf_tests [FAIL]\""
 endef
 
-- 
1.9.1



Re: [PATCH] selftests: remove obsolete kconfig fragment for cpu-hotplug

2017-11-03 Thread lei yang



On 2017年11月03日 06:14, Shuah Khan wrote:

Hi Lei,

On 10/17/2017 08:10 PM, lei.y...@windriver.com wrote:

From: Lei Yang <lei.y...@windriver.com>

Are you using git send-email to send patches. it is odd to see this
extra From: line.


I just find it's caused by my git configuration.

in .gitconfig, comment out below line, then the extra line disappears
[sendemail]
#from = lei.y...@windriver.com


Lei


Kconfig CONFIG_CPU_NOTIFIER_ERROR_INJECT has been removed since kernel 4.10
check commit:
 commit 530e9b76ae8f863dfdef4a6ad0b38613d32e8c3f
 Author: Thomas Gleixner <t...@linutronix.de>
 Date:   Wed Dec 21 20:19:53 2016 +0100

 cpu/hotplug: Remove obsolete cpu hotplug register/unregister functions

 hotcpu_notifier(), cpu_notifier(), __hotcpu_notifier(), 
__cpu_notifier(),
 register_hotcpu_notifier(), register_cpu_notifier(),
 __register_hotcpu_notifier(), __register_cpu_notifier(),
 unregister_hotcpu_notifier(), unregister_cpu_notifier(),
 __unregister_hotcpu_notifier(), __unregister_cpu_notifier()
  

Please make sure your commit lines are 75 chars or less. Make sure you
run chekpatch script on your patches.

I fixed these when I applied the patch. No need to resend this patch.
Please make sure to use git send-email and run checkpatch script on
your future patches.


Signed-off-by: Lei Yang <lei.y...@windriver.com>

Applied to linux-kselftest next for 4.15-rc1.


---
  tools/testing/selftests/cpu-hotplug/config | 1 -
  1 file changed, 1 deletion(-)

diff --git a/tools/testing/selftests/cpu-hotplug/config 
b/tools/testing/selftests/cpu-hotplug/config
index e6ab090..d4aca2a 100644
--- a/tools/testing/selftests/cpu-hotplug/config
+++ b/tools/testing/selftests/cpu-hotplug/config
@@ -1,2 +1 @@
  CONFIG_NOTIFIER_ERROR_INJECTION=y
-CONFIG_CPU_NOTIFIER_ERROR_INJECT=m


thanks,
-- Shuah




Re: [PATCH] selftests: remove obsolete kconfig fragment for cpu-hotplug

2017-11-03 Thread lei yang



On 2017年11月03日 06:14, Shuah Khan wrote:

Hi Lei,

On 10/17/2017 08:10 PM, lei.y...@windriver.com wrote:

From: Lei Yang 

Are you using git send-email to send patches. it is odd to see this
extra From: line.


I just find it's caused by my git configuration.

in .gitconfig, comment out below line, then the extra line disappears
[sendemail]
#from = lei.y...@windriver.com


Lei


Kconfig CONFIG_CPU_NOTIFIER_ERROR_INJECT has been removed since kernel 4.10
check commit:
 commit 530e9b76ae8f863dfdef4a6ad0b38613d32e8c3f
 Author: Thomas Gleixner 
 Date:   Wed Dec 21 20:19:53 2016 +0100

 cpu/hotplug: Remove obsolete cpu hotplug register/unregister functions

 hotcpu_notifier(), cpu_notifier(), __hotcpu_notifier(), 
__cpu_notifier(),
 register_hotcpu_notifier(), register_cpu_notifier(),
 __register_hotcpu_notifier(), __register_cpu_notifier(),
 unregister_hotcpu_notifier(), unregister_cpu_notifier(),
 __unregister_hotcpu_notifier(), __unregister_cpu_notifier()
  

Please make sure your commit lines are 75 chars or less. Make sure you
run chekpatch script on your patches.

I fixed these when I applied the patch. No need to resend this patch.
Please make sure to use git send-email and run checkpatch script on
your future patches.


Signed-off-by: Lei Yang 

Applied to linux-kselftest next for 4.15-rc1.


---
  tools/testing/selftests/cpu-hotplug/config | 1 -
  1 file changed, 1 deletion(-)

diff --git a/tools/testing/selftests/cpu-hotplug/config 
b/tools/testing/selftests/cpu-hotplug/config
index e6ab090..d4aca2a 100644
--- a/tools/testing/selftests/cpu-hotplug/config
+++ b/tools/testing/selftests/cpu-hotplug/config
@@ -1,2 +1 @@
  CONFIG_NOTIFIER_ERROR_INJECTION=y
-CONFIG_CPU_NOTIFIER_ERROR_INJECT=m


thanks,
-- Shuah




[PATCH] selftests: add required kernel config for intel_pstate

2017-11-03 Thread Lei Yang
intel_pstate depends on CONFIG_X86_INTEL_PSTATE, so add it
to the config.

Signed-off-by: Lei Yang <lei.y...@windriver.com>
---
 tools/testing/selftests/intel_pstate/config | 1 +
 1 file changed, 1 insertion(+)
 create mode 100644 tools/testing/selftests/intel_pstate/config

diff --git a/tools/testing/selftests/intel_pstate/config 
b/tools/testing/selftests/intel_pstate/config
new file mode 100644
index 000..35365aa
--- /dev/null
+++ b/tools/testing/selftests/intel_pstate/config
@@ -0,0 +1 @@
+CONFIG_X86_INTEL_PSTATE=y
-- 
1.9.1



[PATCH] selftests: add required kernel config for intel_pstate

2017-11-03 Thread Lei Yang
intel_pstate depends on CONFIG_X86_INTEL_PSTATE, so add it
to the config.

Signed-off-by: Lei Yang 
---
 tools/testing/selftests/intel_pstate/config | 1 +
 1 file changed, 1 insertion(+)
 create mode 100644 tools/testing/selftests/intel_pstate/config

diff --git a/tools/testing/selftests/intel_pstate/config 
b/tools/testing/selftests/intel_pstate/config
new file mode 100644
index 000..35365aa
--- /dev/null
+++ b/tools/testing/selftests/intel_pstate/config
@@ -0,0 +1 @@
+CONFIG_X86_INTEL_PSTATE=y
-- 
1.9.1