diff mbox series

MIPS: fix local_t operation on MIPS64

Message ID 20210904151218.10167-1-huangpei@loongson.cn (mailing list archive)
State New
Headers show
Series MIPS: fix local_t operation on MIPS64 | expand

Commit Message

Huang Pei Sept. 4, 2021, 3:12 p.m. UTC
Use daddu/dsubu for long int on MIPS64.

Signed-off-by: Huang Pei <huangpei@loongson.cn>
---
 arch/mips/include/asm/llsc.h  |  4 ++++
 arch/mips/include/asm/local.h | 17 +++++++++--------
 2 files changed, 13 insertions(+), 8 deletions(-)

Comments

Maciej W. Rozycki Sept. 4, 2021, 5:57 p.m. UTC | #1
On Sat, 4 Sep 2021, Huang Pei wrote:

> diff --git a/arch/mips/include/asm/llsc.h b/arch/mips/include/asm/llsc.h
> index ec09fe5d6d6c..788e26ad7fca 100644
> --- a/arch/mips/include/asm/llsc.h
> +++ b/arch/mips/include/asm/llsc.h
> @@ -16,11 +16,15 @@
>  #define __SC		"sc	"
>  #define __INS		"ins	"
>  #define __EXT		"ext	"
> +#define __ADDU		"addu	"
> +#define __SUBU		"subu	"
>  #elif _MIPS_SZLONG == 64
>  #define __LL		"lld	"
>  #define __SC		"scd	"
>  #define __INS		"dins	"
>  #define __EXT		"dext	"
> +#define __ADDU		"daddu	"
> +#define __SUBU		"dsubu	"

 Why invent things instead of using standard macros (LONG_ADDU/LONG_SUBU)?

  Maciej
kernel test robot Sept. 4, 2021, 6:50 p.m. UTC | #2
Hi Huang,

Thank you for the patch! Perhaps something to improve:

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

url:    https://github.com/0day-ci/linux/commits/Huang-Pei/MIPS-fix-local_t-operation-on-MIPS64/20210904-231410
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git f1583cb1be35c23df60b1c39e3e7e6704d749d0b
config: mips-randconfig-r033-20210904 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 6fe2beba7d2a41964af658c8c59dd172683ef739)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install mips cross compiling tool for clang build
        # apt-get install binutils-mips-linux-gnu
        # https://github.com/0day-ci/linux/commit/4a1c6e12f6f078dfc5351925656b237f7e5fbb50
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Huang-Pei/MIPS-fix-local_t-operation-on-MIPS64/20210904-231410
        git checkout 4a1c6e12f6f078dfc5351925656b237f7e5fbb50
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=mips 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/net/hamradio/mkiss.c:35:9: warning: 'END' macro redefined [-Wmacro-redefined]
   #define END             0300            /* indicates end of frame       */
           ^
   arch/mips/include/asm/asm.h:68:9: note: previous definition is here
   #define END(function)                                   \
           ^
   1 warning generated.


vim +/END +35 drivers/net/hamradio/mkiss.c

815f62bf742718 Ralf Baechle 2005-08-24  33  
815f62bf742718 Ralf Baechle 2005-08-24  34  /* SLIP/KISS protocol characters. */
815f62bf742718 Ralf Baechle 2005-08-24 @35  #define END             0300		/* indicates end of frame	*/
815f62bf742718 Ralf Baechle 2005-08-24  36  #define ESC             0333		/* indicates byte stuffing	*/
815f62bf742718 Ralf Baechle 2005-08-24  37  #define ESC_END         0334		/* ESC ESC_END means END 'data'	*/
815f62bf742718 Ralf Baechle 2005-08-24  38  #define ESC_ESC         0335		/* ESC ESC_ESC means ESC 'data'	*/
815f62bf742718 Ralf Baechle 2005-08-24  39  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
kernel test robot Sept. 4, 2021, 7:10 p.m. UTC | #3
Hi Huang,

Thank you for the patch! Perhaps something to improve:

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

