Le 03/07/2019 à 19:09, Justin Hibbits a écrit : > On Wed, 3 Jul 2019 18:12:51 +0200 > Laurent Vivier <laur...@vivier.eu> wrote: > >>> Le 3 juil. 2019 à 17:22, Laurent Vivier <laur...@vivier.eu> a >>> écrit : >>> >>> Le 03/07/2019 à 16:45, Peter Maydell a écrit : >>>> On Tue, 2 Jul 2019 at 13:39, Laurent Vivier <laur...@vivier.eu> >>>> wrote: >>>>> >>>>> The following changes since commit >>>>> 7d0e02405fc02a181319b1ab8681d2f72246b7c6: >>>>> >>>>> Merge remote-tracking branch >>>>> 'remotes/vivier2/tags/trivial-patches-pull-request' into staging >>>>> (2019-07-01 17:40:32 +0100) >>>>> >>>>> are available in the Git repository at: >>>>> >>>>> git://github.com/vivier/qemu.git tags/trivial-branch-pull-request >>>>> >>>>> for you to fetch changes up to >>>>> 7c955080d40ccc7952a0479bc160f2b048c0af53: >>>>> >>>>> docs/devel/testing: Fix typo in dockerfile path (2019-07-02 >>>>> 10:12:32 +0200) >>>>> >>>>> ---------------------------------------------------------------- >>>>> Fix typo, fix sys_cache_info() on FreeBSD/powerpc, >>>>> change virtio-rng default to urandom >>>>> >>>>> ---------------------------------------------------------------- >>>> >>>> Hi; this makes 'make check' fail on OSX: >>>> >>>> MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))} >>>> tests/test-char -m=quick -k --tap < /dev/null | >>>> ./scripts/tap-driver.pl --test-name="test-char" >>>> Assertion failed: ((isize & (isize - 1)) == 0), function >>>> init_cache_info, file >>>> /Users/pm215/src/qemu-for-merges/util/cacheinfo.c, line 179. >>>> >>>> I guess this is the sys_cache_info change. >>> >>> OK, I will try to reproduce the problem. >>> >>> I think before this patch (regarding the kind of change we have >>> introduced) isize and dsize were always set to 0 and then changed >>> to 16 in fallback_cache_info()... or perhaps MacOS X sysctlbyname() >>> needs a long. >> >> It seems MacOS X (x86_64) needs a long: >> >> #include <stdio.h> >> #include <sys/types.h> >> #include <sys/sysctl.h> >> >> int main(void) >> { >> long size; >> int ret; >> size_t len = sizeof(size); >> ret = sysctlbyname("hw.cachelinesize", &size, &len, NULL, 0); >> printf("ret %d size 0x%lx\n", ret, size); >> return 0; >> } >> $ cc -o cachesize cachesize.c >> $ ./cachesize >> ret 0 size 0x40 >> >> #include <stdio.h> >> #include <sys/types.h> >> #include <sys/sysctl.h> >> >> int main(void) >> { >> int size; >> int ret; >> size_t len = sizeof(size); >> ret = sysctlbyname("hw.cachelinesize", &size, &len, NULL, 0); >> printf("ret %d size 0x%x\n", ret, size); >> return 0; >> } >> $ cc -o cachesize cachesize.c >> $ ./cachesize >> ret 0 size 0x1737b1d2 >> $ sysctl hw.cachelinesize >> hw.cachelinesize: 64 >> >> But man page is not up-to-date: >> >> $ uname -r >> 17.7.0 >> $ man sysctl >> SYSCTL(8) BSD System Manager's Manual >> SYSCTL(8) … >> The string and integer information is summarized below. For a >> detailed description of these variable see sysctl(3). >> >> The changeable column indicates whether a process with >> appropriate privi- lege can change the value. String and integer >> values can be set using sysctl. >> >> Name Type >> Changeable … >> hw.cachelinesize integer no >> … >> >> In fact, it is in sysctl(3): >> >> SYSCTL(3) BSD Library Functions Manual >> SYSCTL(3) … >> CTL_HW >> The string and integer information available for the CTL_HW >> level is detailed below. The changeable column shows whether a >> process with appropriate privilege may change the value. >> >> Name Type Changeable >> ... >> hw.cachelinesize int64_t no >> >> I will try to check on MacOS/X ppc and ppc64. >> >> Thanks, >> Laurent >> > > It's not listed in the man page for ppc(64), but examining the XNU > source for the version that matches 10.5.8 (last ppc-supporting kernel) > it's a CTLTYPE_INT. So, it may be different depending on arch and/or > OS X version. Does QEmu even support 10.5.x or Mac OS/ppc* anymore? I > had read somewhere that it was unsupported now (2.4.x is the latest one > in Tigerbrew).
in bsd/sys/sysctl.h, for latest xnu (xnu-4903.221.2, 10.14.1), I have also CTLTYPE_INT. I think the thing to do is change the type only for FreeBSD and keep "long" for APPLE. Thanks, Laurent