Received: by 10.223.185.116 with SMTP id b49csp1808819wrg; Sun, 11 Feb 2018 22:02:55 -0800 (PST) X-Google-Smtp-Source: AH8x226IWMTxvSIFoEvvdqVNt0fomcxosKFVgcH4OVbgFbbYL/B6AH7nK1vVFuTkPWKMzlRs2Spo X-Received: by 10.98.197.68 with SMTP id j65mr10484479pfg.93.1518415375545; Sun, 11 Feb 2018 22:02:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518415375; cv=none; d=google.com; s=arc-20160816; b=MEnpETFHb605E1aDZCK7f7o2yjqpAPedwgC+fFkMoXPyF9YvMpUSef5kZjjAo2Fosf +ZAW81fIR9459I7azr+kRZ2UegwloA6wmIlpJdVePZdDEA4rYwpFx/ViUJ10WWVMCP9V PkKUFYspNOhzII1I9uMYGf069ARrjuzPgZeOZI+I0UFVtRz9Kip9n2gJAGZz8zFyGY3K g5LhiTSr3nYazR21/C3l5W3Y3blGz9OuZ9KtWkKMzZv0Kly0RLxhwM0Fcxw1VBPBxCB/ tihgLjS2VOHo5ltWXfWt8f+Sm8sloJRRoJjB/JSzFFWaCLWZIoKb/0VeadDgQJd5HaoG h9+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:mime-version:user-agent :message-id:in-reply-to:date:references:cc:to:from :arc-authentication-results; bh=Gbhjz38AgEGeNjr3OHLvmkGoqEa8jDoql2eRYJ6vbQw=; b=G8CKg7vUkndmor+LPjw0EZZunDm2w71/Ux6gnuD2I8ivR60cbXL0gq/OYXH2b1e1z4 Tjod21OZI2Wp6iD9DSG5+7whs/+VpSr123Df0Wz6raiEmcr+KH+W5XlX0nOvl8KOP1WH PcrwcKrQybJHqMg4pVHehfPz9h4ntWPvhC2Nc0WRmYFcQSRLZJnc60Fpv76XRKYYlKVZ ekYSVraRQYn7jqQ+ofN5Rdf4X1wo9yej+z+jr0lI37+TRojOEqOOa8CTySOWbG2GoysO o2F6cr8+0JqYNfrWa7b313u5z+EwPUS1atBQaFs6Wl4jOAsq4QedYl2lDa6jWe6zpH7p prxQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p84si1958552pfj.67.2018.02.11.22.02.41; Sun, 11 Feb 2018 22:02:55 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751303AbeBLFMB (ORCPT + 99 others); Mon, 12 Feb 2018 00:12:01 -0500 Received: from out01.mta.xmission.com ([166.70.13.231]:57043 "EHLO out01.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750734AbeBLFMA (ORCPT ); Mon, 12 Feb 2018 00:12:00 -0500 Received: from in01.mta.xmission.com ([166.70.13.51]) by out01.mta.xmission.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1el6PH-0000IR-O0; Sun, 11 Feb 2018 22:11:59 -0700 Received: from 174-19-85-160.omah.qwest.net ([174.19.85.160] helo=x220.xmission.com) by in01.mta.xmission.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1el6PH-0002vI-0f; Sun, 11 Feb 2018 22:11:59 -0700 From: ebiederm@xmission.com (Eric W. Biederman) To: Dou Liyang Cc: Baoquan He , , , , , , , References: <20180209121008.28980-1-bhe@redhat.com> Date: Sun, 11 Feb 2018 23:11:41 -0600 In-Reply-To: (Dou Liyang's message of "Mon, 12 Feb 2018 12:06:10 +0800") Message-ID: <87wozi7pwy.fsf@xmission.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1el6PH-0002vI-0f;;;mid=<87wozi7pwy.fsf@xmission.com>;;;hst=in01.mta.xmission.com;;;ip=174.19.85.160;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX1+03s4Wjuvn/FHBOA68YdZDqCAbAHwh20U= X-SA-Exim-Connect-IP: 174.19.85.160 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on sa07.xmission.com X-Spam-Level: X-Spam-Status: No, score=0.5 required=8.0 tests=ALL_TRUSTED,BAYES_50, DCC_CHECK_NEGATIVE,TVD_RCVD_IP,T_TM2_M_HEADER_IN_MSG,XMSubLong autolearn=disabled version=3.4.1 X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.0 TVD_RCVD_IP Message was received from an IP address * 0.7 XMSubLong Long Subject * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa07 1397; Body=1 Fuz1=1 Fuz2=1] X-Spam-DCC: XMission; sa07 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ;Dou Liyang X-Spam-Relay-Country: X-Spam-Timing: total 227 ms - load_scoreonly_sql: 0.03 (0.0%), signal_user_changed: 3.0 (1.3%), b_tie_ro: 2.1 (0.9%), parse: 1.04 (0.5%), extract_message_metadata: 12 (5.2%), get_uri_detail_list: 1.91 (0.8%), tests_pri_-1000: 3.7 (1.6%), tests_pri_-950: 1.14 (0.5%), tests_pri_-900: 0.96 (0.4%), tests_pri_-400: 21 (9.4%), check_bayes: 20 (9.0%), b_tokenize: 7 (2.9%), b_tok_get_all: 7 (3.1%), b_comp_prob: 2.1 (0.9%), b_tok_touch_all: 2.9 (1.3%), b_finish: 0.63 (0.3%), tests_pri_0: 176 (77.6%), check_dkim_signature: 0.45 (0.2%), check_dkim_adsp: 2.7 (1.2%), tests_pri_500: 4.9 (2.1%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH v3 0/5] x86/apic: Fix restoring boot irq mode in reboot and kexec/kdump X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Dou Liyang writes: > Hi all, > > One thing confused me. > > The disconnect_bsp_APIC() may restore the interrupt delivery mode into > virtual wire mode. it uses the vector F as the spurious interrput, But, > IMO, using the vector 0xFF(SPURIOUS_APIC_VECTOR) may more suitable and > will give us more detail. Why the disconnect_bsp_APIC() use vector F > here? I would say this needs a documentation search before changing this. This code originates in: 208fb93162d5 ("[PATCH] kexec: x86_64: restore apic virtual wire mode on shutdown") The example in the Multi-Processor Specification v1.4 shows setting up the SPIV to vector 0x0f. I don't know what is canonical and what will interact best with DOS, and that erra of setup. The vector 0x0f seems an odd choice as it is below 0x20 putting it in the range of vectors that are reserved for processor exceptions. The constant SPURIOUS_APIC_VECTOR is definitely not something we want to be using at this point as that is a linux specific setting and used when Linux is up and running. So it is completely inapplicable. This is all about restoring how the apics were configured at boot time so it may be appropriate to copy and store this value, if it was not architectural. At a practical level at this point I suspect we are ok as the setting of the SPIV this way has not caused any known problems in the last decade. If someone wants to dig through the archtectural documents and the real world practice and find a better value and explain the change I would not oppose it. All I know for certain is using the constant SPURIOUS_APIC_VECTOR is completely inappropriate (as that constant is about how linux uses vectors) and thus the patch below is wrong. > diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c > index 25ddf02598d2..550deaad6a9a 100644 > --- a/arch/x86/kernel/apic/apic.c > +++ b/arch/x86/kernel/apic/apic.c > @@ -2130,7 +2130,7 @@ void disconnect_bsp_APIC(int virt_wire_setup) > value = apic_read(APIC_SPIV); > value &= ~APIC_VECTOR_MASK; > value |= APIC_SPIV_APIC_ENABLED; > - value |= 0xf; > + value |= SPURIOUS_APIC_VECTOR; > apic_write(APIC_SPIV, value); > > if (!virt_wire_setup) { > Eric