RE: [RFC Part2 v1 15/21] x86, MSI: Use hierarchy irqdomain to manage MSI interrupts
It has mis-understandings in your word" helps to make the and and architecture" ... Thanks Xun -Original Message- From: linux-pci-ow...@vger.kernel.org [mailto:linux-pci-ow...@vger.kernel.org] On Behalf Of Jiang Liu Sent: Thursday, September 11, 2014 10:04 PM To: Benjamin Herrenschmidt; Thomas Gleixner; Ingo Molnar; H. Peter Anvin; Rafael J. Wysocki; Bjorn Helgaas; Randy Dunlap; Yinghai Lu; Borislav Petkov; Grant Likely; Marc Zyngier Cc: Jiang Liu; Konrad Rzeszutek Wilk; Andrew Morton; Luck, Tony; Joerg Roedel; Greg Kroah-Hartman; x...@kernel.org; linux-kernel@vger.kernel.org; linux-...@vger.kernel.org; linux-a...@vger.kernel.org; linux-arm-ker...@lists.infradead.org Subject: [RFC Part2 v1 15/21] x86, MSI: Use hierarchy irqdomain to manage MSI interrupts Enhance MSI code to support hierarchy irqdomain, it helps to make the and and architecture more clear. Signed-off-by: Jiang Liu --- arch/x86/include/asm/hw_irq.h|6 + arch/x86/include/asm/irq_remapping.h |6 +- arch/x86/kernel/apic/msi.c | 225 +- arch/x86/kernel/apic/vector.c|2 + drivers/iommu/irq_remapping.c|1 - 5 files changed, 204 insertions(+), 36 deletions(-) diff --git a/arch/x86/include/asm/hw_irq.h b/arch/x86/include/asm/hw_irq.h index 57f81f5a9686..9f705c49f850 100644 --- a/arch/x86/include/asm/hw_irq.h +++ b/arch/x86/include/asm/hw_irq.h @@ -199,6 +199,12 @@ static inline void lock_vector_lock(void) {} static inline void unlock_vector_lock(void) {} #endif /* CONFIG_X86_LOCAL_APIC */ +#ifdef CONFIG_PCI_MSI +extern void arch_init_msi_domain(struct irq_domain *domain); #else +static inline void arch_init_msi_domain(struct irq_domain *domain) { } +#endif + /* Statistics */ extern atomic_t irq_err_count; extern atomic_t irq_mis_count; diff --git a/arch/x86/include/asm/irq_remapping.h b/arch/x86/include/asm/irq_remapping.h index 428b4e6d637c..440053ca7515 100644 --- a/arch/x86/include/asm/irq_remapping.h +++ b/arch/x86/include/asm/irq_remapping.h @@ -73,11 +73,7 @@ extern void irq_remapping_print_chip(struct irq_data *data, struct seq_file *p); * Create MSI/MSIx irqdomain for interrupt remapping device, use @parent as * parent irqdomain. */ -static inline struct irq_domain * -arch_create_msi_irq_domain(struct irq_domain *parent) -{ - return NULL; -} +extern struct irq_domain *arch_create_msi_irq_domain(struct irq_domain +*parent); /* Get parent irqdomain for interrupt remapping irqdomain */ static inline struct irq_domain *arch_get_ir_parent_domain(void) diff --git a/arch/x86/kernel/apic/msi.c b/arch/x86/kernel/apic/msi.c index 709fedab44f2..5696703271af 100644 --- a/arch/x86/kernel/apic/msi.c +++ b/arch/x86/kernel/apic/msi.c @@ -3,6 +3,8 @@ * * Copyright (C) 1997, 1998, 1999, 2000, 2009 Ingo Molnar, Hajnalka Szabo * Moved from arch/x86/kernel/apic/io_apic.c. + * Jiang Liu + * Add support of hierarchy irqdomain * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -21,6 +23,8 @@ #include #include +static struct irq_domain *msi_default_domain; + void native_compose_msi_msg(struct pci_dev *pdev, unsigned int irq, unsigned int dest, struct msi_msg *msg, u8 hpet_id) @@ -76,28 +80,32 @@ static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq, return 0; } -static int -msi_set_affinity(struct irq_data *data, const struct cpumask *mask, bool force) +static bool msi_remapped(struct irq_domain *domain) { - struct irq_cfg *cfg = irqd_cfg(data); - struct msi_msg msg; - unsigned int dest; - int ret; - - ret = apic_set_affinity(data, mask, ); - if (ret) - return ret; + return domain->host_data != NULL; +} - __get_cached_msi_msg(data->msi_desc, ); +static int msi_set_affinity(struct irq_data *data, const struct cpumask *mask, + bool force) +{ + struct irq_data *parent = data->parent_data; + int ret; - msg.data &= ~MSI_DATA_VECTOR_MASK; - msg.data |= MSI_DATA_VECTOR(cfg->vector); - msg.address_lo &= ~MSI_ADDR_DEST_ID_MASK; - msg.address_lo |= MSI_ADDR_DEST_ID(dest); + ret = parent->chip->irq_set_affinity(parent, mask, force); + /* No need to reprogram MSI registers if interrupt is remapped */ + if (ret >= 0 && !msi_remapped(data->domain)) { + struct irq_cfg *cfg = irqd_cfg(data); + struct msi_msg msg; - __write_msi_msg(data->msi_desc, ); + __get_cached_msi_msg(data->msi_desc, ); + msg.data &= ~MSI_DATA_VECTOR_MASK; + msg.data |= MSI_DATA_VECTOR(cfg->vector); + msg.address_lo &= ~MSI_ADDR_DEST_ID_MASK; + msg.address_lo |= MSI_ADDR_DEST_ID(cfg->dest_apicid); +
RE: [RFC Part2 v1 15/21] x86, MSI: Use hierarchy irqdomain to manage MSI interrupts
It has mis-understandings in your word helps to make the and and architecture ... Thanks Xun -Original Message- From: linux-pci-ow...@vger.kernel.org [mailto:linux-pci-ow...@vger.kernel.org] On Behalf Of Jiang Liu Sent: Thursday, September 11, 2014 10:04 PM To: Benjamin Herrenschmidt; Thomas Gleixner; Ingo Molnar; H. Peter Anvin; Rafael J. Wysocki; Bjorn Helgaas; Randy Dunlap; Yinghai Lu; Borislav Petkov; Grant Likely; Marc Zyngier Cc: Jiang Liu; Konrad Rzeszutek Wilk; Andrew Morton; Luck, Tony; Joerg Roedel; Greg Kroah-Hartman; x...@kernel.org; linux-kernel@vger.kernel.org; linux-...@vger.kernel.org; linux-a...@vger.kernel.org; linux-arm-ker...@lists.infradead.org Subject: [RFC Part2 v1 15/21] x86, MSI: Use hierarchy irqdomain to manage MSI interrupts Enhance MSI code to support hierarchy irqdomain, it helps to make the and and architecture more clear. Signed-off-by: Jiang Liu jiang@linux.intel.com --- arch/x86/include/asm/hw_irq.h|6 + arch/x86/include/asm/irq_remapping.h |6 +- arch/x86/kernel/apic/msi.c | 225 +- arch/x86/kernel/apic/vector.c|2 + drivers/iommu/irq_remapping.c|1 - 5 files changed, 204 insertions(+), 36 deletions(-) diff --git a/arch/x86/include/asm/hw_irq.h b/arch/x86/include/asm/hw_irq.h index 57f81f5a9686..9f705c49f850 100644 --- a/arch/x86/include/asm/hw_irq.h +++ b/arch/x86/include/asm/hw_irq.h @@ -199,6 +199,12 @@ static inline void lock_vector_lock(void) {} static inline void unlock_vector_lock(void) {} #endif /* CONFIG_X86_LOCAL_APIC */ +#ifdef CONFIG_PCI_MSI +extern void arch_init_msi_domain(struct irq_domain *domain); #else +static inline void arch_init_msi_domain(struct irq_domain *domain) { } +#endif + /* Statistics */ extern atomic_t irq_err_count; extern atomic_t irq_mis_count; diff --git a/arch/x86/include/asm/irq_remapping.h b/arch/x86/include/asm/irq_remapping.h index 428b4e6d637c..440053ca7515 100644 --- a/arch/x86/include/asm/irq_remapping.h +++ b/arch/x86/include/asm/irq_remapping.h @@ -73,11 +73,7 @@ extern void irq_remapping_print_chip(struct irq_data *data, struct seq_file *p); * Create MSI/MSIx irqdomain for interrupt remapping device, use @parent as * parent irqdomain. */ -static inline struct irq_domain * -arch_create_msi_irq_domain(struct irq_domain *parent) -{ - return NULL; -} +extern struct irq_domain *arch_create_msi_irq_domain(struct irq_domain +*parent); /* Get parent irqdomain for interrupt remapping irqdomain */ static inline struct irq_domain *arch_get_ir_parent_domain(void) diff --git a/arch/x86/kernel/apic/msi.c b/arch/x86/kernel/apic/msi.c index 709fedab44f2..5696703271af 100644 --- a/arch/x86/kernel/apic/msi.c +++ b/arch/x86/kernel/apic/msi.c @@ -3,6 +3,8 @@ * * Copyright (C) 1997, 1998, 1999, 2000, 2009 Ingo Molnar, Hajnalka Szabo * Moved from arch/x86/kernel/apic/io_apic.c. + * Jiang Liu jiang@linux.intel.com + * Add support of hierarchy irqdomain * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -21,6 +23,8 @@ #include asm/apic.h #include asm/irq_remapping.h +static struct irq_domain *msi_default_domain; + void native_compose_msi_msg(struct pci_dev *pdev, unsigned int irq, unsigned int dest, struct msi_msg *msg, u8 hpet_id) @@ -76,28 +80,32 @@ static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq, return 0; } -static int -msi_set_affinity(struct irq_data *data, const struct cpumask *mask, bool force) +static bool msi_remapped(struct irq_domain *domain) { - struct irq_cfg *cfg = irqd_cfg(data); - struct msi_msg msg; - unsigned int dest; - int ret; - - ret = apic_set_affinity(data, mask, dest); - if (ret) - return ret; + return domain-host_data != NULL; +} - __get_cached_msi_msg(data-msi_desc, msg); +static int msi_set_affinity(struct irq_data *data, const struct cpumask *mask, + bool force) +{ + struct irq_data *parent = data-parent_data; + int ret; - msg.data = ~MSI_DATA_VECTOR_MASK; - msg.data |= MSI_DATA_VECTOR(cfg-vector); - msg.address_lo = ~MSI_ADDR_DEST_ID_MASK; - msg.address_lo |= MSI_ADDR_DEST_ID(dest); + ret = parent-chip-irq_set_affinity(parent, mask, force); + /* No need to reprogram MSI registers if interrupt is remapped */ + if (ret = 0 !msi_remapped(data-domain)) { + struct irq_cfg *cfg = irqd_cfg(data); + struct msi_msg msg; - __write_msi_msg(data-msi_desc, msg); + __get_cached_msi_msg(data-msi_desc, msg); + msg.data = ~MSI_DATA_VECTOR_MASK; + msg.data |= MSI_DATA_VECTOR(cfg-vector); + msg.address_lo = ~MSI_ADDR_DEST_ID_MASK; +
RE: [PATCH V2] cgroup: Introduce cgroup_detach_task().
Maybe your point can be added to the README or FAQ for cgroup. Try to shoot a patch for that, it will be more effective... Thanks, Xun -Original Message- From: cgroups-ow...@vger.kernel.org [mailto:cgroups-ow...@vger.kernel.org] On Behalf Of Dongsheng Yang Sent: Tuesday, August 26, 2014 10:16 AM To: Li Zefan Cc: Tejun Heo; Dongsheng Yang; cgro...@vger.kernel.org; linux-kernel@vger.kernel.org Subject: Re: [PATCH V2] cgroup: Introduce cgroup_detach_task(). On Tue, Aug 26, 2014 at 9:35 AM, Li Zefan wrote: > On 2014/8/25 23:00, Dongsheng Yang wrote: >> On Mon, Aug 25, 2014 at 10:47 PM, Tejun Heo wrote: >>> On Mon, Aug 25, 2014 at 10:46:03PM +0800, Dongsheng Yang wrote: My point here is that attaching and detaching are a pair of operations. >>> >>> There is no detaching from a cgroup. A task is always attached to a >>> cgroup whether that's a root or non-root cgroup. >> >> Okey, I should not think it as attaching and detaching. Just treat >> them as a move between root and non-root cgroup. >> >> It sounds reasonable to me now. >> > > I from time to time have to explain this to other people. Ha, we usually want to find a detach function when we saw a function named as cgroup_attach_task(). > -- To unsubscribe from this list: send the line "unsubscribe cgroups" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH V2] cgroup: Introduce cgroup_detach_task().
Maybe your point can be added to the README or FAQ for cgroup. Try to shoot a patch for that, it will be more effective... Thanks, Xun -Original Message- From: cgroups-ow...@vger.kernel.org [mailto:cgroups-ow...@vger.kernel.org] On Behalf Of Dongsheng Yang Sent: Tuesday, August 26, 2014 10:16 AM To: Li Zefan Cc: Tejun Heo; Dongsheng Yang; cgro...@vger.kernel.org; linux-kernel@vger.kernel.org Subject: Re: [PATCH V2] cgroup: Introduce cgroup_detach_task(). On Tue, Aug 26, 2014 at 9:35 AM, Li Zefan lize...@huawei.com wrote: On 2014/8/25 23:00, Dongsheng Yang wrote: On Mon, Aug 25, 2014 at 10:47 PM, Tejun Heo t...@kernel.org wrote: On Mon, Aug 25, 2014 at 10:46:03PM +0800, Dongsheng Yang wrote: My point here is that attaching and detaching are a pair of operations. There is no detaching from a cgroup. A task is always attached to a cgroup whether that's a root or non-root cgroup. Okey, I should not think it as attaching and detaching. Just treat them as a move between root and non-root cgroup. It sounds reasonable to me now. I from time to time have to explain this to other people. Ha, we usually want to find a detach function when we saw a function named as cgroup_attach_task(). -- To unsubscribe from this list: send the line unsubscribe cgroups in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html