url:    https://github.com/0day-ci/linux/commits/Huang-Pei/MIPS-fix-local_t-operation-on-MIPS64/20210904-231410
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git f1583cb1be35c23df60b1c39e3e7e6704d749d0b
config: mips-allyesconfig (attached as .config)
compiler: mips-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/4a1c6e12f6f078dfc5351925656b237f7e5fbb50
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Huang-Pei/MIPS-fix-local_t-operation-on-MIPS64/20210904-231410
        git checkout 4a1c6e12f6f078dfc5351925656b237f7e5fbb50
        # save the attached .config to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=mips SHELL=/bin/bash drivers/net/hamradio/ drivers/net/slip/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/net/hamradio/mkiss.c:35: warning: "END" redefined
      35 | #define END             0300            /* indicates end of frame       */
         | 
   In file included from arch/mips/include/asm/local.h:8,
                    from include/linux/genhd.h:20,
                    from include/linux/blkdev.h:8,
                    from include/linux/blk-cgroup.h:23,
                    from include/linux/writeback.h:14,
                    from include/linux/memcontrol.h:22,
                    from include/net/sock.h:53,
                    from include/net/ax25.h:17,
                    from drivers/net/hamradio/mkiss.c:30:
   arch/mips/include/asm/asm.h:68: note: this is the location of the previous definition
      68 | #define END(function)                                   \
         | 
--
   In file included from arch/mips/include/asm/local.h:8,
                    from include/linux/genhd.h:20,
                    from include/linux/blkdev.h:8,
                    from include/linux/blk-cgroup.h:23,
                    from include/linux/writeback.h:14,
                    from include/linux/memcontrol.h:22,
                    from include/net/sock.h:53,
                    from include/linux/tcp.h:19,
                    from drivers/net/slip/slip.c:91:
>> arch/mips/include/asm/asm.h:68: warning: "END" redefined
      68 | #define END(function)                                   \
         | 
   In file included from drivers/net/slip/slip.c:88:
   drivers/net/slip/slip.h:44: note: this is the location of the previous definition
      44 | #define END             0300            /* indicates end of frame       */
         | 
   drivers/net/slip/slip.c: In function 'slip_esc':
   drivers/net/slip/slip.c:930:18: error: 'END' undeclared (first use in this function)
     930 |         *ptr++ = END;
         |                  ^~~
   drivers/net/slip/slip.c:930:18: note: each undeclared identifier is reported only once for each function it appears in
   drivers/net/slip/slip.c: In function 'slip_unesc':
   drivers/net/slip/slip.c:960:14: error: 'END' undeclared (first use in this function)
     960 |         case END:
         |              ^~~
   drivers/net/slip/slip.c: In function 'sl_outfill':
   drivers/net/slip/slip.c:1393:75: error: 'END' undeclared (first use in this function)
    1393 |                         unsigned char s = (sl->mode & SL_MODE_SLIP6)?0x70:END;
         |                                                                           ^~~


vim +/END +68 arch/mips/include/asm/asm.h

