Content-Type: multipart/mixed; boundary="===============2446340883335404588==" MIME-Version: 1.0 From: Petr Mladek To: kbuild-all@lists.01.org Subject: Re: [PATCH next v2 1/2] dump_stack: move cpu lock to printk.c Date: Tue, 08 Jun 2021 15:48:22 +0200 Message-ID: In-Reply-To: <202106081055.UgUlUS1Z-lkp@intel.com> List-Id: --===============2446340883335404588== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable On Tue 2021-06-08 10:43:46, kernel test robot wrote: > Hi John, > = > I love your patch! Perhaps something to improve: > = > [auto build test WARNING on next-20210607] > = > url: https://github.com/0day-ci/linux/commits/John-Ogness/introduce-pr= intk-cpu-lock/20210608-040454 > base: 7f09e895a7f3e0af63bf9ec6c7c22893ec7e6c8e > config: mips-randconfig-r036-20210607 (attached as .config) > compiler: mips-linux-gcc (GCC) 9.3.0 > reproduce (this is a W=3D1 build): > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbi= n/make.cross -O ~/bin/make.cross > chmod +x ~/bin/make.cross > # https://github.com/0day-ci/linux/commit/136bcc2980e636b2ae156ca= 63fbe95c713e44c1b > git remote add linux-review https://github.com/0day-ci/linux > git fetch --no-tags linux-review John-Ogness/introduce-printk-cpu= -lock/20210608-040454 > git checkout 136bcc2980e636b2ae156ca63fbe95c713e44c1b > # save the attached .config to linux build tree > COMPILER_INSTALL_PATH=3D$HOME/0day COMPILER=3Dgcc-9.3.0 make.cros= s ARCH=3Dmips = > = > If you fix the issue, kindly add following tag as appropriate > Reported-by: kernel test robot > = > All warnings (new ones prefixed by >>): > = > lib/dump_stack.c: In function 'dump_stack_lvl': > >> lib/dump_stack.c:107:2: warning: 'lock_flag' is used uninitialized in = this function [-Wuninitialized] > 107 | printk_cpu_unlock_irqrestore(lock_flag, irq_flags); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Interesting. I am curious that it does not complain also about irq_flags. But it is possible the it reports only the first problem. Anyway, we will likely need to do some trickery via #define to tell the compiler that the value is set. I mean to do similar thing as: #define raw_local_irq_save(flags) \ do { \ typecheck(unsigned long, flags); \ flags =3D arch_local_irq_save(); \ } while (0) In our case, it might look like: #define printk_cpu_lock_irqsave(lock_nested, irq_flags) \ do { \ local_irq_save(irq_flags); \ typecheck(bool, lock_nested); \ lock_nested =3D __printk_cpu_lock(irq_flags); \ } while (0) then we would need to do in __prink_cpu_lock(unsigned long irq_flags) } else { local_irq_restore(irq_flags); /* * Wait for the lock to release before jumping to cmpxchg() * in order to mitigate the thundering herd problem. */ do { cpu_relax(); } while (atomic_read(&printk_cpulock_owner) !=3D -1); local_irq_save(irq_flags) goto retry; } Best Regards, Petr --===============2446340883335404588==--