The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: mingo@kernel.org, pavel@ucw.cz, hpa@zytor.com,
	linux-kernel@vger.kernel.org
Cc: linux-tip-commits@vger.kernel.org
Subject: Re: [tip:x86/urgent] x86/apic: Switch all APICs to Fixed delivery mode
Date: Fri, 29 Dec 2017 14:35:38 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.20.1712291434110.1899@nanos> (raw)
In-Reply-To: <tip-a31e58e129f73ab5b04016330b13ed51fde7a961@git.kernel.org>

On Fri, 29 Dec 2017, tip-bot for Thomas Gleixner wrote:

> Commit-ID:  a31e58e129f73ab5b04016330b13ed51fde7a961
> Gitweb:     https://git.kernel.org/tip/a31e58e129f73ab5b04016330b13ed51fde7a961
> Author:     Thomas Gleixner <tglx@linutronix.de>
> AuthorDate: Thu, 28 Dec 2017 11:33:33 +0100
> Committer:  Thomas Gleixner <tglx@linutronix.de>
> CommitDate: Fri, 29 Dec 2017 14:20:48 +0100
> 
> x86/apic: Switch all APICs to Fixed delivery mode

Note, the patch itself is unchanged. I merily amended the change log to
point out that fixed delivery mode is already used on this kind of systems
so the risk of this change is very low.

Thanks,

	tglx