894ef530012fb507 arch/mips/include/asm/asm.h Alexander Lobakin 2021-01-10  38  
^1da177e4c3f4152 include/asm-mips/asm.h      Linus Torvalds    2005-04-16  39  /*
^1da177e4c3f4152 include/asm-mips/asm.h      Linus Torvalds    2005-04-16  40   * LEAF - declare leaf routine
^1da177e4c3f4152 include/asm-mips/asm.h      Linus Torvalds    2005-04-16  41   */
^1da177e4c3f4152 include/asm-mips/asm.h      Linus Torvalds    2005-04-16  42  #define LEAF(symbol)					\
894ef530012fb507 arch/mips/include/asm/asm.h Alexander Lobakin 2021-01-10  43  		CFI_SECTIONS;				\
^1da177e4c3f4152 include/asm-mips/asm.h      Linus Torvalds    2005-04-16  44  		.globl	symbol;				\
^1da177e4c3f4152 include/asm-mips/asm.h      Linus Torvalds    2005-04-16  45  		.align	2;				\
^1da177e4c3f4152 include/asm-mips/asm.h      Linus Torvalds    2005-04-16  46  		.type	symbol, @function;		\
^1da177e4c3f4152 include/asm-mips/asm.h      Linus Torvalds    2005-04-16  47  		.ent	symbol, 0;			\
08889582b8aa0bbc arch/mips/include/asm/asm.h Paul Burton       2016-11-07  48  symbol:		.frame	sp, 0, ra;			\
866b6a89c6d1876f arch/mips/include/asm/asm.h Corey Minyard     2017-08-10  49  		.cfi_startproc;				\
08889582b8aa0bbc arch/mips/include/asm/asm.h Paul Burton       2016-11-07  50  		.insn
^1da177e4c3f4152 include/asm-mips/asm.h      Linus Torvalds    2005-04-16  51  
^1da177e4c3f4152 include/asm-mips/asm.h      Linus Torvalds    2005-04-16  52  /*
^1da177e4c3f4152 include/asm-mips/asm.h      Linus Torvalds    2005-04-16  53   * NESTED - declare nested routine entry point
^1da177e4c3f4152 include/asm-mips/asm.h      Linus Torvalds    2005-04-16  54   */
^1da177e4c3f4152 include/asm-mips/asm.h      Linus Torvalds    2005-04-16  55  #define NESTED(symbol, framesize, rpc)			\
894ef530012fb507 arch/mips/include/asm/asm.h Alexander Lobakin 2021-01-10  56  		CFI_SECTIONS;				\
^1da177e4c3f4152 include/asm-mips/asm.h      Linus Torvalds    2005-04-16  57  		.globl	symbol;				\
^1da177e4c3f4152 include/asm-mips/asm.h      Linus Torvalds    2005-04-16  58  		.align	2;				\
^1da177e4c3f4152 include/asm-mips/asm.h      Linus Torvalds    2005-04-16  59  		.type	symbol, @function;		\
^1da177e4c3f4152 include/asm-mips/asm.h      Linus Torvalds    2005-04-16  60  		.ent	symbol, 0;			\
08889582b8aa0bbc arch/mips/include/asm/asm.h Paul Burton       2016-11-07  61  symbol:		.frame	sp, framesize, rpc;		\
866b6a89c6d1876f arch/mips/include/asm/asm.h Corey Minyard     2017-08-10  62  		.cfi_startproc;				\
08889582b8aa0bbc arch/mips/include/asm/asm.h Paul Burton       2016-11-07  63  		.insn
^1da177e4c3f4152 include/asm-mips/asm.h      Linus Torvalds    2005-04-16  64  
^1da177e4c3f4152 include/asm-mips/asm.h      Linus Torvalds    2005-04-16  65  /*
^1da177e4c3f4152 include/asm-mips/asm.h      Linus Torvalds    2005-04-16  66   * END - mark end of function
^1da177e4c3f4152 include/asm-mips/asm.h      Linus Torvalds    2005-04-16  67   */
^1da177e4c3f4152 include/asm-mips/asm.h      Linus Torvalds    2005-04-16 @68  #define END(function)					\
866b6a89c6d1876f arch/mips/include/asm/asm.h Corey Minyard     2017-08-10  69  		.cfi_endproc;				\
^1da177e4c3f4152 include/asm-mips/asm.h      Linus Torvalds    2005-04-16  70  		.end	function;			\
^1da177e4c3f4152 include/asm-mips/asm.h      Linus Torvalds    2005-04-16  71  		.size	function, .-function
^1da177e4c3f4152 include/asm-mips/asm.h      Linus Torvalds    2005-04-16  72  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Huang Pei Sept. 5, 2021, 12:48 a.m. UTC | #4
You mean including  asm/asm.h? 

or redefine LONG_ADDU as ** "addu " ** in asm/llsc.h?


本邮件及其附件含有龙芯中科的商业秘密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制或散发)本邮件及其附件中的信息。如果您错收本邮件,请您立即电话或邮件通知发件人并删除本邮件。 


This email and its attachments contain confidential information from Loongson Technology , which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this email in error, please notify the sender by phone or email immediately and delete it. 
  Original Message  
From: Maciej W. Rozycki
Sent: 2021年9月5日星期日 1:58
To: Huang Pei
Cc: Thomas Bogendoerfer; ambrosehua@gmail.com; Bibo Mao; linux-mips@vger.kernel.org; linux-arch@vger.kernel.org; linux-mm@kvack.org; Jiaxun Yang; Paul Burton; Li Xuefeng; Yang Tiezhu; Gao Juxin; Huacai Chen; Jinyang He; Steven Rostedt; Jisheng Zhang; Masami Hiramatsu
Subject: Re: [PATCH] MIPS: fix local_t operation on MIPS64

On Sat, 4 Sep 2021, Huang Pei wrote:

> diff --git a/arch/mips/include/asm/llsc.h b/arch/mips/include/asm/llsc.h
> index ec09fe5d6d6c..788e26ad7fca 100644
> --- a/arch/mips/include/asm/llsc.h
> +++ b/arch/mips/include/asm/llsc.h
> @@ -16,11 +16,15 @@
> #define __SC	 "sc	"
> #define __INS	 "ins	"
> #define __EXT	 "ext	"
> +#define __ADDU	 "addu	"
> +#define __SUBU	 "subu	"
> #elif _MIPS_SZLONG == 64
> #define __LL	 "lld	"
> #define __SC	 "scd	"
> #define __INS	 "dins	"
> #define __EXT	 "dext	"
> +#define __ADDU	 "daddu	"
> +#define __SUBU	 "dsubu	"

