From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751576AbdKHJkU (ORCPT ); Wed, 8 Nov 2017 04:40:20 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:52050 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750817AbdKHJkR (ORCPT ); Wed, 8 Nov 2017 04:40:17 -0500 X-Google-Smtp-Source: ABhQp+StW2NWqZX18Sza7EUyCotBy8kYiOBaYDPpC9cwkN2B9Vz5sZEHxIXxtRX90SI/4IMYiv8zTA== Date: Wed, 8 Nov 2017 10:40:13 +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: <20171108094013.rx2t2dcvg5ohpab4@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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <43479a40-e336-702e-0fb9-66c32cb7bb5e@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: > > 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! Thanks, Ingo