RE: svn commit: r322076 - in head/sys: amd64/amd64 i386/i386 x86/include x86/x86
> From: owner-src-committ...@freebsd.org [mailto:owner-src- > committ...@freebsd.org] On Behalf Of Jung-uk Kim > Sent: Wednesday, August 9, 2017 10:03 > To: Dexuan Cui ; src-committ...@freebsd.org; svn-src- > a...@freebsd.org; svn-src-h...@freebsd.org > Cc: Yanmin Qiao ; Hongjiang Zhang > > Subject: Re: svn commit: r322076 - in head/sys: amd64/amd64 i386/i386 > x86/include x86/x86 > > On 08/09/2017 00:09, Dexuan Cui wrote: > > Hi jkim, > > The patch breaks FreeBSD VM on Hyper-V. > > > > identify_hypervisor() is moved from identify_cpu() to an earlier place, but > > the > global > > variable cpu_feature2 used by the function is still initialized in > > identify_cpu(). > > > > I'm not sure about the background of your patch. Can you please have a look? > > Can you please test the attached patch? > > Jung-uk Kim I tested the patch only with my x86_64 VM, and it worked. Thanks for the quick fix! -- Dexuan ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r322076 - in head/sys: amd64/amd64 i386/i386 x86/include x86/x86
On 08/09/2017 00:09, Dexuan Cui wrote: > Hi jkim, > The patch breaks FreeBSD VM on Hyper-V. > > identify_hypervisor() is moved from identify_cpu() to an earlier place, but > the global > variable cpu_feature2 used by the function is still initialized in > identify_cpu(). > > I'm not sure about the background of your patch. Can you please have a look? Can you please test the attached patch? Jung-uk Kim Index: sys/amd64/amd64/machdep.c === --- sys/amd64/amd64/machdep.c (revision 322319) +++ sys/amd64/amd64/machdep.c (working copy) @@ -1537,6 +1537,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) kmdp = init_ops.parse_preload_data(modulep); + identify_cpu(); identify_hypervisor(); /* Init basic tunables, hz etc */ @@ -1643,7 +1644,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) != NULL) vty_set_preferred(VTY_VT); - identify_cpu(); /* Final stage of CPU initialization */ + finishidentcpu(); /* Final stage of CPU initialization */ initializecpu(); /* Initialize CPU registers */ initializecpucache(); Index: sys/i386/include/md_var.h === --- sys/i386/include/md_var.h (revision 322319) +++ sys/i386/include/md_var.h (working copy) @@ -59,7 +59,6 @@ void doreti_popl_es(void) __asm(__STRING(doreti_po void doreti_popl_es_fault(void) __asm(__STRING(doreti_popl_es_fault)); void doreti_popl_fs(void) __asm(__STRING(doreti_popl_fs)); void doreti_popl_fs_fault(void) __asm(__STRING(doreti_popl_fs_fault)); -void finishidentcpu(void); void fill_based_sd(struct segment_descriptor *sdp, uint32_t base); void i686_pagezero(void *addr); void sse2_pagezero(void *addr); Index: sys/x86/include/x86_var.h === --- sys/x86/include/x86_var.h (revision 322319) +++ sys/x86/include/x86_var.h (working copy) @@ -115,6 +115,7 @@ void cpu_probe_amdc1e(void); void cpu_setregs(void); void dump_add_page(vm_paddr_t); void dump_drop_page(vm_paddr_t); +void finishidentcpu(void); void identify_cpu(void); void identify_hypervisor(void); void initializecpu(void); Index: sys/x86/x86/identcpu.c === --- sys/x86/x86/identcpu.c (revision 322319) +++ sys/x86/x86/identcpu.c (working copy) @@ -1372,23 +1372,12 @@ fix_cpuid(void) return (false); } -/* - * Final stage of CPU identification. - */ -#ifdef __i386__ +#ifdef __amd64__ void -finishidentcpu(void) -#else -void identify_cpu(void) -#endif { - u_int regs[4], cpu_stdext_disable; -#ifdef __i386__ - u_char ccr3; -#endif + u_int regs[4]; -#ifdef __amd64__ do_cpuid(0, regs); cpu_high = regs[0]; ((u_int *)&cpu_vendor)[0] = regs[1]; @@ -1401,8 +1390,20 @@ identify_cpu(void) cpu_procinfo = regs[1]; cpu_feature = regs[3]; cpu_feature2 = regs[2]; +} #endif +/* + * Final stage of CPU identification. + */ +void +finishidentcpu(void) +{ + u_int regs[4], cpu_stdext_disable; +#ifdef __i386__ + u_char ccr3; +#endif + cpu_vendor_id = find_cpu_vendor_id(); if (fix_cpuid()) { signature.asc Description: OpenPGP digital signature
RE: svn commit: r322076 - in head/sys: amd64/amd64 i386/i386 x86/include x86/x86
Hi jkim, The patch breaks FreeBSD VM on Hyper-V. identify_hypervisor() is moved from identify_cpu() to an earlier place, but the global variable cpu_feature2 used by the function is still initialized in identify_cpu(). I'm not sure about the background of your patch. Can you please have a look? Thanks, -- Dexuan > -Original Message- > From: owner-src-committ...@freebsd.org [mailto:owner-src- > committ...@freebsd.org] On Behalf Of Jung-uk Kim > Sent: Friday, August 4, 2017 23:57 > To: src-committ...@freebsd.org; svn-src-all@freebsd.org; svn-src- > h...@freebsd.org > Subject: svn commit: r322076 - in head/sys: amd64/amd64 i386/i386 > x86/include x86/x86 > > Author: jkim > Date: Sat Aug 5 06:56:46 2017 > New Revision: 322076 > URL: > https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsvnweb.fr > eebsd.org%2Fchangeset%2Fbase%2F322076&data=02%7C01%7Cdecui%40micr > osoft.com%7C5a826235e08b415fc3cb08d4dbcf2b80%7C72f988bf86f141af91ab > 2d7cd011db47%7C1%7C0%7C636375130217192047&sdata=%2BcZhlr%2B2zX5S > S1eA32fWMpzckNHOQlGz8UHLXCaUN0s%3D&reserved=0 > > Log: > Detect hypervisors early. We used to set lower hz on hypervisors by default > but it was broken since r273800 (and r278522, its MFC to stable/10) because > identify_cpu() is called too late, i.e., after init_param1(). > > MFC after: 3 days > > Modified: > head/sys/amd64/amd64/machdep.c > head/sys/i386/i386/machdep.c > head/sys/x86/include/x86_var.h > head/sys/x86/x86/identcpu.c > > Modified: head/sys/amd64/amd64/machdep.c > = > = > --- head/sys/amd64/amd64/machdep.cSat Aug 5 06:46:06 2017 > (r322075) > +++ head/sys/amd64/amd64/machdep.cSat Aug 5 06:56:46 2017 > (r322076) > @@ -1537,6 +1537,8 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) > > kmdp = init_ops.parse_preload_data(modulep); > > + identify_hypervisor(); > + > /* Init basic tunables, hz etc */ > init_param1(); > > > Modified: head/sys/i386/i386/machdep.c > = > = > --- head/sys/i386/i386/machdep.c Sat Aug 5 06:46:06 2017 > (r322075) > +++ head/sys/i386/i386/machdep.c Sat Aug 5 06:56:46 2017 > (r322076) > @@ -2185,6 +2185,8 @@ init386(int first) > else > init_static_kenv(NULL, 0); > > + identify_hypervisor(); > + > /* Init basic tunables, hz etc */ > init_param1(); > > > Modified: head/sys/x86/include/x86_var.h > = > = > --- head/sys/x86/include/x86_var.hSat Aug 5 06:46:06 2017 > (r322075) > +++ head/sys/x86/include/x86_var.hSat Aug 5 06:56:46 2017 > (r322076) > @@ -116,6 +116,7 @@ void cpu_setregs(void); > void dump_add_page(vm_paddr_t); > void dump_drop_page(vm_paddr_t); > void identify_cpu(void); > +void identify_hypervisor(void); > void initializecpu(void); > void initializecpucache(void); > bool fix_cpuid(void); > > Modified: head/sys/x86/x86/identcpu.c > = > = > --- head/sys/x86/x86/identcpu.c Sat Aug 5 06:46:06 2017 > (r322075) > +++ head/sys/x86/x86/identcpu.c Sat Aug 5 06:56:46 2017 > (r322076) > @@ -1252,7 +1252,7 @@ static const char *const vm_pnames[] = { > NULL > }; > > -static void > +void > identify_hypervisor(void) > { > u_int regs[4]; > @@ -1403,7 +1403,6 @@ identify_cpu(void) > cpu_feature2 = regs[2]; > #endif > > - identify_hypervisor(); > cpu_vendor_id = find_cpu_vendor_id(); > > if (fix_cpuid()) { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"