Why invent things instead of using standard macros (LONG_ADDU/LONG_SUBU)?

Maciej
kernel test robot Sept. 5, 2021, 3:42 a.m. UTC | #5
Hi Huang,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.14 next-20210903]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Huang-Pei/MIPS-fix-local_t-operation-on-MIPS64/20210904-231410
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git f1583cb1be35c23df60b1c39e3e7e6704d749d0b
config: mips-allyesconfig (attached as .config)
compiler: mips-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/4a1c6e12f6f078dfc5351925656b237f7e5fbb50
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Huang-Pei/MIPS-fix-local_t-operation-on-MIPS64/20210904-231410
        git checkout 4a1c6e12f6f078dfc5351925656b237f7e5fbb50
        # save the attached .config to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=mips SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   In file included from arch/mips/include/asm/local.h:8,
                    from include/linux/genhd.h:20,
                    from include/linux/blkdev.h:8,
                    from include/linux/blk-cgroup.h:23,
                    from include/linux/writeback.h:14,
                    from include/linux/memcontrol.h:22,
                    from include/net/sock.h:53,
                    from include/linux/tcp.h:19,
                    from drivers/net/slip/slip.c:91:
   arch/mips/include/asm/asm.h:68: warning: "END" redefined
      68 | #define END(function)                                   \
         | 
   In file included from drivers/net/slip/slip.c:88:
   drivers/net/slip/slip.h:44: note: this is the location of the previous definition
      44 | #define END             0300            /* indicates end of frame       */
         | 
   drivers/net/slip/slip.c: In function 'slip_esc':
>> drivers/net/slip/slip.c:930:18: error: 'END' undeclared (first use in this function)
     930 |         *ptr++ = END;
         |                  ^~~
   drivers/net/slip/slip.c:930:18: note: each undeclared identifier is reported only once for each function it appears in
   drivers/net/slip/slip.c: In function 'slip_unesc':
   drivers/net/slip/slip.c:960:14: error: 'END' undeclared (first use in this function)
     960 |         case END:
         |              ^~~
   drivers/net/slip/slip.c: In function 'sl_outfill':
   drivers/net/slip/slip.c:1393:75: error: 'END' undeclared (first use in this function)
    1393 |                         unsigned char s = (sl->mode & SL_MODE_SLIP6)?0x70:END;
         |                                                                           ^~~


vim +/END +930 drivers/net/slip/slip.c

