Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp585914ybx; Tue, 5 Nov 2019 02:20:06 -0800 (PST) X-Google-Smtp-Source: APXvYqxv5E6QQ4OGYPpih3+yRwe62l//5jN7cvGiExio4Ei6UXCpt0csxaiRmTANkIiYTXahF1ay X-Received: by 2002:a17:906:4a0c:: with SMTP id w12mr11181133eju.306.1572949206144; Tue, 05 Nov 2019 02:20:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572949206; cv=none; d=google.com; s=arc-20160816; b=C9jx1T3LfLuj21ySeR5+68LDhSOYW9XT3sdsSoluLkv/+YtXGPlFagjXOsZTtw2IWo IF44TzcxsCs4xnCZd6oZa8XsVgJbPcgiJDRTppNFftwUVl0R2UGLYLuFOJlQDSSo86/i g+jT6fUb6Z9a4FBlmn0xUwFByfrRxykrAJqcL0DSr1lz2XgUhSKheSlj/Jd8PWVir3GQ aLAo9Cpi3u1xagYcIS+IeFwjFDWK30PJMvod4TOqCSdBjFI3Gbq/SLgrgENFJSaPvxjb JZJQ4B2nRFvv5GoZ1Bw5TIXnhc5TkTksCpycDhg8HUtaYFQ/XNQg309fUYGClAxbHFVb PCpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:openpgp:from:references:cc:to:subject; bh=uZAUo/E5wcRqgEhwSboeuriam4SODw3m8iem1VMN08Q=; b=FfjrcKrcBu8lqffEuVQckG1Me/J4sPG0bjagro2/jBldGlRZHCXx3Y4sc4ksIL5D96 YMizpGYdJHrskyphq0DxROM92JjiFRKuOt0aDO6bMmm/MY1q0gxFb3jKQtHhtOLvGuZL zwyDSFLB/9HvhHD2i0jn6CKgqGyDwm12VWf4Y1HBi/nFC9jWEhB+cgVFZpG9UGwCt47t WJ7a9v3sXb6SQFdi19XzE7JhJUWFouXbezZa+8jCRpwnqlNV5S801KueJo9YTvF4rk+R V4PTvBIsID/+PEsyqy2AqLm8eLx6KrpIjRU7mAuuSewX7MDaCHH/itvsO9n12XkDPiNK G0Qw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h19si4712900ejx.34.2019.11.05.02.19.42; Tue, 05 Nov 2019 02:20:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388415AbfKEKQX (ORCPT + 99 others); Tue, 5 Nov 2019 05:16:23 -0500 Received: from mx1.redhat.com ([209.132.183.28]:2985 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388283AbfKEKQX (ORCPT ); Tue, 5 Nov 2019 05:16:23 -0500 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 77B0283F40 for ; Tue, 5 Nov 2019 10:16:22 +0000 (UTC) Received: by mail-wm1-f69.google.com with SMTP id d140so6999109wmd.1 for ; Tue, 05 Nov 2019 02:16:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=uZAUo/E5wcRqgEhwSboeuriam4SODw3m8iem1VMN08Q=; b=VVE8hzM5c8Yo1L0BuRRWzoI9gwY6VgXX5it11mtWIQR+HSjcQemCKuNF0CBwYMUtw/ iKEwdb3XdKsVOPXJulhyc3YCfjxX1H8Vhzw/mnzJIVbH6qqkv5hW0lKMXgmGzw04P9uA a3YLFEGvoAteZpwc2de2zbLIQIDy6PZnV5LJE4rVT20kSYMyvO+bB2CkihbcyUhBRPgq Jxtg2wpQqMHL/h+wjeA2HLKxHrl3ZCMNVBwOxajuHkI6NWtDi1HWjrz1yuWRD8JuGGRQ zvn5eQXZBmad58vkFETNHSauPRF2TP6xX/letU4UTw8H/3w4CGGQOgOuohSdNMb7O1uL j8sA== X-Gm-Message-State: APjAAAW2fDGkXNtzDm0ehsXBuMVZ9CRIfw/PPNl9IsiuOf6zUYWV6E9Q Jhkk5rFGN50jXbP6Wp05qF9Zmt/avmp6/LV0sOiTRwhOnGLxM6ZnkbGWl0s3vesr6ug9t3AqV35 U0edPvbAgQ1PxnFmExg4DXg8O X-Received: by 2002:a1c:a556:: with SMTP id o83mr3277641wme.165.1572948980956; Tue, 05 Nov 2019 02:16:20 -0800 (PST) X-Received: by 2002:a1c:a556:: with SMTP id o83mr3277615wme.165.1572948980663; Tue, 05 Nov 2019 02:16:20 -0800 (PST) Received: from ?IPv6:2001:b07:6468:f312:4051:461:136e:3f74? ([2001:b07:6468:f312:4051:461:136e:3f74]) by smtp.gmail.com with ESMTPSA id b3sm12440889wmj.44.2019.11.05.02.16.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 05 Nov 2019 02:16:20 -0800 (PST) Subject: Re: [PATCH 06/13] KVM: monolithic: x86: remove __exit section prefix from machine_unsetup To: Andrea Arcangeli , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Vitaly Kuznetsov , Sean Christopherson References: <20191104230001.27774-1-aarcange@redhat.com> <20191104230001.27774-7-aarcange@redhat.com> From: Paolo Bonzini Openpgp: preference=signencrypt Message-ID: Date: Tue, 5 Nov 2019 11:16:19 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20191104230001.27774-7-aarcange@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/11/19 23:59, Andrea Arcangeli wrote: > Adjusts the section prefixes of some KVM x86 code function because > with the monolithic KVM model the section checker can now do a more > accurate static analysis at build time and it found a potentially > kernel crashing bug. This also allows to build without > CONFIG_SECTION_MISMATCH_WARN_ONLY=n. > > The __exit removed from machine_unsetup is because > kvm_arch_hardware_unsetup() is called by kvm_init() which is in the > __init section. It's not allowed to call a function located in the > __exit section and dropped during the kernel link from the __init > section or the kernel will crash if that call is made. > > Signed-off-by: Andrea Arcangeli > --- > arch/x86/include/asm/kvm_host.h | 4 ++-- > arch/x86/kvm/svm.c | 2 +- > arch/x86/kvm/vmx/vmx.c | 2 +- > 3 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h > index b36dd3265036..2b03ec80f6d7 100644 > --- a/arch/x86/include/asm/kvm_host.h > +++ b/arch/x86/include/asm/kvm_host.h > @@ -1004,7 +1004,7 @@ extern int kvm_x86_hardware_enable(void); > extern void kvm_x86_hardware_disable(void); > extern __init int kvm_x86_check_processor_compatibility(void); > extern __init int kvm_x86_hardware_setup(void); > -extern __exit void kvm_x86_hardware_unsetup(void); > +extern void kvm_x86_hardware_unsetup(void); > extern bool kvm_x86_cpu_has_accelerated_tpr(void); > extern bool kvm_x86_has_emulated_msr(int index); > extern void kvm_x86_cpuid_update(struct kvm_vcpu *vcpu); > @@ -1196,7 +1196,7 @@ struct kvm_x86_ops { > void (*hardware_disable)(void); > int (*check_processor_compatibility)(void);/* __init */ > int (*hardware_setup)(void); /* __init */ > - void (*hardware_unsetup)(void); /* __exit */ > + void (*hardware_unsetup)(void); > bool (*cpu_has_accelerated_tpr)(void); > bool (*has_emulated_msr)(int index); > void (*cpuid_update)(struct kvm_vcpu *vcpu); > diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c > index 1705608246fb..4ce102f6f075 100644 > --- a/arch/x86/kvm/svm.c > +++ b/arch/x86/kvm/svm.c > @@ -1412,7 +1412,7 @@ __init int kvm_x86_hardware_setup(void) > return r; > } > > -__exit void kvm_x86_hardware_unsetup(void) > +void kvm_x86_hardware_unsetup(void) > { > int cpu; > > diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c > index 9c5f0c67b899..e406707381a4 100644 > --- a/arch/x86/kvm/vmx/vmx.c > +++ b/arch/x86/kvm/vmx/vmx.c > @@ -7737,7 +7737,7 @@ __init int kvm_x86_hardware_setup(void) > return r; > } > > -__exit void kvm_x86_hardware_unsetup(void) > +void kvm_x86_hardware_unsetup(void) > { > if (nested) > nested_vmx_hardware_unsetup(); > Queued, thanks. Paolo