Bug 13534

Summary: json-c: bitbake hang in recent AMD cpu.
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Homin Lee <cassian.adr>
Component: devtools / tool chainAssignee: Adrian Bunk <bunk>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: Medium+ CC: akuster, bunk, meta.mr.watcher, meta.watcher, randy.macleod
Version: 2.6.4   
Target Milestone: 2.8 M4   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Homin Lee 2019-09-17 06:09:09 UTC
I am using recent AMD cpu, AMD Ryzen 9 3900X.

When I bitbake (it'a AGL project) some recipes used 100% on build in one core
and never finished.
Same happened ubuntu_18.04, ubuntu_16.04 and debian_sid host.

I found it hang in `json_c_get_random_seed()` and,
can workaround it by comment out --enable-rdrand
in `poky/meta/recipes-devtools/json-c/json-c_0.13.1.bb`:

    ...
    #EXTRA_OECONF = "--enable-rdrand"
    ...

It makes json-c use `/dev/urandom` instead of RDRAND to get random seed.

I thinks it because something about recent AMD cpu's RDRAND instruction
but not know detail.

Hope, this report helps someone in same problem.
Comment 1 Randy MacLeod 2019-09-19 14:41:49 UTC
Can you reproduce the issue on a non-AMD builder?
Also we'd like to know more about the exact branch and commit of oe-core used?
Does it happen on master, there was a recent update to openssl that may be related. Any additional info would be appreciated or actually needed to make progress.
Comment 2 Homin Lee 2019-09-20 00:35:33 UTC
It's not reproduced in Intel(R) Core(TM) i7-4770 CPU builder.

Current tags are `thud-20.0.2` and `yocto-2.6.2`
in remote, `https://git.yoctoproject.org/git/poky`

poky's `master` branch also has same EXTRA_OECONF, `--enable-rdrand`
in `json-c_0.13.1.bb` so, will reproduce same problem I think.

It may hang from here which use resigiter directly  with asm code
in json-c

* https://github.com/json-c/json-c/blob/eae040a84a479ccad1d1c48314345c51ecf1a4a4/random_seed.c#L72
or

Think it's not related with openssl updates.

Thanks.
Comment 3 Adrian Bunk 2019-09-20 07:47:01 UTC
(In reply to comment #1)
> Can you reproduce the issue on a non-AMD builder?
> Also we'd like to know more about the exact branch and commit of oe-core
> used?
> Does it happen on master, there was a recent update to openssl that may be
> related. Any additional info would be appreciated or actually needed to make
> progress.

This is not related to OpenSSL.

RDRAND on latest Ryzen hardware has known problems, AFAIR there should be BIOS updates available that fix/workaround the problem.
Comment 4 Adrian Bunk 2019-09-20 08:10:03 UTC
I'll send a patch to remove the --enable-rdrand.
Comment 6 Armin Kuster 2019-10-13 19:38:33 UTC
closing