[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] xen/events: don't use chip_data for legacy IRQs


  • To: Juergen Gross <jgross@xxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
  • From: Stefan Bader <stefan.bader@xxxxxxxxxxxxx>
  • Date: Wed, 30 Sep 2020 14:06:36 +0200
  • Autocrypt: addr=stefan.bader@xxxxxxxxxxxxx; prefer-encrypt=mutual; keydata= mQINBE5mmXEBEADoM0yd6ERIuH2sQjbCGtrt0SFCbpAuOgNy7LSDJw2vZHkZ1bLPtpojdQId 258o/4V+qLWaWLjbQdadzodnVUsvb+LUKJhFRB1kmzVYNxiu7AtxOnNmUn9dl1oS90IACo1B BpaMIunnKu1pp7s3sfzWapsNMwHbYVHXyJeaPFtMqOxd1V7bNEAC9uNjqJ3IG15f5/50+N+w LGkd5QJmp6Hs9RgCXQMDn989+qFnJga390C9JPWYye0sLjQeZTuUgdhebP0nvciOlKwaOC8v K3UwEIbjt+eL18kBq4VBgrqQiMupmTP9oQNYEgk2FiW3iAQ9BXE8VGiglUOF8KIe/2okVjdO nl3VgOHumV+emrE8XFOB2pgVmoklYNvOjaIV7UBesO5/16jbhGVDXskpZkrP/Ip+n9XD/EJM ismF8UcvcL4aPwZf9J03fZT4HARXuig/GXdK7nMgCRChKwsAARjw5f8lUx5iR1wZwSa7HhHP rAclUzjFNK2819/Ke5kM1UuT1X9aqL+uLYQEDB3QfJmdzVv5vHON3O7GOfaxBICo4Z5OdXSQ SRetiJ8YeUhKpWSqP59PSsbJg+nCKvWfkl/XUu5cFO4V/+NfivTttnoFwNhi/4lrBKZDhGVm 6Oo/VytPpGHXt29npHb8x0NsQOsfZeam9Z5ysmePwH/53Np8NQARAQABtDVTdGVmYW4gQmFk ZXIgKENhbm9uaWNhbCkgPHN0ZWZhbi5iYWRlckBjYW5vbmljYWwuY29tPokCVwQTAQoAQQIb AwULCQgHAwUVCgkICwUWAgM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RYuE45/feIEQGr1QueKac1rpRHhfohCTZNG2Jx1c6VwZCYvBKkOJMWpQwRtyEcShcX1j quuXTQgSgLXYhq37J+O42GU0Amw=
  • Cc: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, stable@xxxxxxxxxxxxxxx
  • Delivery-date: Wed, 30 Sep 2020 12:06:51 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 30.09.20 11:16, Juergen Gross wrote:
> Since commit c330fb1ddc0a ("XEN uses irqdesc::irq_data_common::handler_data 
> to store a per interrupt XEN data pointer which contains XEN specific 
> information.")
> Xen is using the chip_data pointer for storing IRQ specific data. When
> running as a HVM domain this can result in problems for legacy IRQs, as
> those might use chip_data for their own purposes.
> 
> Use a local array for this purpose in case of legacy IRQs, avoiding the
> double use.
> 
> Cc: stable@xxxxxxxxxxxxxxx
> Fixes: c330fb1ddc0a ("XEN uses irqdesc::irq_data_common::handler_data to 
> store a per interrupt XEN data pointer which contains XEN specific 
> information.")
> Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
Tested-by: Stefan Bader <stefan.bader@xxxxxxxxxxxxx>
> ---
>  drivers/xen/events/events_base.c | 29 +++++++++++++++++++++--------
>  1 file changed, 21 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/xen/events/events_base.c 
> b/drivers/xen/events/events_base.c
> index 90b8f56fbadb..6f02c18fa65c 100644
> --- a/drivers/xen/events/events_base.c
> +++ b/drivers/xen/events/events_base.c
> @@ -92,6 +92,8 @@ static bool (*pirq_needs_eoi)(unsigned irq);
>  /* Xen will never allocate port zero for any purpose. */
>  #define VALID_EVTCHN(chn)    ((chn) != 0)
>  
> +static struct irq_info *legacy_info_ptrs[NR_IRQS_LEGACY];
> +
>  static struct irq_chip xen_dynamic_chip;
>  static struct irq_chip xen_percpu_chip;
>  static struct irq_chip xen_pirq_chip;
> @@ -156,7 +158,18 @@ int get_evtchn_to_irq(evtchn_port_t evtchn)
>  /* Get info for IRQ */
>  struct irq_info *info_for_irq(unsigned irq)
>  {
> -     return irq_get_chip_data(irq);
> +     if (irq < nr_legacy_irqs())
> +             return legacy_info_ptrs[irq];
> +     else
> +             return irq_get_chip_data(irq);
> +}
> +
> +static void set_info_for_irq(unsigned int irq, struct irq_info *info)
> +{
> +     if (irq < nr_legacy_irqs())
> +             legacy_info_ptrs[irq] = info;
> +     else
> +             irq_set_chip_data(irq, info);
>  }
>  
>  /* Constructors for packed IRQ information. */
> @@ -377,7 +390,7 @@ static void xen_irq_init(unsigned irq)
>       info->type = IRQT_UNBOUND;
>       info->refcnt = -1;
>  
> -     irq_set_chip_data(irq, info);
> +     set_info_for_irq(irq, info);
>  
>       list_add_tail(&info->list, &xen_irq_list_head);
>  }
> @@ -426,14 +439,14 @@ static int __must_check xen_allocate_irq_gsi(unsigned 
> gsi)
>  
>  static void xen_free_irq(unsigned irq)
>  {
> -     struct irq_info *info = irq_get_chip_data(irq);
> +     struct irq_info *info = info_for_irq(irq);
>  
>       if (WARN_ON(!info))
>               return;
>  
>       list_del(&info->list);
>  
> -     irq_set_chip_data(irq, NULL);
> +     set_info_for_irq(irq, NULL);
>  
>       WARN_ON(info->refcnt > 0);
>  
> @@ -603,7 +616,7 @@ EXPORT_SYMBOL_GPL(xen_irq_from_gsi);
>  static void __unbind_from_irq(unsigned int irq)
>  {
>       evtchn_port_t evtchn = evtchn_from_irq(irq);
> -     struct irq_info *info = irq_get_chip_data(irq);
> +     struct irq_info *info = info_for_irq(irq);
>  
>       if (info->refcnt > 0) {
>               info->refcnt--;
> @@ -1108,7 +1121,7 @@ int bind_ipi_to_irqhandler(enum ipi_vector ipi,
>  
>  void unbind_from_irqhandler(unsigned int irq, void *dev_id)
>  {
> -     struct irq_info *info = irq_get_chip_data(irq);
> +     struct irq_info *info = info_for_irq(irq);
>  
>       if (WARN_ON(!info))
>               return;
> @@ -1142,7 +1155,7 @@ int evtchn_make_refcounted(evtchn_port_t evtchn)
>       if (irq == -1)
>               return -ENOENT;
>  
> -     info = irq_get_chip_data(irq);
> +     info = info_for_irq(irq);
>  
>       if (!info)
>               return -ENOENT;
> @@ -1170,7 +1183,7 @@ int evtchn_get(evtchn_port_t evtchn)
>       if (irq == -1)
>               goto done;
>  
> -     info = irq_get_chip_data(irq);
> +     info = info_for_irq(irq);
>  
>       if (!info)
>               goto done;
> 


Attachment: signature.asc
Description: OpenPGP digital signature


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.