Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1426409ybk; Thu, 21 May 2020 06:41:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx6j8abfXhZtwpqnUkV6p51MG+o2VIPdmpt7zgPrK/QzCAdpqbIGciN7sT9i00OmpgtEG78 X-Received: by 2002:a05:6402:22a6:: with SMTP id cx6mr7830221edb.76.1590068468787; Thu, 21 May 2020 06:41:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590068468; cv=none; d=google.com; s=arc-20160816; b=iJI9Wgboj90vhZ7olSG6LyWIY+PxGycqG4T1CyOBqCAHuuN6UHPEqqu84FHbfXrwjt 0+dexIS6wnAq3gf+wCjBKIrsgWsZo7XmkjF8RWDoPTF0nUjdHg/5zmgIAH+jU4zj4Etx pxRx50POEc2RVBPNEziXseTwWkO9RfUsyXWjsPUTzv3UfQSg9EdboKuvyRloARCtI0yB EsrYNGQbASYqnli0MzF3wDBCe6vQyY9ayGAS0I6HJHoZfLMIGOOaKCPO3pDh5qacsbgf 5cfD8bLFn4aTfZII3zo1M8TNL/dMBQWBQwXAu7wj5/S1fTkaaIIij4tHzGmCniLchWg4 cQQQ== 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:from:references:cc:to:subject:dkim-signature; bh=k9apolne3MOvgFYAOik7xpjgAh+OTAjNzLgbnviUZnk=; b=ia7nz3GUbI/ZPx8Tw2Wk8oNOj5A0EGUZVHNDe6Vt0Bsn/4OlP8OJDkmNDGkDZ/YsW3 PHFTK9ALT1htTOykfrt1Lrr12Fvdi/B7bKychZnTHVN1+UKvuopuvWM/MJzORDkMXdeF WfkK1zANZsX2A/fPjtF0/RQxHofLgGY7Q3t/B/KTKVDWnB901Mbje9VLu0x6irEW0/vg KqP7Akbi70L7olNL9ipEzlFEeMrbt9OAhxXXbokzlBXe5GvMNHz2w1b/wMZKceazQAXH hBtOK8/tuYMQNtlQu5ssp4q5M2nnEXBFnon0pKE7jJlQhIhGUA8fLBHBWLw/5EPjyCFQ NDfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AXRwkhmq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o25si3265168ejx.662.2020.05.21.06.40.45; Thu, 21 May 2020 06:41:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AXRwkhmq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729486AbgEUNhF (ORCPT + 99 others); Thu, 21 May 2020 09:37:05 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:33708 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729465AbgEUNhE (ORCPT ); Thu, 21 May 2020 09:37:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1590068222; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=k9apolne3MOvgFYAOik7xpjgAh+OTAjNzLgbnviUZnk=; b=AXRwkhmqPkT64SYv0SbnJGSyYtwBJXtewTxpidcxm7k0j0DpL3fJqibsvALgwJ6YNw+ed7 74ByJAX5PrdnM41W9hEK+PuXZXQb2cecVexhpFcjWTVMW27weP/VHUwMSSZYLE0MmdA365 fpBfl7X3WaclJHav2Uf/yk6ptbxMjAA= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-340-FJjzo88eN2W6x-WCltxcdw-1; Thu, 21 May 2020 09:36:58 -0400 X-MC-Unique: FJjzo88eN2W6x-WCltxcdw-1 Received: by mail-wm1-f69.google.com with SMTP id o8so1009402wmd.0 for ; Thu, 21 May 2020 06:36:58 -0700 (PDT) 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:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=k9apolne3MOvgFYAOik7xpjgAh+OTAjNzLgbnviUZnk=; b=Gd1TigpIQ4Jtozcrl23WlwRhwQXupEKFSzBQSnZQLZR/5hLZnXtUgFmXW0lzaAeo+t xWeeG/AAQnBYDt9vQvDf1GCHkr3nGUAo4XnFDNsZtooNxOcD2S4fJPJ+dpNqeXwwmjmB g6b8DqcCPYKHxwjAJEaSpntiYM5LozYkF2YfKmrBqzds/TpIHcrL7MTMpHoo5xqAJQRB sg9T3+J9HU1/1Vgg0mmRHNjy93x+WGV6wO8g0zh1EEOHRdFXbOhF3fk1/K/chq8AhOxP xPIU0of4xfFkPRthMusv3LBz42w2MJY0AL4oC55lMkG4PLVwL9s+tlMkKaY9BqKIkvFQ 9S7Q== X-Gm-Message-State: AOAM533qhQGsgP+lLzHglheA8uwsXXaUMSfS6yjGFna8lak7s7QcDtQq qrVM+rysO9xzAcX1QTM616w4bVQc6bQpP4JZDk84yoxzL8Az0aGF8wfw81CVS5Rr0iLWGDr/nnm pBB+03Uyg/fcpEsBzwZ7MbWV0 X-Received: by 2002:a1c:3bc5:: with SMTP id i188mr8856755wma.90.1590068217485; Thu, 21 May 2020 06:36:57 -0700 (PDT) X-Received: by 2002:a1c:3bc5:: with SMTP id i188mr8856739wma.90.1590068217245; Thu, 21 May 2020 06:36:57 -0700 (PDT) Received: from [192.168.178.58] ([151.30.94.134]) by smtp.gmail.com with ESMTPSA id r9sm7484013wra.52.2020.05.21.06.36.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 21 May 2020 06:36:56 -0700 (PDT) Subject: Re: [PATCH v3] kvm/x86 : Remove redundant function implement To: =?UTF-8?B?5b2t5rWpKFJpY2hhcmQp?= Cc: "linux-kernel@vger.kernel.org" , "kvm@vger.kernel.org" References: From: Paolo Bonzini Message-ID: <5f2a3d25-adbf-26c2-4c2e-43d1a7abab97@redhat.com> Date: Thu, 21 May 2020 15:36:56 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=gbk Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 21/05/20 07:57, ????(Richard) wrote: > pic_in_kernel(),ioapic_in_kernel() and irqchip_kernel() have the > same implementation. > > Signed-off-by: Peng Hao > --- > arch/x86/kvm/ioapic.h | 8 ++------ > arch/x86/kvm/irq.h | 14 ++++---------- > arch/x86/kvm/lapic.c | 1 + > arch/x86/kvm/mmu/mmu.c | 1 + > arch/x86/kvm/x86.c | 1 + > 5 files changed, 9 insertions(+), 16 deletions(-) > > diff --git a/arch/x86/kvm/ioapic.h b/arch/x86/kvm/ioapic.h > index 2fb2e3c..7a3c53b 100644 > --- a/arch/x86/kvm/ioapic.h > +++ b/arch/x86/kvm/ioapic.h > @@ -5,7 +5,7 @@ > #include > > #include > - > +#include "irq.h" > struct kvm; > struct kvm_vcpu; > > @@ -108,11 +108,7 @@ do {\ > > static inline int ioapic_in_kernel(struct kvm *kvm) > { > -int mode = kvm->arch.irqchip_mode; > - > -/* Matches smp_wmb() when setting irqchip_mode */ > -smp_rmb(); > -return mode == KVM_IRQCHIP_KERNEL; > +return irqchip_kernel(kvm); > } > > void kvm_rtc_eoi_tracking_restore_one(struct kvm_vcpu *vcpu); > diff --git a/arch/x86/kvm/irq.h b/arch/x86/kvm/irq.h > index f173ab6..e133c1a 100644 > --- a/arch/x86/kvm/irq.h > +++ b/arch/x86/kvm/irq.h > @@ -16,7 +16,6 @@ > #include > > #include > -#include "ioapic.h" > #include "lapic.h" > > #define PIC_NUM_PINS 16 > @@ -66,15 +65,6 @@ void kvm_pic_destroy(struct kvm *kvm); > int kvm_pic_read_irq(struct kvm *kvm); > void kvm_pic_update_irq(struct kvm_pic *s); > > -static inline int pic_in_kernel(struct kvm *kvm) > -{ > -int mode = kvm->arch.irqchip_mode; > - > -/* Matches smp_wmb() when setting irqchip_mode */ > -smp_rmb(); > -return mode == KVM_IRQCHIP_KERNEL; > -} > - > static inline int irqchip_split(struct kvm *kvm) > { > int mode = kvm->arch.irqchip_mode; > @@ -93,6 +83,10 @@ static inline int irqchip_kernel(struct kvm *kvm) > return mode == KVM_IRQCHIP_KERNEL; > } > > +static inline int pic_in_kernel(struct kvm *kvm) > +{ > +return irqchip_kernel(kvm); > +} > static inline int irqchip_in_kernel(struct kvm *kvm) > { > int mode = kvm->arch.irqchip_mode; > diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c > index 9af25c9..de4d046 100644 > --- a/arch/x86/kvm/lapic.c > +++ b/arch/x86/kvm/lapic.c > @@ -36,6 +36,7 @@ > #include > #include "kvm_cache_regs.h" > #include "irq.h" > +#include "ioapic.h" > #include "trace.h" > #include "x86.h" > #include "cpuid.h" > diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c > index 8071952..6133f69 100644 > --- a/arch/x86/kvm/mmu/mmu.c > +++ b/arch/x86/kvm/mmu/mmu.c > @@ -16,6 +16,7 @@ > */ > > #include "irq.h" > +#include "ioapic.h" > #include "mmu.h" > #include "x86.h" > #include "kvm_cache_regs.h" > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > index d786c7d..c8b62ac 100644 > --- a/arch/x86/kvm/x86.c > +++ b/arch/x86/kvm/x86.c > @@ -18,6 +18,7 @@ > > #include > #include "irq.h" > +#include "ioapic.h" > #include "mmu.h" > #include "i8254.h" > #include "tss.h" > -- > 2.7.4 > > ________________________________ > OPPO > > ???????ʼ????丽??????OPPO??˾?ı?????Ϣ?????????ʼ?ָ?????ռ???ʹ?ã????????˼?Ⱥ?飩????ֹ?κ?????δ????Ȩ???????????κ???ʽʹ?á????????????˱??ʼ??????????Ե????ʼ?֪ͨ?????˲?ɾ?????ʼ????丽???? > > This e-mail and its attachments contain confidential information from OPPO, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it! > Queued, thanks. Paolo