^1da177e4c3f4152 drivers/net/slip.c Linus Torvalds 2005-04-16  909  
5342b77c4123ba39 drivers/net/slip.c Alan Cox       2009-09-19  910  static int slip_hangup(struct tty_struct *tty)
5342b77c4123ba39 drivers/net/slip.c Alan Cox       2009-09-19  911  {
5342b77c4123ba39 drivers/net/slip.c Alan Cox       2009-09-19  912  	slip_close(tty);
5342b77c4123ba39 drivers/net/slip.c Alan Cox       2009-09-19  913  	return 0;
5342b77c4123ba39 drivers/net/slip.c Alan Cox       2009-09-19  914  }
^1da177e4c3f4152 drivers/net/slip.c Linus Torvalds 2005-04-16  915   /************************************************************************
^1da177e4c3f4152 drivers/net/slip.c Linus Torvalds 2005-04-16  916    *			STANDARD SLIP ENCAPSULATION		  	 *
^1da177e4c3f4152 drivers/net/slip.c Linus Torvalds 2005-04-16  917    ************************************************************************/
^1da177e4c3f4152 drivers/net/slip.c Linus Torvalds 2005-04-16  918  
9ce6cf25538de803 drivers/net/slip.c Alan Cox       2007-11-19  919  static int slip_esc(unsigned char *s, unsigned char *d, int len)
^1da177e4c3f4152 drivers/net/slip.c Linus Torvalds 2005-04-16  920  {
^1da177e4c3f4152 drivers/net/slip.c Linus Torvalds 2005-04-16  921  	unsigned char *ptr = d;
^1da177e4c3f4152 drivers/net/slip.c Linus Torvalds 2005-04-16  922  	unsigned char c;
^1da177e4c3f4152 drivers/net/slip.c Linus Torvalds 2005-04-16  923  
^1da177e4c3f4152 drivers/net/slip.c Linus Torvalds 2005-04-16  924  	/*
^1da177e4c3f4152 drivers/net/slip.c Linus Torvalds 2005-04-16  925  	 * Send an initial END character to flush out any
^1da177e4c3f4152 drivers/net/slip.c Linus Torvalds 2005-04-16  926  	 * data that may have accumulated in the receiver
^1da177e4c3f4152 drivers/net/slip.c Linus Torvalds 2005-04-16  927  	 * due to line noise.
^1da177e4c3f4152 drivers/net/slip.c Linus Torvalds 2005-04-16  928  	 */
^1da177e4c3f4152 drivers/net/slip.c Linus Torvalds 2005-04-16  929  
^1da177e4c3f4152 drivers/net/slip.c Linus Torvalds 2005-04-16 @930  	*ptr++ = END;
^1da177e4c3f4152 drivers/net/slip.c Linus Torvalds 2005-04-16  931  
^1da177e4c3f4152 drivers/net/slip.c Linus Torvalds 2005-04-16  932  	/*
^1da177e4c3f4152 drivers/net/slip.c Linus Torvalds 2005-04-16  933  	 * For each byte in the packet, send the appropriate
^1da177e4c3f4152 drivers/net/slip.c Linus Torvalds 2005-04-16  934  	 * character sequence, according to the SLIP protocol.
^1da177e4c3f4152 drivers/net/slip.c Linus Torvalds 2005-04-16  935  	 */
^1da177e4c3f4152 drivers/net/slip.c Linus Torvalds 2005-04-16  936  
^1da177e4c3f4152 drivers/net/slip.c Linus Torvalds 2005-04-16  937  	while (len-- > 0) {
^1da177e4c3f4152 drivers/net/slip.c Linus Torvalds 2005-04-16  938  		switch (c = *s++) {
^1da177e4c3f4152 drivers/net/slip.c Linus Torvalds 2005-04-16  939  		case END:
^1da177e4c3f4152 drivers/net/slip.c Linus Torvalds 2005-04-16  940  			*ptr++ = ESC;
^1da177e4c3f4152 drivers/net/slip.c Linus Torvalds 2005-04-16  941  			*ptr++ = ESC_END;
^1da177e4c3f4152 drivers/net/slip.c Linus Torvalds 2005-04-16  942  			break;
^1da177e4c3f4152 drivers/net/slip.c Linus Torvalds 2005-04-16  943  		case ESC:
^1da177e4c3f4152 drivers/net/slip.c Linus Torvalds 2005-04-16  944  			*ptr++ = ESC;
^1da177e4c3f4152 drivers/net/slip.c Linus Torvalds 2005-04-16  945  			*ptr++ = ESC_ESC;
^1da177e4c3f4152 drivers/net/slip.c Linus Torvalds 2005-04-16  946  			break;
^1da177e4c3f4152 drivers/net/slip.c Linus Torvalds 2005-04-16  947  		default:
^1da177e4c3f4152 drivers/net/slip.c Linus Torvalds 2005-04-16  948  			*ptr++ = c;
^1da177e4c3f4152 drivers/net/slip.c Linus Torvalds 2005-04-16  949  			break;
^1da177e4c3f4152 drivers/net/slip.c Linus Torvalds 2005-04-16  950  		}
^1da177e4c3f4152 drivers/net/slip.c Linus Torvalds 2005-04-16  951  	}
^1da177e4c3f4152 drivers/net/slip.c Linus Torvalds 2005-04-16  952  	*ptr++ = END;
807540baae406c84 drivers/net/slip.c Eric Dumazet   2010-09-23  953  	return ptr - d;
^1da177e4c3f4152 drivers/net/slip.c Linus Torvalds 2005-04-16  954  }
^1da177e4c3f4152 drivers/net/slip.c Linus Torvalds 2005-04-16  955  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Maciej W. Rozycki Sept. 6, 2021, 11:08 a.m. UTC | #6
On Sun, 5 Sep 2021, 黄沛 wrote:

> You mean including  asm/asm.h? 
> 
> or redefine LONG_ADDU as ** "addu " ** in asm/llsc.h?

 Use the existing macros, they're there for this purpose and widely used 
throughout the port already.

  Maciej
Huang Pei Sept. 6, 2021, 2:03 p.m. UTC | #7
On Mon, Sep 06, 2021 at 01:08:02PM +0200, Maciej W. Rozycki wrote:
> On Sun, 5 Sep 2021, 黄沛 wrote:
> 
> > You mean including  asm/asm.h? 
> > 
> > or redefine LONG_ADDU as ** "addu " ** in asm/llsc.h?
> 
>  Use the existing macros, they're there for this purpose and widely used 
> throughout the port already.
> 
>   Maciej