> Some of the APIC incarnations are operating in lowest priority delivery
> mode. This worked as long as the vector management code allocated the same
> vector on all possible CPUs for each interrupt.
> 
> Lowest priority delivery mode does not necessarily respect the affinity
> setting and may redirect to some other online CPU. This was documented
> somewhere in the old code and the conversion to single target delivery
> missed to update the delivery mode of the affected APIC drivers which
> results in spurious interrupts on some of the affected CPU/Chipset
> combinations.
> 
> Switch the APIC drivers over to Fixed delivery mode and remove all
> leftovers of lowest priority delivery mode.
> 
> Switching to Fixed delivery mode is not a problem on these CPUs because the
> kernel already uses Fixed delivery mode for IPIs. The reason for this is
> that th SDM explicitely forbids lowest prio mode for IPIs. The reason is
> obvious: If the irq routing does not honor destination targets in lowest
> prio mode then an IPI targeted at CPU1 might end up on CPU0, which would be
> a fatal problem in many cases.
> 
> As a consequence of this change, the apic::irq_delivery_mode field is now
> pointless, but this needs to be cleaned up in a separate patch.
> 
> Fixes: fdba46ffb4c2 ("x86/apic: Get rid of multi CPU affinity")
> Reported-by: vcaputo@pengaru.com
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> Tested-by: vcaputo@pengaru.com
> Cc: Pavel Machek <pavel@ucw.cz>
> Link: https://lkml.kernel.org/r/alpine.DEB.2.20.1712281140440.1688@nanos
> ---
>  arch/x86/kernel/apic/apic_flat_64.c   | 2 +-
>  arch/x86/kernel/apic/apic_noop.c      | 2 +-
>  arch/x86/kernel/apic/msi.c            | 8 ++------
>  arch/x86/kernel/apic/probe_32.c       | 2 +-
>  arch/x86/kernel/apic/x2apic_cluster.c | 2 +-
>  drivers/pci/host/pci-hyperv.c         | 8 ++------
>  6 files changed, 8 insertions(+), 16 deletions(-)
> 
> diff --git a/arch/x86/kernel/apic/apic_flat_64.c b/arch/x86/kernel/apic/apic_flat_64.c
> index aa85690..25a8702 100644
> --- a/arch/x86/kernel/apic/apic_flat_64.c
> +++ b/arch/x86/kernel/apic/apic_flat_64.c
> @@ -151,7 +151,7 @@ static struct apic apic_flat __ro_after_init = {
>  	.apic_id_valid			= default_apic_id_valid,
>  	.apic_id_registered		= flat_apic_id_registered,
>  
> -	.irq_delivery_mode		= dest_LowestPrio,
> +	.irq_delivery_mode		= dest_Fixed,
>  	.irq_dest_mode			= 1, /* logical */
>  
>  	.disable_esr			= 0,
> diff --git a/arch/x86/kernel/apic/apic_noop.c b/arch/x86/kernel/apic/apic_noop.c
> index 7b659c4..5078b5c 100644
> --- a/arch/x86/kernel/apic/apic_noop.c
> +++ b/arch/x86/kernel/apic/apic_noop.c
> @@ -110,7 +110,7 @@ struct apic apic_noop __ro_after_init = {
>  	.apic_id_valid			= default_apic_id_valid,
>  	.apic_id_registered		= noop_apic_id_registered,
>  
> -	.irq_delivery_mode		= dest_LowestPrio,
> +	.irq_delivery_mode		= dest_Fixed,
>  	/* logical delivery broadcast to all CPUs: */
>  	.irq_dest_mode			= 1,
>  
> diff --git a/arch/x86/kernel/apic/msi.c b/arch/x86/kernel/apic/msi.c
> index 9b18be7..ce503c9 100644
> --- a/arch/x86/kernel/apic/msi.c
> +++ b/arch/x86/kernel/apic/msi.c
> @@ -39,17 +39,13 @@ static void irq_msi_compose_msg(struct irq_data *data, struct msi_msg *msg)
>  		((apic->irq_dest_mode == 0) ?
>  			MSI_ADDR_DEST_MODE_PHYSICAL :
>  			MSI_ADDR_DEST_MODE_LOGICAL) |
> -		((apic->irq_delivery_mode != dest_LowestPrio) ?
> -			MSI_ADDR_REDIRECTION_CPU :
> -			MSI_ADDR_REDIRECTION_LOWPRI) |
> +		MSI_ADDR_REDIRECTION_CPU |
>  		MSI_ADDR_DEST_ID(cfg->dest_apicid);
>  
>  	msg->data =
>  		MSI_DATA_TRIGGER_EDGE |
>  		MSI_DATA_LEVEL_ASSERT |
> -		((apic->irq_delivery_mode != dest_LowestPrio) ?
> -			MSI_DATA_DELIVERY_FIXED :
> -			MSI_DATA_DELIVERY_LOWPRI) |
> +		MSI_DATA_DELIVERY_FIXED |
>  		MSI_DATA_VECTOR(cfg->vector);
>  }
>  
> diff --git a/arch/x86/kernel/apic/probe_32.c b/arch/x86/kernel/apic/probe_32.c
> index fa22017..02e8acb 100644
> --- a/arch/x86/kernel/apic/probe_32.c
> +++ b/arch/x86/kernel/apic/probe_32.c
> @@ -105,7 +105,7 @@ static struct apic apic_default __ro_after_init = {
>  	.apic_id_valid			= default_apic_id_valid,
>  	.apic_id_registered		= default_apic_id_registered,
>  
> -	.irq_delivery_mode		= dest_LowestPrio,
> +	.irq_delivery_mode		= dest_Fixed,
>  	/* logical delivery broadcast to all CPUs: */
>  	.irq_dest_mode			= 1,
>  
> diff --git a/arch/x86/kernel/apic/x2apic_cluster.c b/arch/x86/kernel/apic/x2apic_cluster.c
> index 622f13c..8b04234 100644
> --- a/arch/x86/kernel/apic/x2apic_cluster.c
> +++ b/arch/x86/kernel/apic/x2apic_cluster.c
> @@ -184,7 +184,7 @@ static struct apic apic_x2apic_cluster __ro_after_init = {
>  	.apic_id_valid			= x2apic_apic_id_valid,
>  	.apic_id_registered		= x2apic_apic_id_registered,
>  
> -	.irq_delivery_mode		= dest_LowestPrio,
> +	.irq_delivery_mode		= dest_Fixed,
>  	.irq_dest_mode			= 1, /* logical */
>  
>  	.disable_esr			= 0,
> diff --git a/drivers/pci/host/pci-hyperv.c b/drivers/pci/host/pci-hyperv.c
> index 0fe3ea1..e7d9447 100644
> --- a/drivers/pci/host/pci-hyperv.c
> +++ b/drivers/pci/host/pci-hyperv.c
> @@ -985,9 +985,7 @@ static u32 hv_compose_msi_req_v1(
>  	int_pkt->wslot.slot = slot;
>  	int_pkt->int_desc.vector = vector;
>  	int_pkt->int_desc.vector_count = 1;
> -	int_pkt->int_desc.delivery_mode =
> -		(apic->irq_delivery_mode == dest_LowestPrio) ?
> -			dest_LowestPrio : dest_Fixed;
> +	int_pkt->int_desc.delivery_mode = dest_Fixed;
>  
>  	/*
>  	 * Create MSI w/ dummy vCPU set, overwritten by subsequent retarget in
> @@ -1008,9 +1006,7 @@ static u32 hv_compose_msi_req_v2(
>  	int_pkt->wslot.slot = slot;
>  	int_pkt->int_desc.vector = vector;
>  	int_pkt->int_desc.vector_count = 1;
> -	int_pkt->int_desc.delivery_mode =
> -		(apic->irq_delivery_mode == dest_LowestPrio) ?
> -			dest_LowestPrio : dest_Fixed;
> +	int_pkt->int_desc.delivery_mode = dest_Fixed;
>  
>  	/*
>  	 * Create MSI w/ dummy vCPU set targeting just one vCPU, overwritten
> 

  reply	other threads:[~2017-12-29 13:35 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-15 10:05 thinkpad x60: sound problems in 4.14.0-next-20171114 Pavel Machek
2017-11-15 10:43 ` Takashi Iwai
2017-11-15 11:11   ` Pavel Machek
2017-11-15 11:14     ` Takashi Iwai
2017-11-20 23:25       ` Pavel Machek
2017-11-27 16:30     ` thinkpad x60: sound problems in 4.15-rc1 was " Pavel Machek
2017-11-27 16:33       ` Takashi Iwai
2017-11-27 18:31         ` Pavel Machek
2017-11-27 18:35           ` Takashi Iwai
2017-11-27 18:44             ` Pavel Machek
2017-11-28  7:00               ` Takashi Iwai
2017-12-14  9:57                 ` Pavel Machek
2017-12-19  2:06                   ` vcaputo
2017-12-19  4:54                     ` vcaputo
2017-12-19 23:12                       ` vcaputo
2017-12-19 23:22                         ` Pavel Machek
2017-12-20  0:36                           ` vcaputo
2017-12-20  0:33                             ` Thomas Gleixner
2017-12-20  0:59                               ` vcaputo
2017-12-23  5:37                               ` vcaputo
2017-12-23 20:37                                 ` vcaputo
2017-12-23 20:33                                   ` Thomas Gleixner
2017-12-24 16:16                                     ` vcaputo
2017-12-28 10:41                                       ` Thomas Gleixner
2017-12-28 18:30                                         ` vcaputo
2017-12-28 23:24                                         ` [tip:x86/urgent] x86/apic: Switch all APICs to Fixed delivery mode tip-bot for Thomas Gleixner
2017-12-29 13:31                                         ` tip-bot for Thomas Gleixner
2017-12-29 13:35                                           ` Thomas Gleixner [this message]
2017-12-25 10:12                                 ` thinkpad x60: sound problems in 4.15-rc1 was Re: thinkpad x60: sound problems in 4.14.0-next-20171114 Pavel Machek
2017-12-25 10:09                       ` Pavel Machek
2018-01-02 20:54                 ` Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.20.1712291434110.1899@nanos \
    --to=tglx@linutronix.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=pavel@ucw.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox