linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Patch v2] lib: test get_count_order/long in test_bitops.c
@ 2020-06-02 22:37 Wei Yang
  2020-06-03  9:18 ` Andy Shevchenko
  2020-06-04 11:50 ` Geert Uytterhoeven
  0 siblings, 2 replies; 15+ messages in thread
From: Wei Yang @ 2020-06-02 22:37 UTC (permalink / raw)
  To: akpm, andriy.shevchenko, christian.brauner; +Cc: linux-kernel, Wei Yang

Add some test for get_count_order/long in test_bitops.c.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>

---
v2: merge the test into test_bitops.c
---
 lib/Kconfig.debug | 10 +++++-----
 lib/test_bitops.c | 40 ++++++++++++++++++++++++++++++++++++++--
 2 files changed, 43 insertions(+), 7 deletions(-)

diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index f80d5609798f..512111a72e34 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -1987,15 +1987,15 @@ config TEST_LKM
 	  If unsure, say N.
 
 config TEST_BITOPS
-	tristate "Test module for compilation of clear_bit/set_bit operations"
+	tristate "Test module for compilation of bitops operations"
 	depends on m
 	help
 	  This builds the "test_bitops" module that is much like the
 	  TEST_LKM module except that it does a basic exercise of the
-	  clear_bit and set_bit macros to make sure there are no compiler
-	  warnings from C=1 sparse checker or -Wextra compilations. It has
-	  no dependencies and doesn't run or load unless explicitly requested
-	  by name.  for example: modprobe test_bitops.
+	  set/clear_bit macros and get_count_order/long to make sure there are
+	  no compiler warnings from C=1 sparse checker or -Wextra
+	  compilations. It has no dependencies and doesn't run or load unless
+	  explicitly requested by name.  for example: modprobe test_bitops.
 
 	  If unsure, say N.
 
diff --git a/lib/test_bitops.c b/lib/test_bitops.c
index fd50b3ae4a14..702d5973a5b6 100644
--- a/lib/test_bitops.c
+++ b/lib/test_bitops.c
@@ -9,7 +9,11 @@
 #include <linux/module.h>
 #include <linux/printk.h>
 
-/* a tiny module only meant to test set/clear_bit */
+/* a tiny module only meant to test
+ *
+ *   set/clear_bit
+ *   get_count_order/long
+ */
 
 /* use an enum because thats the most common BITMAP usage */
 enum bitops_fun {
@@ -24,6 +28,26 @@ enum bitops_fun {
 
 static DECLARE_BITMAP(g_bitmap, BITOPS_LENGTH);
 
+unsigned int order_comb[][2] = {
+	{0x00000003,  2},
+	{0x00000004,  2},
+	{0x00001fff, 13},
+	{0x00002000, 13},
+	{0x50000000, 31},
+	{0x80000000, 31},
+	{0x80003000, 32},
+};
+
+unsigned long order_comb_long[][2] = {
+	{0x0000000300000000, 34},
+	{0x0000000400000000, 34},
+	{0x00001fff00000000, 45},
+	{0x0000200000000000, 45},
+	{0x5000000000000000, 63},
+	{0x8000000000000000, 63},
+	{0x8000300000000000, 64},
+};
+
 static int __init test_bitops_startup(void)
 {
 	pr_warn("Loaded test module\n");
@@ -32,6 +56,18 @@ static int __init test_bitops_startup(void)
 	set_bit(BITOPS_11, g_bitmap);
 	set_bit(BITOPS_31, g_bitmap);
 	set_bit(BITOPS_88, g_bitmap);
+
+	for (i = 0; i < ARRAY_SIZE(order_comb); i++) {
+		if (order_comb[i][1] != get_count_order(order_comb[i][0]))
+			pr_warn("get_count_order wrong for %x\n",
+				       order_comb[i][0]); }
+
+	for (i = 0; i < ARRAY_SIZE(order_comb_long); i++) {
+		if (order_comb_long[i][1] !=
+			       get_count_order_long(order_comb_long[i][0]))
+			pr_warn("get_count_order_long wrong for %lx\n",
+				       order_comb_long[i][0]); }
+
 	return 0;
 }
 
@@ -55,6 +91,6 @@ static void __exit test_bitops_unstartup(void)
 module_init(test_bitops_startup);
 module_exit(test_bitops_unstartup);
 
-MODULE_AUTHOR("Jesse Brandeburg <jesse.brandeburg@intel.com>");
+MODULE_AUTHOR("Jesse Brandeburg <jesse.brandeburg@intel.com>, Wei Yang <richard.weiyang@gmail.com>");
 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("Bit testing module");
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [Patch v2] lib: test get_count_order/long in test_bitops.c
  2020-06-02 22:37 [Patch v2] lib: test get_count_order/long in test_bitops.c Wei Yang
@ 2020-06-03  9:18 ` Andy Shevchenko
  2020-06-03 13:29   ` Wei Yang
  2020-06-04 11:50 ` Geert Uytterhoeven
  1 sibling, 1 reply; 15+ messages in thread
From: Andy Shevchenko @ 2020-06-03  9:18 UTC (permalink / raw)
  To: Wei Yang; +Cc: akpm, christian.brauner, linux-kernel

On Tue, Jun 02, 2020 at 10:37:28PM +0000, Wei Yang wrote:
> Add some test for get_count_order/long in test_bitops.c.

Thanks! LGTM,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Note, we can have as many MODULE_AUTHOR() lines as we want.

> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
> 
> ---
> v2: merge the test into test_bitops.c
> ---
>  lib/Kconfig.debug | 10 +++++-----
>  lib/test_bitops.c | 40 ++++++++++++++++++++++++++++++++++++++--
>  2 files changed, 43 insertions(+), 7 deletions(-)
> 
> diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> index f80d5609798f..512111a72e34 100644
> --- a/lib/Kconfig.debug
> +++ b/lib/Kconfig.debug
> @@ -1987,15 +1987,15 @@ config TEST_LKM
>  	  If unsure, say N.
>  
>  config TEST_BITOPS
> -	tristate "Test module for compilation of clear_bit/set_bit operations"
> +	tristate "Test module for compilation of bitops operations"
>  	depends on m
>  	help
>  	  This builds the "test_bitops" module that is much like the
>  	  TEST_LKM module except that it does a basic exercise of the
> -	  clear_bit and set_bit macros to make sure there are no compiler
> -	  warnings from C=1 sparse checker or -Wextra compilations. It has
> -	  no dependencies and doesn't run or load unless explicitly requested
> -	  by name.  for example: modprobe test_bitops.
> +	  set/clear_bit macros and get_count_order/long to make sure there are
> +	  no compiler warnings from C=1 sparse checker or -Wextra
> +	  compilations. It has no dependencies and doesn't run or load unless
> +	  explicitly requested by name.  for example: modprobe test_bitops.
>  
>  	  If unsure, say N.
>  
> diff --git a/lib/test_bitops.c b/lib/test_bitops.c
> index fd50b3ae4a14..702d5973a5b6 100644
> --- a/lib/test_bitops.c
> +++ b/lib/test_bitops.c
> @@ -9,7 +9,11 @@
>  #include <linux/module.h>
>  #include <linux/printk.h>
>  
> -/* a tiny module only meant to test set/clear_bit */
> +/* a tiny module only meant to test
> + *
> + *   set/clear_bit
> + *   get_count_order/long
> + */
>  
>  /* use an enum because thats the most common BITMAP usage */
>  enum bitops_fun {
> @@ -24,6 +28,26 @@ enum bitops_fun {
>  
>  static DECLARE_BITMAP(g_bitmap, BITOPS_LENGTH);
>  
> +unsigned int order_comb[][2] = {
> +	{0x00000003,  2},
> +	{0x00000004,  2},
> +	{0x00001fff, 13},
> +	{0x00002000, 13},
> +	{0x50000000, 31},
> +	{0x80000000, 31},
> +	{0x80003000, 32},
> +};
> +
> +unsigned long order_comb_long[][2] = {
> +	{0x0000000300000000, 34},
> +	{0x0000000400000000, 34},
> +	{0x00001fff00000000, 45},
> +	{0x0000200000000000, 45},
> +	{0x5000000000000000, 63},
> +	{0x8000000000000000, 63},
> +	{0x8000300000000000, 64},
> +};
> +
>  static int __init test_bitops_startup(void)
>  {
>  	pr_warn("Loaded test module\n");
> @@ -32,6 +56,18 @@ static int __init test_bitops_startup(void)
>  	set_bit(BITOPS_11, g_bitmap);
>  	set_bit(BITOPS_31, g_bitmap);
>  	set_bit(BITOPS_88, g_bitmap);
> +
> +	for (i = 0; i < ARRAY_SIZE(order_comb); i++) {
> +		if (order_comb[i][1] != get_count_order(order_comb[i][0]))
> +			pr_warn("get_count_order wrong for %x\n",
> +				       order_comb[i][0]); }
> +
> +	for (i = 0; i < ARRAY_SIZE(order_comb_long); i++) {
> +		if (order_comb_long[i][1] !=
> +			       get_count_order_long(order_comb_long[i][0]))
> +			pr_warn("get_count_order_long wrong for %lx\n",
> +				       order_comb_long[i][0]); }
> +
>  	return 0;
>  }
>  
> @@ -55,6 +91,6 @@ static void __exit test_bitops_unstartup(void)
>  module_init(test_bitops_startup);
>  module_exit(test_bitops_unstartup);
>  
> -MODULE_AUTHOR("Jesse Brandeburg <jesse.brandeburg@intel.com>");
> +MODULE_AUTHOR("Jesse Brandeburg <jesse.brandeburg@intel.com>, Wei Yang <richard.weiyang@gmail.com>");
>  MODULE_LICENSE("GPL");
>  MODULE_DESCRIPTION("Bit testing module");
> -- 
> 2.23.0
> 

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Patch v2] lib: test get_count_order/long in test_bitops.c
  2020-06-03  9:18 ` Andy Shevchenko
@ 2020-06-03 13:29   ` Wei Yang
  0 siblings, 0 replies; 15+ messages in thread
From: Wei Yang @ 2020-06-03 13:29 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Wei Yang, akpm, christian.brauner, linux-kernel

On Wed, Jun 03, 2020 at 12:18:02PM +0300, Andy Shevchenko wrote:
>On Tue, Jun 02, 2020 at 10:37:28PM +0000, Wei Yang wrote:
>> Add some test for get_count_order/long in test_bitops.c.
>
>Thanks! LGTM,
>Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>
>Note, we can have as many MODULE_AUTHOR() lines as we want.
>

Ah, got it.

>> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
>> 
>> ---
>> v2: merge the test into test_bitops.c
>> ---
>>  lib/Kconfig.debug | 10 +++++-----
>>  lib/test_bitops.c | 40 ++++++++++++++++++++++++++++++++++++++--
>>  2 files changed, 43 insertions(+), 7 deletions(-)
>> 
>> diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
>> index f80d5609798f..512111a72e34 100644
>> --- a/lib/Kconfig.debug
>> +++ b/lib/Kconfig.debug
>> @@ -1987,15 +1987,15 @@ config TEST_LKM
>>  	  If unsure, say N.
>>  
>>  config TEST_BITOPS
>> -	tristate "Test module for compilation of clear_bit/set_bit operations"
>> +	tristate "Test module for compilation of bitops operations"
>>  	depends on m
>>  	help
>>  	  This builds the "test_bitops" module that is much like the
>>  	  TEST_LKM module except that it does a basic exercise of the
>> -	  clear_bit and set_bit macros to make sure there are no compiler
>> -	  warnings from C=1 sparse checker or -Wextra compilations. It has
>> -	  no dependencies and doesn't run or load unless explicitly requested
>> -	  by name.  for example: modprobe test_bitops.
>> +	  set/clear_bit macros and get_count_order/long to make sure there are
>> +	  no compiler warnings from C=1 sparse checker or -Wextra
>> +	  compilations. It has no dependencies and doesn't run or load unless
>> +	  explicitly requested by name.  for example: modprobe test_bitops.
>>  
>>  	  If unsure, say N.
>>  
>> diff --git a/lib/test_bitops.c b/lib/test_bitops.c
>> index fd50b3ae4a14..702d5973a5b6 100644
>> --- a/lib/test_bitops.c
>> +++ b/lib/test_bitops.c
>> @@ -9,7 +9,11 @@
>>  #include <linux/module.h>
>>  #include <linux/printk.h>
>>  
>> -/* a tiny module only meant to test set/clear_bit */
>> +/* a tiny module only meant to test
>> + *
>> + *   set/clear_bit
>> + *   get_count_order/long
>> + */
>>  
>>  /* use an enum because thats the most common BITMAP usage */
>>  enum bitops_fun {
>> @@ -24,6 +28,26 @@ enum bitops_fun {
>>  
>>  static DECLARE_BITMAP(g_bitmap, BITOPS_LENGTH);
>>  
>> +unsigned int order_comb[][2] = {
>> +	{0x00000003,  2},
>> +	{0x00000004,  2},
>> +	{0x00001fff, 13},
>> +	{0x00002000, 13},
>> +	{0x50000000, 31},
>> +	{0x80000000, 31},
>> +	{0x80003000, 32},
>> +};
>> +
>> +unsigned long order_comb_long[][2] = {
>> +	{0x0000000300000000, 34},
>> +	{0x0000000400000000, 34},
>> +	{0x00001fff00000000, 45},
>> +	{0x0000200000000000, 45},
>> +	{0x5000000000000000, 63},
>> +	{0x8000000000000000, 63},
>> +	{0x8000300000000000, 64},
>> +};
>> +
>>  static int __init test_bitops_startup(void)
>>  {
>>  	pr_warn("Loaded test module\n");
>> @@ -32,6 +56,18 @@ static int __init test_bitops_startup(void)
>>  	set_bit(BITOPS_11, g_bitmap);
>>  	set_bit(BITOPS_31, g_bitmap);
>>  	set_bit(BITOPS_88, g_bitmap);
>> +
>> +	for (i = 0; i < ARRAY_SIZE(order_comb); i++) {
>> +		if (order_comb[i][1] != get_count_order(order_comb[i][0]))
>> +			pr_warn("get_count_order wrong for %x\n",
>> +				       order_comb[i][0]); }
>> +
>> +	for (i = 0; i < ARRAY_SIZE(order_comb_long); i++) {
>> +		if (order_comb_long[i][1] !=
>> +			       get_count_order_long(order_comb_long[i][0]))
>> +			pr_warn("get_count_order_long wrong for %lx\n",
>> +				       order_comb_long[i][0]); }
>> +
>>  	return 0;
>>  }
>>  
>> @@ -55,6 +91,6 @@ static void __exit test_bitops_unstartup(void)
>>  module_init(test_bitops_startup);
>>  module_exit(test_bitops_unstartup);
>>  
>> -MODULE_AUTHOR("Jesse Brandeburg <jesse.brandeburg@intel.com>");
>> +MODULE_AUTHOR("Jesse Brandeburg <jesse.brandeburg@intel.com>, Wei Yang <richard.weiyang@gmail.com>");
>>  MODULE_LICENSE("GPL");
>>  MODULE_DESCRIPTION("Bit testing module");
>> -- 
>> 2.23.0
>> 
>
>-- 
>With Best Regards,
>Andy Shevchenko
>

-- 
Wei Yang
Help you, Help me

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Patch v2] lib: test get_count_order/long in test_bitops.c
  2020-06-02 22:37 [Patch v2] lib: test get_count_order/long in test_bitops.c Wei Yang
  2020-06-03  9:18 ` Andy Shevchenko
@ 2020-06-04 11:50 ` Geert Uytterhoeven
  2020-06-04 12:28   ` Wei Yang
  1 sibling, 1 reply; 15+ messages in thread
From: Geert Uytterhoeven @ 2020-06-04 11:50 UTC (permalink / raw)
  To: Wei Yang
  Cc: Andrew Morton, Andy Shevchenko, Christian Brauner,
	Linux Kernel Mailing List

Hi Wei,

On Wed, Jun 3, 2020 at 1:11 AM Wei Yang <richard.weiyang@gmail.com> wrote:
> Add some test for get_count_order/long in test_bitops.c.
>
> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>

Thanks for your patch, which is now commit 7851d6639caeea40 ("lib:
test get_count_order/long in test_bitops.c") in linux-next.

> --- a/lib/test_bitops.c
> +++ b/lib/test_bitops.c

> @@ -24,6 +28,26 @@ enum bitops_fun {
>
>  static DECLARE_BITMAP(g_bitmap, BITOPS_LENGTH);
>
> +unsigned int order_comb[][2] = {
> +       {0x00000003,  2},
> +       {0x00000004,  2},
> +       {0x00001fff, 13},
> +       {0x00002000, 13},
> +       {0x50000000, 31},
> +       {0x80000000, 31},
> +       {0x80003000, 32},
> +};
> +
> +unsigned long order_comb_long[][2] = {
> +       {0x0000000300000000, 34},
> +       {0x0000000400000000, 34},
> +       {0x00001fff00000000, 45},
> +       {0x0000200000000000, 45},
> +       {0x5000000000000000, 63},
> +       {0x8000000000000000, 63},
> +       {0x8000300000000000, 64},
> +};

noreply@ellerman.id.au reported for m68k-allmodconfig:

lib/test_bitops.c:42:3: error: unsigned conversion from 'long long
int' to 'long unsigned int' changes value from '12884901888' to '0'
[-Werror=overflow]
lib/test_bitops.c:43:3: error: unsigned conversion from 'long long
int' to 'long unsigned int' changes value from '17179869184' to '0'
[-Werror=overflow]
lib/test_bitops.c:44:3: error: unsigned conversion from 'long long
int' to 'long unsigned int' changes value from '35180077121536' to '0'
[-Werror=overflow]
lib/test_bitops.c:45:3: error: unsigned conversion from 'long long
int' to 'long unsigned int' changes value from '35184372088832' to '0'
[-Werror=overflow]
lib/test_bitops.c:46:3: error: unsigned conversion from 'long long
int' to 'long unsigned int' changes value from '5764607523034234880'
to '0' [-Werror=overflow]
lib/test_bitops.c:47:3: error: conversion from 'long long unsigned
int' to 'long unsigned int' changes value from '9223372036854775808'
to '0' [-Werror=overflow]
lib/test_bitops.c:48:3: error: conversion from 'long long unsigned
int' to 'long unsigned int' changes value from '9223424813412909056'
to '0' [-Werror=overflow]

Indeed, on 32-bit, none of these values fit in unsigned long.

>  static int __init test_bitops_startup(void)
>  {
>         pr_warn("Loaded test module\n");
> @@ -32,6 +56,18 @@ static int __init test_bitops_startup(void)
>         set_bit(BITOPS_11, g_bitmap);
>         set_bit(BITOPS_31, g_bitmap);
>         set_bit(BITOPS_88, g_bitmap);
> +
> +       for (i = 0; i < ARRAY_SIZE(order_comb); i++) {
> +               if (order_comb[i][1] != get_count_order(order_comb[i][0]))
> +                       pr_warn("get_count_order wrong for %x\n",
> +                                      order_comb[i][0]); }
> +
> +       for (i = 0; i < ARRAY_SIZE(order_comb_long); i++) {
> +               if (order_comb_long[i][1] !=
> +                              get_count_order_long(order_comb_long[i][0]))
> +                       pr_warn("get_count_order_long wrong for %lx\n",
> +                                      order_comb_long[i][0]); }
> +
>         return 0;

BTW, shouldn't get_count_order_long() be tested with the values in
order_comb[], too?

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Patch v2] lib: test get_count_order/long in test_bitops.c
  2020-06-04 11:50 ` Geert Uytterhoeven
@ 2020-06-04 12:28   ` Wei Yang
  2020-06-04 12:51     ` Geert Uytterhoeven
  0 siblings, 1 reply; 15+ messages in thread
From: Wei Yang @ 2020-06-04 12:28 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Wei Yang, Andrew Morton, Andy Shevchenko, Christian Brauner,
	Linux Kernel Mailing List

On Thu, Jun 04, 2020 at 01:50:13PM +0200, Geert Uytterhoeven wrote:
>Hi Wei,
>
>On Wed, Jun 3, 2020 at 1:11 AM Wei Yang <richard.weiyang@gmail.com> wrote:
>> Add some test for get_count_order/long in test_bitops.c.
>>
>> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
>
>Thanks for your patch, which is now commit 7851d6639caeea40 ("lib:
>test get_count_order/long in test_bitops.c") in linux-next.
>
>> --- a/lib/test_bitops.c
>> +++ b/lib/test_bitops.c
>
>> @@ -24,6 +28,26 @@ enum bitops_fun {
>>
>>  static DECLARE_BITMAP(g_bitmap, BITOPS_LENGTH);
>>
>> +unsigned int order_comb[][2] = {
>> +       {0x00000003,  2},
>> +       {0x00000004,  2},
>> +       {0x00001fff, 13},
>> +       {0x00002000, 13},
>> +       {0x50000000, 31},
>> +       {0x80000000, 31},
>> +       {0x80003000, 32},
>> +};
>> +
>> +unsigned long order_comb_long[][2] = {
>> +       {0x0000000300000000, 34},
>> +       {0x0000000400000000, 34},
>> +       {0x00001fff00000000, 45},
>> +       {0x0000200000000000, 45},
>> +       {0x5000000000000000, 63},
>> +       {0x8000000000000000, 63},
>> +       {0x8000300000000000, 64},
>> +};
>
>noreply@ellerman.id.au reported for m68k-allmodconfig:
>
>lib/test_bitops.c:42:3: error: unsigned conversion from 'long long
>int' to 'long unsigned int' changes value from '12884901888' to '0'
>[-Werror=overflow]
>lib/test_bitops.c:43:3: error: unsigned conversion from 'long long
>int' to 'long unsigned int' changes value from '17179869184' to '0'
>[-Werror=overflow]
>lib/test_bitops.c:44:3: error: unsigned conversion from 'long long
>int' to 'long unsigned int' changes value from '35180077121536' to '0'
>[-Werror=overflow]
>lib/test_bitops.c:45:3: error: unsigned conversion from 'long long
>int' to 'long unsigned int' changes value from '35184372088832' to '0'
>[-Werror=overflow]
>lib/test_bitops.c:46:3: error: unsigned conversion from 'long long
>int' to 'long unsigned int' changes value from '5764607523034234880'
>to '0' [-Werror=overflow]
>lib/test_bitops.c:47:3: error: conversion from 'long long unsigned
>int' to 'long unsigned int' changes value from '9223372036854775808'
>to '0' [-Werror=overflow]
>lib/test_bitops.c:48:3: error: conversion from 'long long unsigned
>int' to 'long unsigned int' changes value from '9223424813412909056'
>to '0' [-Werror=overflow]
>
>Indeed, on 32-bit, none of these values fit in unsigned long.
>

Hmm... I didn't test on 32bit platform. Sorry for that.

>>  static int __init test_bitops_startup(void)
>>  {
>>         pr_warn("Loaded test module\n");
>> @@ -32,6 +56,18 @@ static int __init test_bitops_startup(void)
>>         set_bit(BITOPS_11, g_bitmap);
>>         set_bit(BITOPS_31, g_bitmap);
>>         set_bit(BITOPS_88, g_bitmap);
>> +
>> +       for (i = 0; i < ARRAY_SIZE(order_comb); i++) {
>> +               if (order_comb[i][1] != get_count_order(order_comb[i][0]))
>> +                       pr_warn("get_count_order wrong for %x\n",
>> +                                      order_comb[i][0]); }
>> +
>> +       for (i = 0; i < ARRAY_SIZE(order_comb_long); i++) {
>> +               if (order_comb_long[i][1] !=
>> +                              get_count_order_long(order_comb_long[i][0]))
>> +                       pr_warn("get_count_order_long wrong for %lx\n",
>> +                                      order_comb_long[i][0]); }
>> +
>>         return 0;
>
>BTW, shouldn't get_count_order_long() be tested with the values in
>order_comb[], too?
>

You mean 

       {0x0000000000000003,  2},
       {0x0000000000000004,  2},
       {0x0000000000001fff, 13},
       {0x0000000000002000, 13},
       {0x0000000050000000, 31},
       {0x0000000080000000, 31},
       {0x0000000080003000, 32},

>Gr{oetje,eeting}s,
>
>                        Geert
>
>-- 
>Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
>In personal conversations with technical people, I call myself a hacker. But
>when I'm talking to journalists I just say "programmer" or something like that.
>                                -- Linus Torvalds

-- 
Wei Yang
Help you, Help me

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Patch v2] lib: test get_count_order/long in test_bitops.c
  2020-06-04 12:28   ` Wei Yang
@ 2020-06-04 12:51     ` Geert Uytterhoeven
  2020-06-05 23:06       ` Wei Yang
  0 siblings, 1 reply; 15+ messages in thread
From: Geert Uytterhoeven @ 2020-06-04 12:51 UTC (permalink / raw)
  To: Wei Yang
  Cc: Andrew Morton, Andy Shevchenko, Christian Brauner,
	Linux Kernel Mailing List

Hi Wei,

On Thu, Jun 4, 2020 at 2:28 PM Wei Yang <richard.weiyang@gmail.com> wrote:
> On Thu, Jun 04, 2020 at 01:50:13PM +0200, Geert Uytterhoeven wrote:
> >On Wed, Jun 3, 2020 at 1:11 AM Wei Yang <richard.weiyang@gmail.com> wrote:
> >> Add some test for get_count_order/long in test_bitops.c.
> >>
> >> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
> >
> >Thanks for your patch, which is now commit 7851d6639caeea40 ("lib:
> >test get_count_order/long in test_bitops.c") in linux-next.
> >
> >> --- a/lib/test_bitops.c
> >> +++ b/lib/test_bitops.c
> >
> >> @@ -24,6 +28,26 @@ enum bitops_fun {
> >>
> >>  static DECLARE_BITMAP(g_bitmap, BITOPS_LENGTH);
> >>
> >> +unsigned int order_comb[][2] = {
> >> +       {0x00000003,  2},
> >> +       {0x00000004,  2},
> >> +       {0x00001fff, 13},
> >> +       {0x00002000, 13},
> >> +       {0x50000000, 31},
> >> +       {0x80000000, 31},
> >> +       {0x80003000, 32},
> >> +};
> >> +
> >> +unsigned long order_comb_long[][2] = {
> >> +       {0x0000000300000000, 34},
> >> +       {0x0000000400000000, 34},
> >> +       {0x00001fff00000000, 45},
> >> +       {0x0000200000000000, 45},
> >> +       {0x5000000000000000, 63},
> >> +       {0x8000000000000000, 63},
> >> +       {0x8000300000000000, 64},
> >> +};
> >
> >noreply@ellerman.id.au reported for m68k-allmodconfig:
> >
> >lib/test_bitops.c:42:3: error: unsigned conversion from 'long long
> >int' to 'long unsigned int' changes value from '12884901888' to '0'
> >[-Werror=overflow]
> >lib/test_bitops.c:43:3: error: unsigned conversion from 'long long
> >int' to 'long unsigned int' changes value from '17179869184' to '0'
> >[-Werror=overflow]
> >lib/test_bitops.c:44:3: error: unsigned conversion from 'long long
> >int' to 'long unsigned int' changes value from '35180077121536' to '0'
> >[-Werror=overflow]
> >lib/test_bitops.c:45:3: error: unsigned conversion from 'long long
> >int' to 'long unsigned int' changes value from '35184372088832' to '0'
> >[-Werror=overflow]
> >lib/test_bitops.c:46:3: error: unsigned conversion from 'long long
> >int' to 'long unsigned int' changes value from '5764607523034234880'
> >to '0' [-Werror=overflow]
> >lib/test_bitops.c:47:3: error: conversion from 'long long unsigned
> >int' to 'long unsigned int' changes value from '9223372036854775808'
> >to '0' [-Werror=overflow]
> >lib/test_bitops.c:48:3: error: conversion from 'long long unsigned
> >int' to 'long unsigned int' changes value from '9223424813412909056'
> >to '0' [-Werror=overflow]
> >
> >Indeed, on 32-bit, none of these values fit in unsigned long.
> >
>
> Hmm... I didn't test on 32bit platform. Sorry for that.
>
> >>  static int __init test_bitops_startup(void)
> >>  {
> >>         pr_warn("Loaded test module\n");
> >> @@ -32,6 +56,18 @@ static int __init test_bitops_startup(void)
> >>         set_bit(BITOPS_11, g_bitmap);
> >>         set_bit(BITOPS_31, g_bitmap);
> >>         set_bit(BITOPS_88, g_bitmap);
> >> +
> >> +       for (i = 0; i < ARRAY_SIZE(order_comb); i++) {
> >> +               if (order_comb[i][1] != get_count_order(order_comb[i][0]))
> >> +                       pr_warn("get_count_order wrong for %x\n",
> >> +                                      order_comb[i][0]); }
> >> +
> >> +       for (i = 0; i < ARRAY_SIZE(order_comb_long); i++) {
> >> +               if (order_comb_long[i][1] !=
> >> +                              get_count_order_long(order_comb_long[i][0]))
> >> +                       pr_warn("get_count_order_long wrong for %lx\n",
> >> +                                      order_comb_long[i][0]); }
> >> +
> >>         return 0;
> >
> >BTW, shouldn't get_count_order_long() be tested with the values in
> >order_comb[], too?
> >
>
> You mean
>
>        {0x0000000000000003,  2},
>        {0x0000000000000004,  2},
>        {0x0000000000001fff, 13},
>        {0x0000000000002000, 13},
>        {0x0000000050000000, 31},
>        {0x0000000080000000, 31},
>        {0x0000000080003000, 32},

Yes, those values.  And those should work with get_count_order_long()
on both 32-bit and 64-bit.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Patch v2] lib: test get_count_order/long in test_bitops.c
  2020-06-04 12:51     ` Geert Uytterhoeven
@ 2020-06-05 23:06       ` Wei Yang
  2020-06-06  0:16         ` Andrew Morton
  0 siblings, 1 reply; 15+ messages in thread
From: Wei Yang @ 2020-06-05 23:06 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Wei Yang, Andrew Morton, Andy Shevchenko, Christian Brauner,
	Linux Kernel Mailing List

On Thu, Jun 04, 2020 at 02:51:40PM +0200, Geert Uytterhoeven wrote:
>Hi Wei,
>
>On Thu, Jun 4, 2020 at 2:28 PM Wei Yang <richard.weiyang@gmail.com> wrote:
[...]
>>
>> You mean
>>
>>        {0x0000000000000003,  2},
>>        {0x0000000000000004,  2},
>>        {0x0000000000001fff, 13},
>>        {0x0000000000002000, 13},
>>        {0x0000000050000000, 31},
>>        {0x0000000080000000, 31},
>>        {0x0000000080003000, 32},
>
>Yes, those values.  And those should work with get_count_order_long()
>on both 32-bit and 64-bit.

Hi, Geert

To be frank, I am afraid I lack some of the skill to achieve this. Maybe you
could give some guide.

get_count_order_long() takes one parameter, which is of type unsigned long.
This one has different size on 32bit and 64bit platform. On 32bit platform,
those value would be truncated.

Would you mind giving me a hint on this?

What we may achieve is like the implementation of fls_long(). This one check
the size of unsigned long on running, and choose different function. We could
use ifdef to check the size of unsigned long and use different data to feed
get_count_order_long(). But I don't find a way to feed get_count_order_long()
with 64bit data on 32bit platform.

>
>Gr{oetje,eeting}s,
>
>                        Geert
>
>-- 
>Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
>In personal conversations with technical people, I call myself a hacker. But
>when I'm talking to journalists I just say "programmer" or something like that.
>                                -- Linus Torvalds

-- 
Wei Yang
Help you, Help me

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Patch v2] lib: test get_count_order/long in test_bitops.c
  2020-06-05 23:06       ` Wei Yang
@ 2020-06-06  0:16         ` Andrew Morton
  2020-06-08 22:31           ` Wei Yang
  0 siblings, 1 reply; 15+ messages in thread
From: Andrew Morton @ 2020-06-06  0:16 UTC (permalink / raw)
  To: Wei Yang
  Cc: Geert Uytterhoeven, Andy Shevchenko, Christian Brauner,
	Linux Kernel Mailing List

On Fri, 5 Jun 2020 23:06:10 +0000 Wei Yang <richard.weiyang@gmail.com> wrote:

> On Thu, Jun 04, 2020 at 02:51:40PM +0200, Geert Uytterhoeven wrote:
> >Hi Wei,
> >
> >On Thu, Jun 4, 2020 at 2:28 PM Wei Yang <richard.weiyang@gmail.com> wrote:
> [...]
> >>
> >> You mean
> >>
> >>        {0x0000000000000003,  2},
> >>        {0x0000000000000004,  2},
> >>        {0x0000000000001fff, 13},
> >>        {0x0000000000002000, 13},
> >>        {0x0000000050000000, 31},
> >>        {0x0000000080000000, 31},
> >>        {0x0000000080003000, 32},
> >
> >Yes, those values.  And those should work with get_count_order_long()
> >on both 32-bit and 64-bit.

Geert meant "no, the values in order_comb[]" :)

We have a table of numbers in order_comb[] so we may as well feed them
into get_count_order_long() (as well as get_count_order()) just for a
bit more testing.

So how about the below?  order_comb_long[] just can't be used on 32-bit
machines because their longs are 32-bit.  If we had a
get_count_order_u64() then we could use it.

I haven't runtime tested this - could you please do so?


static unsigned int order_comb[][2] = {
	{0x00000003,  2},
	{0x00000004,  2},
	{0x00001fff, 13},
	{0x00002000, 13},
	{0x50000000, 31},
	{0x80000000, 31},
	{0x80003000, 32},
};

#ifdef CONFIG_64BIT
static unsigned long order_comb_long[][2] = {
	{0x0000000300000000, 34},
	{0x0000000400000000, 34},
	{0x00001fff00000000, 45},
	{0x0000200000000000, 45},
	{0x5000000000000000, 63},
	{0x8000000000000000, 63},
	{0x8000300000000000, 64},
};
#endif

static int __init test_bitops_startup(void)
{
	int i;

	pr_warn("Loaded test module\n");
	set_bit(BITOPS_4, g_bitmap);
	set_bit(BITOPS_7, g_bitmap);
	set_bit(BITOPS_11, g_bitmap);
	set_bit(BITOPS_31, g_bitmap);
	set_bit(BITOPS_88, g_bitmap);

	for (i = 0; i < ARRAY_SIZE(order_comb); i++) {
		if (order_comb[i][1] != get_count_order(order_comb[i][0]))
			pr_warn("get_count_order wrong for %x\n",
				       order_comb[i][0]);
	}

	for (i = 0; i < ARRAY_SIZE(order_comb); i++) {
		if (order_comb[i][1] != get_count_order_long(order_comb[i][0]))
			pr_warn("get_count_order_long wrong for %x\n",
				       order_comb[i][0]);
	}

#ifdef CONFIG_64BIT
	for (i = 0; i < ARRAY_SIZE(order_comb); i++) {
		if (order_comb_long[i][1] !=
			       get_count_order_long(order_comb_long[i][0]))
			pr_warn("get_count_order_long wrong for %lx\n",
				       order_comb_long[i][0]);
	}
#endif
	return 0;
}


From: Andrew Morton <akpm@linux-foundation.org>
Subject: lib-test-get_count_order-long-in-test_bitopsc-fix

Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Christian Brauner <christian.brauner@ubuntu.com>
Cc: Wei Yang <richard.weiyang@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 lib/test_bitops.c |   23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

--- a/lib/test_bitops.c~lib-test-get_count_order-long-in-test_bitopsc-fix
+++ a/lib/test_bitops.c
@@ -28,7 +28,7 @@ enum bitops_fun {
 
 static DECLARE_BITMAP(g_bitmap, BITOPS_LENGTH);
 
-unsigned int order_comb[][2] = {
+static unsigned int order_comb[][2] = {
 	{0x00000003,  2},
 	{0x00000004,  2},
 	{0x00001fff, 13},
@@ -38,7 +38,8 @@ unsigned int order_comb[][2] = {
 	{0x80003000, 32},
 };
 
-unsigned long order_comb_long[][2] = {
+#ifdef CONFIG_64BIT
+static unsigned long order_comb_long[][2] = {
 	{0x0000000300000000, 34},
 	{0x0000000400000000, 34},
 	{0x00001fff00000000, 45},
@@ -47,6 +48,7 @@ unsigned long order_comb_long[][2] = {
 	{0x8000000000000000, 63},
 	{0x8000300000000000, 64},
 };
+#endif
 
 static int __init test_bitops_startup(void)
 {
@@ -62,14 +64,23 @@ static int __init test_bitops_startup(vo
 	for (i = 0; i < ARRAY_SIZE(order_comb); i++) {
 		if (order_comb[i][1] != get_count_order(order_comb[i][0]))
 			pr_warn("get_count_order wrong for %x\n",
-				       order_comb[i][0]); }
+				       order_comb[i][0]);
+	}
 
-	for (i = 0; i < ARRAY_SIZE(order_comb_long); i++) {
+	for (i = 0; i < ARRAY_SIZE(order_comb); i++) {
+		if (order_comb[i][1] != get_count_order_long(order_comb[i][0]))
+			pr_warn("get_count_order_long wrong for %x\n",
+				       order_comb[i][0]);
+	}
+
+#ifdef CONFIG_64BIT
+	for (i = 0; i < ARRAY_SIZE(order_comb); i++) {
 		if (order_comb_long[i][1] !=
 			       get_count_order_long(order_comb_long[i][0]))
 			pr_warn("get_count_order_long wrong for %lx\n",
-				       order_comb_long[i][0]); }
-
+				       order_comb_long[i][0]);
+	}
+#endif
 	return 0;
 }
 
_


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Patch v2] lib: test get_count_order/long in test_bitops.c
  2020-06-06  0:16         ` Andrew Morton
@ 2020-06-08 22:31           ` Wei Yang
  2020-06-09  9:16             ` Andy Shevchenko
  0 siblings, 1 reply; 15+ messages in thread
From: Wei Yang @ 2020-06-08 22:31 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Wei Yang, Geert Uytterhoeven, Andy Shevchenko, Christian Brauner,
	Linux Kernel Mailing List

On Fri, Jun 05, 2020 at 05:16:29PM -0700, Andrew Morton wrote:
>On Fri, 5 Jun 2020 23:06:10 +0000 Wei Yang <richard.weiyang@gmail.com> wrote:
>
>> On Thu, Jun 04, 2020 at 02:51:40PM +0200, Geert Uytterhoeven wrote:
>> >Hi Wei,
>> >
>> >On Thu, Jun 4, 2020 at 2:28 PM Wei Yang <richard.weiyang@gmail.com> wrote:
>> [...]
>> >>
>> >> You mean
>> >>
>> >>        {0x0000000000000003,  2},
>> >>        {0x0000000000000004,  2},
>> >>        {0x0000000000001fff, 13},
>> >>        {0x0000000000002000, 13},
>> >>        {0x0000000050000000, 31},
>> >>        {0x0000000080000000, 31},
>> >>        {0x0000000080003000, 32},
>> >
>> >Yes, those values.  And those should work with get_count_order_long()
>> >on both 32-bit and 64-bit.
>
>Geert meant "no, the values in order_comb[]" :)
>
>We have a table of numbers in order_comb[] so we may as well feed them
>into get_count_order_long() (as well as get_count_order()) just for a
>bit more testing.
>
>So how about the below?  order_comb_long[] just can't be used on 32-bit
>machines because their longs are 32-bit.  If we had a
>get_count_order_u64() then we could use it.
>
>I haven't runtime tested this - could you please do so?
>
>
>static unsigned int order_comb[][2] = {
>	{0x00000003,  2},
>	{0x00000004,  2},
>	{0x00001fff, 13},
>	{0x00002000, 13},
>	{0x50000000, 31},
>	{0x80000000, 31},
>	{0x80003000, 32},
>};
>
>#ifdef CONFIG_64BIT
>static unsigned long order_comb_long[][2] = {
>	{0x0000000300000000, 34},
>	{0x0000000400000000, 34},
>	{0x00001fff00000000, 45},
>	{0x0000200000000000, 45},
>	{0x5000000000000000, 63},
>	{0x8000000000000000, 63},
>	{0x8000300000000000, 64},
>};
>#endif
>
>static int __init test_bitops_startup(void)
>{
>	int i;
>
>	pr_warn("Loaded test module\n");
>	set_bit(BITOPS_4, g_bitmap);
>	set_bit(BITOPS_7, g_bitmap);
>	set_bit(BITOPS_11, g_bitmap);
>	set_bit(BITOPS_31, g_bitmap);
>	set_bit(BITOPS_88, g_bitmap);
>
>	for (i = 0; i < ARRAY_SIZE(order_comb); i++) {
>		if (order_comb[i][1] != get_count_order(order_comb[i][0]))
>			pr_warn("get_count_order wrong for %x\n",
>				       order_comb[i][0]);
>	}
>
>	for (i = 0; i < ARRAY_SIZE(order_comb); i++) {
>		if (order_comb[i][1] != get_count_order_long(order_comb[i][0]))
>			pr_warn("get_count_order_long wrong for %x\n",
>				       order_comb[i][0]);
>	}
>
>#ifdef CONFIG_64BIT
>	for (i = 0; i < ARRAY_SIZE(order_comb); i++) {
>		if (order_comb_long[i][1] !=
>			       get_count_order_long(order_comb_long[i][0]))
>			pr_warn("get_count_order_long wrong for %lx\n",
>				       order_comb_long[i][0]);
>	}
>#endif
>	return 0;
>}
>
>
>From: Andrew Morton <akpm@linux-foundation.org>
>Subject: lib-test-get_count_order-long-in-test_bitopsc-fix
>
>Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>Cc: Christian Brauner <christian.brauner@ubuntu.com>
>Cc: Wei Yang <richard.weiyang@gmail.com>
>Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
>---
>
> lib/test_bitops.c |   23 +++++++++++++++++------
> 1 file changed, 17 insertions(+), 6 deletions(-)
>
>--- a/lib/test_bitops.c~lib-test-get_count_order-long-in-test_bitopsc-fix
>+++ a/lib/test_bitops.c
>@@ -28,7 +28,7 @@ enum bitops_fun {
> 
> static DECLARE_BITMAP(g_bitmap, BITOPS_LENGTH);
> 
>-unsigned int order_comb[][2] = {
>+static unsigned int order_comb[][2] = {
> 	{0x00000003,  2},
> 	{0x00000004,  2},
> 	{0x00001fff, 13},
>@@ -38,7 +38,8 @@ unsigned int order_comb[][2] = {
> 	{0x80003000, 32},
> };
> 
>-unsigned long order_comb_long[][2] = {
>+#ifdef CONFIG_64BIT
>+static unsigned long order_comb_long[][2] = {
> 	{0x0000000300000000, 34},
> 	{0x0000000400000000, 34},
> 	{0x00001fff00000000, 45},
>@@ -47,6 +48,7 @@ unsigned long order_comb_long[][2] = {
> 	{0x8000000000000000, 63},
> 	{0x8000300000000000, 64},
> };
>+#endif
> 
> static int __init test_bitops_startup(void)
> {
>@@ -62,14 +64,23 @@ static int __init test_bitops_startup(vo
> 	for (i = 0; i < ARRAY_SIZE(order_comb); i++) {
> 		if (order_comb[i][1] != get_count_order(order_comb[i][0]))
> 			pr_warn("get_count_order wrong for %x\n",
>-				       order_comb[i][0]); }
>+				       order_comb[i][0]);
>+	}
> 
>-	for (i = 0; i < ARRAY_SIZE(order_comb_long); i++) {
>+	for (i = 0; i < ARRAY_SIZE(order_comb); i++) {
>+		if (order_comb[i][1] != get_count_order_long(order_comb[i][0]))
>+			pr_warn("get_count_order_long wrong for %x\n",
>+				       order_comb[i][0]);
>+	}
>+
>+#ifdef CONFIG_64BIT
>+	for (i = 0; i < ARRAY_SIZE(order_comb); i++) {
                                   ^
I am afraid this one should be order_comb_long?

The test on 64bit machine pass. Since I don't have a 32bit machine by hand, 
Geert, would you mind have a try on 32bit machine? 

> 		if (order_comb_long[i][1] !=
> 			       get_count_order_long(order_comb_long[i][0]))
> 			pr_warn("get_count_order_long wrong for %lx\n",
>-				       order_comb_long[i][0]); }
>-
>+				       order_comb_long[i][0]);
>+	}
>+#endif
> 	return 0;
> }
> 
>_

-- 
Wei Yang
Help you, Help me

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Patch v2] lib: test get_count_order/long in test_bitops.c
  2020-06-08 22:31           ` Wei Yang
@ 2020-06-09  9:16             ` Andy Shevchenko
  2020-06-09 23:02               ` Wei Yang
  0 siblings, 1 reply; 15+ messages in thread
From: Andy Shevchenko @ 2020-06-09  9:16 UTC (permalink / raw)
  To: Wei Yang
  Cc: Andrew Morton, Geert Uytterhoeven, Christian Brauner,
	Linux Kernel Mailing List

On Mon, Jun 08, 2020 at 10:31:12PM +0000, Wei Yang wrote:
> On Fri, Jun 05, 2020 at 05:16:29PM -0700, Andrew Morton wrote:

...

> The test on 64bit machine pass. Since I don't have a 32bit machine by hand, 

Out of curiosity what that machine is?

> Geert, would you mind have a try on 32bit machine? 

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Patch v2] lib: test get_count_order/long in test_bitops.c
  2020-06-09  9:16             ` Andy Shevchenko
@ 2020-06-09 23:02               ` Wei Yang
  2020-06-10 10:17                 ` Andy Shevchenko
  0 siblings, 1 reply; 15+ messages in thread
From: Wei Yang @ 2020-06-09 23:02 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Wei Yang, Andrew Morton, Geert Uytterhoeven, Christian Brauner,
	Linux Kernel Mailing List

On Tue, Jun 09, 2020 at 12:16:49PM +0300, Andy Shevchenko wrote:
>On Mon, Jun 08, 2020 at 10:31:12PM +0000, Wei Yang wrote:
>> On Fri, Jun 05, 2020 at 05:16:29PM -0700, Andrew Morton wrote:
>
>...
>
>> The test on 64bit machine pass. Since I don't have a 32bit machine by hand, 
>
>Out of curiosity what that machine is?
>

It is a Intel Xeon Gold CPU.

>> Geert, would you mind have a try on 32bit machine? 
>
>-- 
>With Best Regards,
>Andy Shevchenko
>

-- 
Wei Yang
Help you, Help me

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Patch v2] lib: test get_count_order/long in test_bitops.c
  2020-06-09 23:02               ` Wei Yang
@ 2020-06-10 10:17                 ` Andy Shevchenko
  2020-06-10 22:06                   ` Wei Yang
  0 siblings, 1 reply; 15+ messages in thread
From: Andy Shevchenko @ 2020-06-10 10:17 UTC (permalink / raw)
  To: Wei Yang
  Cc: Andy Shevchenko, Andrew Morton, Geert Uytterhoeven,
	Christian Brauner, Linux Kernel Mailing List

On Wed, Jun 10, 2020 at 2:06 AM Wei Yang <richard.weiyang@gmail.com> wrote:
> On Tue, Jun 09, 2020 at 12:16:49PM +0300, Andy Shevchenko wrote:
> >On Mon, Jun 08, 2020 at 10:31:12PM +0000, Wei Yang wrote:
> >> On Fri, Jun 05, 2020 at 05:16:29PM -0700, Andrew Morton wrote:
> >
> >...
> >
> >> The test on 64bit machine pass. Since I don't have a 32bit machine by hand,
> >
> >Out of curiosity what that machine is?
> >
>
> It is a Intel Xeon Gold CPU.

I suppose it's x86 (and not ia64).
In this case you can always build an i386 configuration and test on a
32-bit "machine".

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Patch v2] lib: test get_count_order/long in test_bitops.c
  2020-06-10 10:17                 ` Andy Shevchenko
@ 2020-06-10 22:06                   ` Wei Yang
  2020-06-11  7:25                     ` Andy Shevchenko
  0 siblings, 1 reply; 15+ messages in thread
From: Wei Yang @ 2020-06-10 22:06 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Wei Yang, Andy Shevchenko, Andrew Morton, Geert Uytterhoeven,
	Christian Brauner, Linux Kernel Mailing List

On Wed, Jun 10, 2020 at 01:17:28PM +0300, Andy Shevchenko wrote:
>On Wed, Jun 10, 2020 at 2:06 AM Wei Yang <richard.weiyang@gmail.com> wrote:
>> On Tue, Jun 09, 2020 at 12:16:49PM +0300, Andy Shevchenko wrote:
>> >On Mon, Jun 08, 2020 at 10:31:12PM +0000, Wei Yang wrote:
>> >> On Fri, Jun 05, 2020 at 05:16:29PM -0700, Andrew Morton wrote:
>> >
>> >...
>> >
>> >> The test on 64bit machine pass. Since I don't have a 32bit machine by hand,
>> >
>> >Out of curiosity what that machine is?
>> >
>>
>> It is a Intel Xeon Gold CPU.
>
>I suppose it's x86 (and not ia64).
>In this case you can always build an i386 configuration and test on a
>32-bit "machine".
>

Yes, you are right. While last time I tried to run a 32bit guest, it took me a
lot of time to setup. If my understanding is correct, to run on a 32bit
machine, we not only need the kernel but a whole 32bit system. This means I
need to re-install a 32bit system. And I found many distro doesn't support
32bit system any more.

Do you have a better way to setup the environment?


>-- 
>With Best Regards,
>Andy Shevchenko

-- 
Wei Yang
Help you, Help me

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Patch v2] lib: test get_count_order/long in test_bitops.c
  2020-06-10 22:06                   ` Wei Yang
@ 2020-06-11  7:25                     ` Andy Shevchenko
  2020-06-12 14:28                       ` Wei Yang
  0 siblings, 1 reply; 15+ messages in thread
From: Andy Shevchenko @ 2020-06-11  7:25 UTC (permalink / raw)
  To: Wei Yang
  Cc: Andy Shevchenko, Andrew Morton, Geert Uytterhoeven,
	Christian Brauner, Linux Kernel Mailing List

On Thu, Jun 11, 2020 at 1:06 AM Wei Yang <richard.weiyang@gmail.com> wrote:
> On Wed, Jun 10, 2020 at 01:17:28PM +0300, Andy Shevchenko wrote:
> >On Wed, Jun 10, 2020 at 2:06 AM Wei Yang <richard.weiyang@gmail.com> wrote:
> >> On Tue, Jun 09, 2020 at 12:16:49PM +0300, Andy Shevchenko wrote:
> >> >On Mon, Jun 08, 2020 at 10:31:12PM +0000, Wei Yang wrote:
> >> >> On Fri, Jun 05, 2020 at 05:16:29PM -0700, Andrew Morton wrote:
> >> >
> >> >...
> >> >
> >> >> The test on 64bit machine pass. Since I don't have a 32bit machine by hand,
> >> >
> >> >Out of curiosity what that machine is?
> >> >
> >>
> >> It is a Intel Xeon Gold CPU.
> >
> >I suppose it's x86 (and not ia64).
> >In this case you can always build an i386 configuration and test on a
> >32-bit "machine".
> >
>
> Yes, you are right. While last time I tried to run a 32bit guest, it took me a
> lot of time to setup. If my understanding is correct, to run on a 32bit
> machine, we not only need the kernel but a whole 32bit system. This means I
> need to re-install a 32bit system. And I found many distro doesn't support
> 32bit system any more.
>
> Do you have a better way to setup the environment?

Yes, BuildRoot is your friend. I have a branch [1] to make it suitable
to create bootable images for x86 machines. There is a quick
instructions what it does provide.

[1]: https://github.com/andy-shev/buildroot/tree/intel/board/intel/common

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Patch v2] lib: test get_count_order/long in test_bitops.c
  2020-06-11  7:25                     ` Andy Shevchenko
@ 2020-06-12 14:28                       ` Wei Yang
  0 siblings, 0 replies; 15+ messages in thread
From: Wei Yang @ 2020-06-12 14:28 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Wei Yang, Andy Shevchenko, Andrew Morton, Geert Uytterhoeven,
	Christian Brauner, Linux Kernel Mailing List

On Thu, Jun 11, 2020 at 10:25:07AM +0300, Andy Shevchenko wrote:
>On Thu, Jun 11, 2020 at 1:06 AM Wei Yang <richard.weiyang@gmail.com> wrote:
>> On Wed, Jun 10, 2020 at 01:17:28PM +0300, Andy Shevchenko wrote:
>> >On Wed, Jun 10, 2020 at 2:06 AM Wei Yang <richard.weiyang@gmail.com> wrote:
>> >> On Tue, Jun 09, 2020 at 12:16:49PM +0300, Andy Shevchenko wrote:
>> >> >On Mon, Jun 08, 2020 at 10:31:12PM +0000, Wei Yang wrote:
>> >> >> On Fri, Jun 05, 2020 at 05:16:29PM -0700, Andrew Morton wrote:
>> >> >
>> >> >...
>> >> >
>> >> >> The test on 64bit machine pass. Since I don't have a 32bit machine by hand,
>> >> >
>> >> >Out of curiosity what that machine is?
>> >> >
>> >>
>> >> It is a Intel Xeon Gold CPU.
>> >
>> >I suppose it's x86 (and not ia64).
>> >In this case you can always build an i386 configuration and test on a
>> >32-bit "machine".
>> >
>>
>> Yes, you are right. While last time I tried to run a 32bit guest, it took me a
>> lot of time to setup. If my understanding is correct, to run on a 32bit
>> machine, we not only need the kernel but a whole 32bit system. This means I
>> need to re-install a 32bit system. And I found many distro doesn't support
>> 32bit system any more.
>>
>> Do you have a better way to setup the environment?
>
>Yes, BuildRoot is your friend. I have a branch [1] to make it suitable
>to create bootable images for x86 machines. There is a quick
>instructions what it does provide.
>
>[1]: https://github.com/andy-shev/buildroot/tree/intel/board/intel/common
>

Many thanks for your instruction. I will take a look into this.

>-- 
>With Best Regards,
>Andy Shevchenko

-- 
Wei Yang
Help you, Help me

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2020-06-12 14:29 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-02 22:37 [Patch v2] lib: test get_count_order/long in test_bitops.c Wei Yang
2020-06-03  9:18 ` Andy Shevchenko
2020-06-03 13:29   ` Wei Yang
2020-06-04 11:50 ` Geert Uytterhoeven
2020-06-04 12:28   ` Wei Yang
2020-06-04 12:51     ` Geert Uytterhoeven
2020-06-05 23:06       ` Wei Yang
2020-06-06  0:16         ` Andrew Morton
2020-06-08 22:31           ` Wei Yang
2020-06-09  9:16             ` Andy Shevchenko
2020-06-09 23:02               ` Wei Yang
2020-06-10 10:17                 ` Andy Shevchenko
2020-06-10 22:06                   ` Wei Yang
2020-06-11  7:25                     ` Andy Shevchenko
2020-06-12 14:28                       ` Wei Yang

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).