diff --git a/arch/mips/include/asm/local.h b/arch/mips/include/asm/local.h
index 3c6db82ee0a6..551d8ba09cd7 100644
--- a/arch/mips/include/asm/local.h
+++ b/arch/mips/include/asm/local.h
@@ -9,6 +9,7 @@
 #include <asm/cmpxchg.h>
 #include <asm/compiler.h>
 #include <asm/war.h>
+#include <asm/asm.h>
 
 typedef struct
 {
@@ -40,10 +41,10 @@ static __inline__ long local_add_return(long i, local_t * l)
 		"	.set	arch=r4000				\n"
 			__SYNC(full, loongson3_war) "			\n"
 		"1:"	__LL	"%1, %2		# local_add_return	\n"
-			__ADDU	"%0, %1, %3				\n"
+		"	LONG_ADDU	%0, %1, %3			\n"
 			__SC	"%0, %2					\n"
 		"	beqzl	%0, 1b					\n"
-			__ADDU	"%0, %1, %3				\n"
+		"	LONG_ADDU	%0, %1, %3			\n"
 		"	.set	pop					\n"
 		: "=&r" (result), "=&r" (temp), "=m" (l->a.counter)
 		: "Ir" (i), "m" (l->a.counter)
@@ -56,10 +57,10 @@ static __inline__ long local_add_return(long i, local_t * l)
 		"	.set	"MIPS_ISA_ARCH_LEVEL"			\n"
 			__SYNC(full, loongson3_war) "			\n"
 		"1:"	__LL	"%1, %2		# local_add_return	\n"
-			__ADDU	"%0, %1, %3				\n"
+		"	LONG_ADDU	%0, %1, %3			\n"
 			__SC	"%0, %2					\n"
 		"	beqz	%0, 1b					\n"
-			__ADDU	"%0, %1, %3				\n"
+		"	LONG_ADDU	%0, %1, %3			\n"
 		"	.set	pop					\n"
 		: "=&r" (result), "=&r" (temp), "=m" (l->a.counter)
 		: "Ir" (i), "m" (l->a.counter)
@@ -89,10 +90,10 @@ static __inline__ long local_sub_return(long i, local_t * l)
 		"	.set	arch=r4000				\n"
 			__SYNC(full, loongson3_war) "			\n"
 		"1:"	__LL	"%1, %2		# local_sub_return	\n"
-			__SUBU	"%0, %1, %3				\n"
+		"	LONG_SUBU	%0, %1, %3			\n"
 			__SC	"%0, %2					\n"
 		"	beqzl	%0, 1b					\n"
-			__SUBU	"%0, %1, %3				\n"
+		"	LONG_SUBU	%0, %1, %3			\n"
 		"	.set	pop					\n"
 		: "=&r" (result), "=&r" (temp), "=m" (l->a.counter)
 		: "Ir" (i), "m" (l->a.counter)
@@ -105,10 +106,10 @@ static __inline__ long local_sub_return(long i, local_t * l)
 		"	.set	"MIPS_ISA_ARCH_LEVEL"			\n"
 			__SYNC(full, loongson3_war) "			\n"
 		"1:"	__LL	"%1, %2		# local_sub_return	\n"
-			__SUBU	"%0, %1, %3				\n"
+		"	LONG_SUBU	%0, %1, %3			\n"
 			__SC	"%0, %2					\n"
 		"	beqz	%0, 1b					\n"
-			__SUBU	"%0, %1, %3				\n"
+		"	LONG_SUBU	%0, %1, %3			\n"
 		"	.set	pop					\n"
 		: "=&r" (result), "=&r" (temp), "=m" (l->a.counter)
 		: "Ir" (i), "m" (l->a.counter)


|| make[1]: Entering directory '/home/hp/projects/Linux/temp/out_stable_loongson'
||   GEN     Makefile
||   Checking missing-syscalls for N32
||   CALL    /home/hp/projects/Linux/temp/linux-stable/scripts/checksyscalls.sh
||   Checking missing-syscalls for O32
||   CALL    /home/hp/projects/Linux/temp/linux-stable/scripts/checksyscalls.sh
||   CALL    /home/hp/projects/Linux/temp/linux-stable/scripts/checksyscalls.sh
||   CALL    /home/hp/projects/Linux/temp/linux-stable/scripts/atomic/check-atomics.sh
||   CC      kernel/trace/ring_buffer.o
|| {standard input}: Assembler messages:
{standard input}|11389| Error: unrecognized opcode `long_addu $6,$3,$2'
{standard input}|11392| Error: unrecognized opcode `long_addu $6,$3,$2'
{standard input}|11404| Error: unrecognized opcode `long_addu $5,$7,$2'
{standard input}|11407| Error: unrecognized opcode `long_addu $5,$7,$2'
{standard input}|12354| Error: unrecognized opcode `long_addu $20,$3,$2'
{standard input}|12357| Error: unrecognized opcode `long_addu $20,$3,$2'
/home/hp/projects/Linux/temp/linux-stable/scripts/Makefile.build|279| recipe for target 'kernel/trace/ring_buffer.o' failed
|| make[3]: *** [kernel/trace/ring_buffer.o] Error 1
/home/hp/projects/Linux/temp/linux-stable/scripts/Makefile.build|496| recipe for target 'kernel/trace' failed
|| make[2]: *** [kernel/trace] Error 2
/home/hp/projects/Linux/temp/linux-stable/Makefile|1805| recipe for target 'kernel' failed
|| make[1]: *** [kernel] Error 2
|| make[1]: Leaving directory '/home/hp/projects/Linux/temp/out_stable_loongson'
/home/hp/projects/Linux/temp/linux-stable/Makefile|185| recipe for target '__sub-make' failed
|| make: *** [__sub-make] Error 2


Any better idea?
Maciej W. Rozycki Sept. 6, 2021, 4:29 p.m. UTC | #8
On Mon, 6 Sep 2021, Huang Pei wrote:

> || {standard input}: Assembler messages:
> {standard input}|11389| Error: unrecognized opcode `long_addu $6,$3,$2'
> {standard input}|11392| Error: unrecognized opcode `long_addu $6,$3,$2'
> {standard input}|11404| Error: unrecognized opcode `long_addu $5,$7,$2'
> {standard input}|11407| Error: unrecognized opcode `long_addu $5,$7,$2'
> {standard input}|12354| Error: unrecognized opcode `long_addu $20,$3,$2'
> {standard input}|12357| Error: unrecognized opcode `long_addu $20,$3,$2'

 Sheesh, you need to unquote the references to get them expanded.

  Maciej
Maciej W. Rozycki Sept. 7, 2021, 10 a.m. UTC | #9
On Tue, 7 Sep 2021, loongson wrote:

> Please show me your code

 See commit e496453d3e15.  You may get inspiration from <asm/stacktrace.h> 
too.

> This email and its attachments contain confidential information from 
> Loongson Technology , which is intended only for the person or entity 
> whose address is listed above. Any use of the information contained 
> herein in any way (including, but not limited to, total or partial 
> disclosure, reproduction or dissemination) by persons other than the 
> intended recipient(s) is prohibited. If you receive this email in error, 
> please notify the sender by phone or email immediately and delete it.

 Your message has hit public mailing list archives already I'm afraid.

  Maciej
Huang Pei Sept. 8, 2021, 8:15 a.m. UTC | #10
Thank you, I got it.



本邮件及其附件含有龙芯中科的商业秘密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制或散发)本邮件及其附件中的信息。如果您错收本邮件,请您立即电话或邮件通知发件人并删除本邮件。 


This email and its attachments contain confidential information from Loongson Technology , which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this email in error, please notify the sender by phone or email immediately and delete it. 
  Original Message  
From: Maciej W. Rozycki
Sent: 2021年9月7日星期二 18:00
To: loongson
Cc: Thomas Bogendoerfer; ambrosehua@gmail.com; Bibo Mao; linux-mips@vger.kernel.org; linux-arch@vger.kernel.org; linux-mm@kvack.org; Jiaxun Yang; Paul Burton; Li Xuefeng; Yang Tiezhu; Gao Juxin; Huacai Chen; Jinyang He; Steven Rostedt; Jisheng Zhang; Masami Hiramatsu
Subject: Re: [PATCH] MIPS: fix local_t operation on MIPS64

On Tue, 7 Sep 2021, loongson wrote:

> Please show me your code

See commit e496453d3e15. You may get inspiration from <asm/stacktrace.h> 
too.

> This email and its attachments contain confidential information from 
> Loongson Technology , which is intended only for the person or entity 
> whose address is listed above. Any use of the information contained 
> herein in any way (including, but not limited to, total or partial 
> disclosure, reproduction or dissemination) by persons other than the 
> intended recipient(s) is prohibited. If you receive this email in error, 
> please notify the sender by phone or email immediately and delete it.

