From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751950AbdKHJ7B (ORCPT ); Wed, 8 Nov 2017 04:59:01 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:56403 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751181AbdKHJ67 (ORCPT ); Wed, 8 Nov 2017 04:58:59 -0500 X-Google-Smtp-Source: ABhQp+SS96n6QGT1L+tCM+g8zKAV8Xki0raz9A5F1Wfo6izMR3Ir5CE13snxGYGl1bdHrlmeEHkc4w== Date: Wed, 8 Nov 2017 10:58:54 +0100 From: Ingo Molnar To: Juergen Gross Cc: linux-kernel@vger.kernel.org, x86@kernel.org, kvm@vger.kernel.org, xen-devel@lists.xenproject.org, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, boris.ostrovsky@oracle.com, pbonzini@redhat.com, rkrcmar@redhat.com, rjw@rjwysocki.net, len.brown@intel.com, pavel@ucw.cz Subject: Re: [PATCH 2/3] x86: add guest_late_init hook to hypervisor_x86 structure Message-ID: <20171108095854.b7gqsc44x4jl7b4b@gmail.com> References: <20171108090739.26491-1-jgross@suse.com> <20171108090739.26491-3-jgross@suse.com> <20171108091323.kidsiiim2mqenphf@gmail.com> <43479a40-e336-702e-0fb9-66c32cb7bb5e@suse.com> <20171108094013.rx2t2dcvg5ohpab4@gmail.com> <7ee9d814-9845-8145-d30a-9570f7cb43d8@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7ee9d814-9845-8145-d30a-9570f7cb43d8@suse.com> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Juergen Gross wrote: > On 08/11/17 10:40, Ingo Molnar wrote: > > > > * Juergen Gross wrote: > > > >>> Plus add a default empty function (which hypervisors can override). This avoids > >>> all the hidden conditions and wrappery. > >> > >> Hmm, x86_hyper is just a pointer being NULL on bare metal. So we would > >> have to add a pre-filled struct with dummy functions and in case a > >> hypervisor is detected we'd need to copy all non-NULL pointers of the > >> hypervisor specific struct to the pre-filled one. > > > > Ok, I missed that detail - but yeah, since this is mostly about boot code, > > where readability is king, I still think it would be an overall improvement. > > > > This is the pattern we are trying to use with x86_platform ops for example, and > > doing: > > > > git grep -w x86_platform arch/x86 > > > > gives a pretty clear idea about how it's used - while if it was all within > > wrappers it would be a lot more difficult to discover all the callsites. > > > > Admittedly it's not done totally consistently: > > > > arch/x86/kernel/apic/probe_32.c: if (x86_platform.apic_post_init) > > arch/x86/kernel/apic/probe_64.c: if (x86_platform.apic_post_init) > > arch/x86/kernel/ebda.c: if (!x86_platform.legacy.reserve_bios_regions) > > arch/x86/kernel/platform-quirks.c: if (x86_platform.set_legacy_features) > > arch/x86/platform/intel-mid/device_libs/platform_mrfld_rtc.c: if (!x86_platform.legacy.rtc) > > > > ... but the _idea_ behind it is consistent ;-) > > > >> In case there are no objections I can add a patch to modify the current > >> way x86_hyper is used to the pre-filled variant. > > > > Yeah, sounds good to me! > > Okay. With you mentioning x86_platform: should I make x86_hyper a member > of x86_platform (e.g. x86_platform.hyper.) ? > > I think this would fit quite nice. Yeah, seems like a good idea! Thanks, Ingo