Received: by 10.223.176.46 with SMTP id f43csp1526283wra; Wed, 24 Jan 2018 18:49:47 -0800 (PST) X-Google-Smtp-Source: AH8x224hdW5UMRLTtBP2iecnvDPTWUrp+8Bcdy0z0AKnqDRrcBoz3qZ8yUBXhE6p/GpnAT8WzRTV X-Received: by 10.99.109.129 with SMTP id i123mr11621036pgc.346.1516848587850; Wed, 24 Jan 2018 18:49:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516848587; cv=none; d=google.com; s=arc-20160816; b=EP2gFSg6M/h6B8xh0TW/UeaLVYxhvbleNIVUPeXM2+0Gnn6vWcQ2+Zql46F8UDpOQ0 nqvZFC8dVAbYT4gwYiG3pezKPmNSkOkrdtLyz5TsnwYAVmUgAoytK9aYF+glNReZmGSo jl89QCUsBdoc4mYFSVRHCMwAgS3UJvDzak1sL9e+phd+Ngcnd4WL6kAbiTZAYi1mTPHS 1LedfAtcgWadbVok+8cB9iy5AYvDgYsQKvhM86WbbW0NjxnNWq6vDPNyinj4HdP2hLQX NiWAYdgYVp7cJFeqCim4zaNh2O/zOSwjZUZAeYERYmSok3/uckKFvX0qrqvBnjmM8gLw CXKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=m/GOCt+mi3LMMTOlalBneFBbn5kbdiV0jjNoyoOp/Rk=; b=qhkqtMjlyFz51Kw1UtCrgzX0yLKxsKqz3VVW5+WEPdDoYTEeCYSqDVl8sx/5S27ibr sZ5rFyg1iRfzJoGhpettFErdKFivNsK87xq44gS+m6kumemHRGxdyD4XjrsbjabiZGFl ONW6B/FTF//VA+Wby3LOdMXGt8Ceb4cvw3zhgZAZhYVxvwy+WXZEDwSG7qSAZzvJOfz6 NHSzGeeVPUBGilv75dKJeCj4o6e4wt6aV5N446MWTachwc45dhkxErWfolZ9saz6Eu+1 4u9KZgVN52QWaZpWRwNcOnfWFUn3MMtneqlnWNncmKoah7NNhq8BkVqjES8glOmMZ07A 46Lw== 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 6-v6si1172312plb.379.2018.01.24.18.49.33; Wed, 24 Jan 2018 18:49:47 -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 S933293AbeAYCsQ (ORCPT + 99 others); Wed, 24 Jan 2018 21:48:16 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53342 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932925AbeAYCsO (ORCPT ); Wed, 24 Jan 2018 21:48:14 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0B6A3C04AC4A; Thu, 25 Jan 2018 02:48:14 +0000 (UTC) Received: from localhost (ovpn-8-24.pek2.redhat.com [10.72.8.24]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B69D818ED1; Thu, 25 Jan 2018 02:48:11 +0000 (UTC) Date: Thu, 25 Jan 2018 10:48:08 +0800 From: Baoquan He To: Dou Liyang Cc: linux-kernel@vger.kernel.org, mingo@redhat.com, tglx@linutronix.de, hpa@zytor.com, x86@kernel.org, rostedt@goodmis.org, jgross@suse.com, peterz@infradead.org, uobergfe@redhat.com, joro@8bytes.org Subject: Re: [RESEND PATCH 3/3] x86/apic: Clean up the names of legacy irq mode setting related functions Message-ID: <20180125024808.GA5512@localhost.localdomain> References: <1515123732-28908-1-git-send-email-bhe@redhat.com> <20180105043929.GL7235@x1> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.1 (2017-09-22) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 25 Jan 2018 02:48:14 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/19/18 at 02:42pm, Dou Liyang wrote: > Hi Baoquan, > > At 01/05/2018 12:39 PM, Baoquan He wrote: > [...] > > /* > > - * Not an __init, needed by kexec/kdump code. > > - * For safety IO-APIC and Local APIC need be cleared before this. > > + * In legacy irq mode, full DOS compatibility with the uniprocessor PC/AT is > > + * provided by using the APICs in conjunction with standard 8259A-equivalent > > + * programmable interrupt controllers (PICs). It's necessary to deliver legacy > > + * interrupts even when APIC mode is not enabled. This is required by kexec/ > > + * kdump before enter into the 2nd kernel. > > */ > > void switch_to_legacy_irq_mode(void) > > { > > if (!nr_legacy_irqs()) > > return; > > - x86_io_apic_ops.disable(); > > + ioapic_set_virtual_wire_mode(); > > + > > + if (boot_cpu_has(X86_FEATURE_APIC) || apic_from_smp_config()) > > + lapic_set_legacy_irq_mode(ioapic_i8259.pin != -1); > > Seems these two function, ioapic/lapic_set_legacy_irq_mode should be > exclusive. > > But We do that because both the through-lapic and through-ioapic virtual > wire mode need setup the APIC_SPIV_APIC_ENABLED which is only located in > the lapic_set_legacy_irq_mode(). So we need call them both. > > IMO, this cleanup may not make it clear. we can separate these two mode > totally or just keep it like before. OK, I tried to find document about the virtual wire mode with through-ioapic, but failed. The code has been there for a long time and everything works well, that proves it's good. While the concept is still not clear to me, at least there isn't description to tell explicitly. And also we still need the x86_io_apic_ops.disable() hooker which irq remapping need to use as dou commented. So drop this clean up patch for now. I will repost the patchset including patch 1 and 2. Thanks Baoquan > > } > > #ifdef CONFIG_X86_32 > > diff --git a/arch/x86/kernel/x86_init.c b/arch/x86/kernel/x86_init.c > > index 1151ccd72ce9..c30f0f273dbd 100644 > > --- a/arch/x86/kernel/x86_init.c > > +++ b/arch/x86/kernel/x86_init.c > > @@ -148,5 +148,5 @@ void arch_restore_msi_irqs(struct pci_dev *dev) > > struct x86_io_apic_ops x86_io_apic_ops __ro_after_init = { > > .read = native_io_apic_read, > > - .disable = native_disable_io_apic, > > + .disable = switch_to_legacy_irq_mode, > > }; > > diff --git a/drivers/iommu/irq_remapping.c b/drivers/iommu/irq_remapping.c > > index 49721b4e1975..751472ddf536 100644 > > --- a/drivers/iommu/irq_remapping.c > > +++ b/drivers/iommu/irq_remapping.c > > @@ -37,7 +37,7 @@ static void irq_remapping_disable_io_apic(void) > > * now. > > */ > > if (boot_cpu_has(X86_FEATURE_APIC) || apic_from_smp_config()) > > - disconnect_bsp_APIC(0); > > + lapic_set_legacy_irq_mode(0); > > } > > static void __init irq_remapping_modify_x86_ops(void) > > > >