Your message has hit public mailing list archives already I'm afraid.

Maciej
diff mbox series

Patch

diff --git a/arch/mips/include/asm/llsc.h b/arch/mips/include/asm/llsc.h
index ec09fe5d6d6c..788e26ad7fca 100644
--- a/arch/mips/include/asm/llsc.h
+++ b/arch/mips/include/asm/llsc.h
@@ -16,11 +16,15 @@ 
 #define __SC		"sc	"
 #define __INS		"ins	"
 #define __EXT		"ext	"
+#define __ADDU		"addu	"
+#define __SUBU		"subu	"
 #elif _MIPS_SZLONG == 64
 #define __LL		"lld	"
 #define __SC		"scd	"
 #define __INS		"dins	"
 #define __EXT		"dext	"
+#define __ADDU		"daddu	"
+#define __SUBU		"dsubu	"
 #endif
 
 /*
diff --git a/arch/mips/include/asm/local.h b/arch/mips/include/asm/local.h
index ecda7295ddcd..3c6db82ee0a6 100644
--- a/arch/mips/include/asm/local.h
+++ b/arch/mips/include/asm/local.h
@@ -5,6 +5,7 @@ 
 #include <linux/percpu.h>
 #include <linux/bitops.h>
 #include <linux/atomic.h>
+#include <asm/asm.h>
 #include <asm/cmpxchg.h>
 #include <asm/compiler.h>
 #include <asm/war.h>
@@ -39,10 +40,10 @@  static __inline__ long local_add_return(long i, local_t * l)
 		"	.set	arch=r4000				\n"
 			__SYNC(full, loongson3_war) "			\n"
 		"1:"	__LL	"%1, %2		# local_add_return	\n"
-		"	addu	%0, %1, %3				\n"
+			__ADDU	"%0, %1, %3				\n"
 			__SC	"%0, %2					\n"
 		"	beqzl	%0, 1b					\n"
-		"	addu	%0, %1, %3				\n"
+			__ADDU	"%0, %1, %3				\n"
 		"	.set	pop					\n"
 		: "=&r" (result), "=&r" (temp), "=m" (l->a.counter)
 		: "Ir" (i), "m" (l->a.counter)
@@ -55,10 +56,10 @@  static __inline__ long local_add_return(long i, local_t * l)
 		"	.set	"MIPS_ISA_ARCH_LEVEL"			\n"
 			__SYNC(full, loongson3_war) "			\n"
 		"1:"	__LL	"%1, %2		# local_add_return	\n"
-		"	addu	%0, %1, %3				\n"
+			__ADDU	"%0, %1, %3				\n"
 			__SC	"%0, %2					\n"
 		"	beqz	%0, 1b					\n"
-		"	addu	%0, %1, %3				\n"
+			__ADDU	"%0, %1, %3				\n"
 		"	.set	pop					\n"
 		: "=&r" (result), "=&r" (temp), "=m" (l->a.counter)
 		: "Ir" (i), "m" (l->a.counter)
@@ -88,10 +89,10 @@  static __inline__ long local_sub_return(long i, local_t * l)
 		"	.set	arch=r4000				\n"
 			__SYNC(full, loongson3_war) "			\n"
 		"1:"	__LL	"%1, %2		# local_sub_return	\n"
-		"	subu	%0, %1, %3				\n"
+			__SUBU	"%0, %1, %3				\n"
 			__SC	"%0, %2					\n"
 		"	beqzl	%0, 1b					\n"
-		"	subu	%0, %1, %3				\n"
+			__SUBU	"%0, %1, %3				\n"
 		"	.set	pop					\n"
 		: "=&r" (result), "=&r" (temp), "=m" (l->a.counter)
 		: "Ir" (i), "m" (l->a.counter)
@@ -104,10 +105,10 @@  static __inline__ long local_sub_return(long i, local_t * l)
 		"	.set	"MIPS_ISA_ARCH_LEVEL"			\n"
 			__SYNC(full, loongson3_war) "			\n"
 		"1:"	__LL	"%1, %2		# local_sub_return	\n"
-		"	subu	%0, %1, %3				\n"
+			__SUBU	"%0, %1, %3				\n"
 			__SC	"%0, %2					\n"
 		"	beqz	%0, 1b					\n"
-		"	subu	%0, %1, %3				\n"
+			__SUBU	"%0, %1, %3				\n"
 		"	.set	pop					\n"
 		: "=&r" (result), "=&r" (temp), "=m" (l->a.counter)
 		: "Ir" (i), "m" (l->a.counter)