Content-Type: multipart/mixed; boundary="===============2107876154066094186==" MIME-Version: 1.0 From: Chen, Rong A To: kbuild-all@lists.01.org Subject: Re: [PATCH] random: do not take pool spinlock at boot Date: Mon, 14 Feb 2022 14:40:48 +0800 Message-ID: In-Reply-To: List-Id: --===============2107876154066094186== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Hi Jason, Thanks for the explanation, we'll take a look. Best Regards, Rong Chen On 2/12/2022 6:01 PM, Jason A. Donenfeld wrote: > Hey folks, > = > Just FYI, this applied to the wrong tree. It should have applied to = > https://git.kernel.org/pub/scm/linux/kernel/git/crng/random.git = > > = > Regards, > Jason > = > = > On Sat, Feb 12, 2022, 06:35 kernel test robot > wrote: > = > Hi "Jason, > = > I love your patch! Yet something to improve: > = > [auto build test ERROR on next-20220211] > [cannot apply to char-misc/char-misc-testing linux/master > linus/master v5.17-rc3 v5.17-rc2 v5.17-rc1 v5.17-rc3] > [If your patch is applied to the wrong git tree, kindly drop us a not= e. > 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/Jason-A-Donenfeld/random-do-= not-take-pool-spinlock-at-boot/20220212-083131 > > base:=C2=A0 =C2=A0 6d9bd4ad4ca08b1114e814c2c42383b8b13be631 > config: um-x86_64_defconfig > (https://download.01.org/0day-ci/archive/20220212/202202121318.QSBkUc= wP-lkp(a)intel.com/config > ) > compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 > reproduce (this is a W=3D1 build): > =C2=A0 =C2=A0 =C2=A0 =C2=A0 # > https://github.com/0day-ci/linux/commit/cac377f6ab22a8bfe966643ebe198= 12e8187de3b > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 git remote add linux-review > https://github.com/0day-ci/linux > =C2=A0 =C2=A0 =C2=A0 =C2=A0 git fetch --no-tags linux-review > Jason-A-Donenfeld/random-do-not-take-pool-spinlock-at-boot/20220212-0= 83131 > =C2=A0 =C2=A0 =C2=A0 =C2=A0 git checkout cac377f6ab22a8bfe966643ebe1= 9812e8187de3b > =C2=A0 =C2=A0 =C2=A0 =C2=A0 # save the config file to linux build tr= ee > =C2=A0 =C2=A0 =C2=A0 =C2=A0 mkdir build_dir > =C2=A0 =C2=A0 =C2=A0 =C2=A0 make W=3D1 O=3Dbuild_dir ARCH=3Dum SUBAR= CH=3Dx86_64 SHELL=3D/bin/bash > = > If you fix the issue, kindly add following tag as appropriate > Reported-by: kernel test robot > > = > All errors (new ones prefixed by >>): > = > =C2=A0 =C2=A0drivers/char/random.c: In function 'rand_initialize': > >> drivers/char/random.c:162:3: error: implicit declaration of > function '_mix_pool_bytes'; did you mean 'mix_pool_bytes'? > [-Werror=3Dimplicit-function-declaration] > =C2=A0 =C2=A0 =C2=A0162 |=C2=A0 =C2=A0_mix_pool_bytes(&rv, sizeof(rv= )); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 =C2=A0^~~~~~~~~~~~~~~ > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 =C2=A0mix_pool_bytes > =C2=A0 =C2=A0drivers/char/random.c: At top level: > =C2=A0 =C2=A0drivers/char/random.c:822:13: warning: conflicting type= s for > '_mix_pool_bytes' > =C2=A0 =C2=A0 =C2=A0822 | static void _mix_pool_bytes(const void *in= , size_t nbytes) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0^~~~~~~~~~~~~~~ > >> drivers/char/random.c:822:13: error: static declaration of > '_mix_pool_bytes' follows non-static declaration > =C2=A0 =C2=A0drivers/char/random.c:162:3: note: previous implicit de= claration > of '_mix_pool_bytes' was here > =C2=A0 =C2=A0 =C2=A0162 |=C2=A0 =C2=A0_mix_pool_bytes(&rv, sizeof(rv= )); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 =C2=A0^~~~~~~~~~~~~~~ > =C2=A0 =C2=A0drivers/char/random.c:1109:6: warning: no previous prot= otype for > 'add_hwgenerator_randomness' [-Wmissing-prototypes] > =C2=A0 =C2=A0 1109 | void add_hwgenerator_randomness(const void *buf= fer, > size_t count, > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 =C2=A0 =C2=A0 ^~~~~~~~~~~~= ~~~~~~~~~~~~~~ > =C2=A0 =C2=A0cc1: some warnings being treated as errors > = > = > vim +162 drivers/char/random.c > = > =C2=A0 =C2=A0138 > =C2=A0 =C2=A0139=C2=A0 /* > =C2=A0 =C2=A0140=C2=A0 =C2=A0* Note that setup_arch() may call add_d= evice_randomness() > =C2=A0 =C2=A0141=C2=A0 =C2=A0* long before we get here. This allows = seeding of the pools > =C2=A0 =C2=A0142=C2=A0 =C2=A0* with some platform dependent data ver= y early in the boot > =C2=A0 =C2=A0143=C2=A0 =C2=A0* process. But it limits our options he= re. We must use > =C2=A0 =C2=A0144=C2=A0 =C2=A0* statically allocated structures that = already have all > =C2=A0 =C2=A0145=C2=A0 =C2=A0* initializations complete at compile t= ime. We should also > =C2=A0 =C2=A0146=C2=A0 =C2=A0* take care not to overwrite the precio= us per platform data > =C2=A0 =C2=A0147=C2=A0 =C2=A0* we were given. > =C2=A0 =C2=A0148=C2=A0 =C2=A0*/ > =C2=A0 =C2=A0149=C2=A0 int __init rand_initialize(void) > =C2=A0 =C2=A0150=C2=A0 { > =C2=A0 =C2=A0151=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 size_t i; > =C2=A0 =C2=A0152=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ktime_t now =3D k= time_get_real(); > =C2=A0 =C2=A0153=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 bool arch_init = =3D true; > =C2=A0 =C2=A0154=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 unsigned long rv; > =C2=A0 =C2=A0155 > =C2=A0 =C2=A0156=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 for (i =3D BLAKE2= S_BLOCK_SIZE; i > 0; i -=3D sizeof(rv)) { > =C2=A0 =C2=A0157=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 if (!arch_get_random_seed_long_early(&rv) && > =C2=A0 =C2=A0158=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 !arch_get_random_long_early(&rv)) { > =C2=A0 =C2=A0159=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 rv =3D random_get_entropy(); > =C2=A0 =C2=A0160=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 arch_init =3D false; > =C2=A0 =C2=A0161=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 } > =C2=A0> 162=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 _mix_pool_bytes(&rv, sizeof(rv)); > =C2=A0 =C2=A0163=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 } > =C2=A0 =C2=A0164=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 _mix_pool_bytes(&= now, sizeof(now)); > =C2=A0 =C2=A0165=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 _mix_pool_bytes(u= tsname(), sizeof(*(utsname()))); > =C2=A0 =C2=A0166 > =C2=A0 =C2=A0167=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 extract_entropy(b= ase_crng.key, sizeof(base_crng.key)); > =C2=A0 =C2=A0168=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ++base_crng.gener= ation; > =C2=A0 =C2=A0169 > =C2=A0 =C2=A0170=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (arch_init && = trust_cpu && crng_init < 2) { > =C2=A0 =C2=A0171=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 crng_init =3D 2; > =C2=A0 =C2=A0172=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 pr_notice("crng init done (trusting CPU's > manufacturer)\n"); > =C2=A0 =C2=A0173=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 } > =C2=A0 =C2=A0174 > =C2=A0 =C2=A0175=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (ratelimit_dis= able) { > =C2=A0 =C2=A0176=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 urandom_warning.interval =3D 0; > =C2=A0 =C2=A0177=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 unseeded_warning.interval =3D 0; > =C2=A0 =C2=A0178=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 } > =C2=A0 =C2=A0179=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return 0; > =C2=A0 =C2=A0180=C2=A0 } > =C2=A0 =C2=A0181 > = > --- > 0-DAY CI Kernel Test Service, Intel Corporation > https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org > > = > = > _______________________________________________ > kbuild-all mailing list -- kbuild-all(a)lists.01.org > To unsubscribe send an email to kbuild-all-leave(a)lists.01.org >=20 --===============2107876154066094186==--