Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1265118 > unrolled thread

[PATCH] acpi: add support for extended IRQ to PCI link

Started bySinan Kaya <okaya@codeaurora.org>
First post2015-11-08 17:10 +0100
Last post2015-11-09 17:30 +0100
Articles 12 — 5 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] acpi: add support for extended IRQ to PCI link Sinan Kaya <okaya@codeaurora.org> - 2015-11-08 17:10 +0100
    Re: [PATCH] acpi: add support for extended IRQ to PCI link Timur Tabi <timur@codeaurora.org> - 2015-11-08 17:20 +0100
      Re: [PATCH] acpi: add support for extended IRQ to PCI link Timur Tabi <timur@codeaurora.org> - 2015-11-09 01:10 +0100
        Re: [PATCH] acpi: add support for extended IRQ to PCI link "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2015-11-09 22:20 +0100
      Re: [PATCH] acpi: add support for extended IRQ to PCI link Sinan Kaya <okaya@codeaurora.org> - 2015-11-09 01:10 +0100
    Re: [PATCH] acpi: add support for extended IRQ to PCI link Andy Shevchenko <andy.shevchenko@gmail.com> - 2015-11-08 21:40 +0100
      Re: [PATCH] acpi: add support for extended IRQ to PCI link Sinan Kaya <okaya@codeaurora.org> - 2015-11-09 23:40 +0100
    Re: [PATCH] acpi: add support for extended IRQ to PCI link Jiang Liu <jiang.liu@linux.intel.com> - 2015-11-09 06:30 +0100
      Re: [PATCH] acpi: add support for extended IRQ to PCI link Sinan Kaya <okaya@codeaurora.org> - 2015-11-09 06:50 +0100
        Re: [PATCH] acpi: add support for extended IRQ to PCI link Jiang Liu <jiang.liu@linux.intel.com> - 2015-11-09 09:50 +0100
        Re: [PATCH] acpi: add support for extended IRQ to PCI link Timur Tabi <timur@codeaurora.org> - 2015-11-09 15:00 +0100
          Re: [PATCH] acpi: add support for extended IRQ to PCI link Sinan Kaya <okaya@codeaurora.org> - 2015-11-09 17:30 +0100

#1265118 — [PATCH] acpi: add support for extended IRQ to PCI link

FromSinan Kaya <okaya@codeaurora.org>
Date2015-11-08 17:10 +0100
Subject[PATCH] acpi: add support for extended IRQ to PCI link
Message-ID<qsAHw-2kS-17@gated-at.bofh.it>
The ACPI compiler uses the extended format when
used interrupt numbers are greater than 256.
The PCI link code currently only supports simple
interrupt format. The IRQ numbers are represented
using 32 bits when extended IRQ syntax. This patch
changes the interrupt number type to 32 bits and
places an upper limit of 1020 as possible interrupt
id. Additional checks have been placed to prevent
out of bounds writes.

Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
---
 drivers/acpi/pci_link.c | 35 ++++++++++++++++++++++-------------
 1 file changed, 22 insertions(+), 13 deletions(-)

diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c
index 7c8408b..18a9190 100644
--- a/drivers/acpi/pci_link.c
+++ b/drivers/acpi/pci_link.c
@@ -1,6 +1,7 @@
 /*
  *  pci_link.c - ACPI PCI Interrupt Link Device Driver ($Revision: 34 $)
  *
+ *  Copyright (c) 2015, The Linux Foundation. All rights reserved.
  *  Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
  *  Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
  *  Copyright (C) 2002       Dominik Brodowski <devel@brodo.de>
@@ -67,12 +68,12 @@ static struct acpi_scan_handler pci_link_handler = {
  * later even the link is disable. Instead, we just repick the active irq
  */
 struct acpi_pci_link_irq {
-	u8 active;		/* Current IRQ */
+	u32 active;		/* Current IRQ */
 	u8 triggering;		/* All IRQs */
 	u8 polarity;		/* All IRQs */
 	u8 resource_type;
 	u8 possible_count;
-	u8 possible[ACPI_PCI_LINK_MAX_POSSIBLE];
+	u32 possible[ACPI_PCI_LINK_MAX_POSSIBLE];
 	u8 initialized:1;
 	u8 reserved:7;
 };
@@ -437,7 +438,7 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq)
  * enabled system.
  */
 
-#define ACPI_MAX_IRQS		256
+#define ACPI_MAX_IRQS		1020
 #define ACPI_MAX_ISA_IRQ	16
 
 #define PIRQ_PENALTY_PCI_AVAILABLE	(0)
@@ -493,7 +494,8 @@ int __init acpi_irq_penalty_init(void)
 					    penalty;
 			}
 
-		} else if (link->irq.active) {
+		} else if (link->irq.active &&
+			(link->irq.active < ACPI_MAX_IRQS)) {
 			acpi_irq_penalty[link->irq.active] +=
 			    PIRQ_PENALTY_PCI_POSSIBLE;
 		}
@@ -542,14 +544,19 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link)
 		irq = link->irq.possible[link->irq.possible_count - 1];
 
 	if (acpi_irq_balance || !link->irq.active) {
-		/*
-		 * Select the best IRQ.  This is done in reverse to promote
-		 * the use of IRQs 9, 10, 11, and >15.
-		 */
-		for (i = (link->irq.possible_count - 1); i >= 0; i--) {
-			if (acpi_irq_penalty[irq] >
-			    acpi_irq_penalty[link->irq.possible[i]])
-				irq = link->irq.possible[i];
+
+		if (irq < ACPI_MAX_IRQS) {
+			/*
+			 * Select the best IRQ.  This is done in reverse to
+			 * promote the use of IRQs 9, 10, 11, and >15.
+			 */
+			for (i = (link->irq.possible_count - 1); i >= 0;
+				i--) {
+				if ((link->irq.possible[i] < ACPI_MAX_IRQS) &&
+				    (acpi_irq_penalty[irq] >
+				    acpi_irq_penalty[link->irq.possible[i]]))
+					irq = link->irq.possible[i];
+			}
 		}
 	}
 	if (acpi_irq_penalty[irq] >= PIRQ_PENALTY_ISA_ALWAYS) {
@@ -568,7 +575,9 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link)
 			    acpi_device_bid(link->device));
 		return -ENODEV;
 	} else {
-		acpi_irq_penalty[link->irq.active] += PIRQ_PENALTY_PCI_USING;
+		if (link->irq.active < ACPI_MAX_IRQS)
+			acpi_irq_penalty[link->irq.active] +=
+				PIRQ_PENALTY_PCI_USING;
 		printk(KERN_WARNING PREFIX "%s [%s] enabled at IRQ %d\n",
 		       acpi_device_name(link->device),
 		       acpi_device_bid(link->device), link->irq.active);
-- 
Qualcomm Technologies, Inc. on behalf of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1265124

FromTimur Tabi <timur@codeaurora.org>
Date2015-11-08 17:20 +0100
Message-ID<qsARc-2oy-9@gated-at.bofh.it>
In reply to#1265118
Sinan Kaya wrote:
> -#define ACPI_MAX_IRQS		256
> +#define ACPI_MAX_IRQS		1020

Why 1020?  Why not 1024?

-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the
Code Aurora Forum, hosted by The Linux Foundation.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1265253

FromTimur Tabi <timur@codeaurora.org>
Date2015-11-09 01:10 +0100
Message-ID<qsIc2-7f7-1@gated-at.bofh.it>
In reply to#1265124
Sinan Kaya wrote:
>>
> 1020 is the maximum interrupt ID that can be directed to an ARM SPI
> interrupt according to ARM architecture.

IMHO, that's something that belongs in the patch description.

-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the
Code Aurora Forum, hosted by The Linux Foundation.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1266020

From"Rafael J. Wysocki" <rjw@rjwysocki.net>
Date2015-11-09 22:20 +0100
Message-ID<qt215-3od-33@gated-at.bofh.it>
In reply to#1265253
On Sunday, November 08, 2015 06:05:48 PM Timur Tabi wrote:
> Sinan Kaya wrote:
> >>
> > 1020 is the maximum interrupt ID that can be directed to an ARM SPI
> > interrupt according to ARM architecture.
> 
> IMHO, that's something that belongs in the patch description.

Good point.

Thanks,
Rafael

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1265256

FromSinan Kaya <okaya@codeaurora.org>
Date2015-11-09 01:10 +0100
Message-ID<qsIc2-7f7-3@gated-at.bofh.it>
In reply to#1265124

On 11/8/2015 11:11 AM, Timur Tabi wrote:
> Sinan Kaya wrote:
>> -#define ACPI_MAX_IRQS        256
>> +#define ACPI_MAX_IRQS        1020
>
> Why 1020?  Why not 1024?
>
1020 is the maximum interrupt ID that can be directed to an ARM SPI 
interrupt according to ARM architecture.

-- 
Sinan Kaya
Qualcomm Technologies, Inc. on behalf of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a 
Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1265190

FromAndy Shevchenko <andy.shevchenko@gmail.com>
Date2015-11-08 21:40 +0100
Message-ID<qsEUO-4VY-7@gated-at.bofh.it>
In reply to#1265118
On Sun, Nov 8, 2015 at 6:07 PM, Sinan Kaya <okaya@codeaurora.org> wrote:
> The ACPI compiler uses the extended format when
> used interrupt numbers are greater than 256.
> The PCI link code currently only supports simple
> interrupt format. The IRQ numbers are represented
> using 32 bits when extended IRQ syntax. This patch
> changes the interrupt number type to 32 bits and
> places an upper limit of 1020 as possible interrupt
> id. Additional checks have been placed to prevent
> out of bounds writes.

In commit messages and in comments I see this narrow lines, any reason
to make them short, except increasing number of lines?

> --- a/drivers/acpi/pci_link.c
> +++ b/drivers/acpi/pci_link.c
> @@ -1,6 +1,7 @@
>  /*
>   *  pci_link.c - ACPI PCI Interrupt Link Device Driver ($Revision: 34 $)
>   *
> + *  Copyright (c) 2015, The Linux Foundation. All rights reserved.
>   *  Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
>   *  Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
>   *  Copyright (C) 2002       Dominik Brodowski <devel@brodo.de>
> @@ -67,12 +68,12 @@ static struct acpi_scan_handler pci_link_handler = {
>   * later even the link is disable. Instead, we just repick the active irq
>   */
>  struct acpi_pci_link_irq {
> -       u8 active;              /* Current IRQ */
> +       u32 active;             /* Current IRQ */
>         u8 triggering;          /* All IRQs */
>         u8 polarity;            /* All IRQs */
>         u8 resource_type;
>         u8 possible_count;
> -       u8 possible[ACPI_PCI_LINK_MAX_POSSIBLE];
> +       u32 possible[ACPI_PCI_LINK_MAX_POSSIBLE];
>         u8 initialized:1;
>         u8 reserved:7;
>  };
> @@ -437,7 +438,7 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq)
>   * enabled system.
>   */
>
> -#define ACPI_MAX_IRQS          256
> +#define ACPI_MAX_IRQS          1020
>  #define ACPI_MAX_ISA_IRQ       16
>
>  #define PIRQ_PENALTY_PCI_AVAILABLE     (0)
> @@ -493,7 +494,8 @@ int __init acpi_irq_penalty_init(void)
>                                             penalty;
>                         }
>
> -               } else if (link->irq.active) {
> +               } else if (link->irq.active &&
> +                       (link->irq.active < ACPI_MAX_IRQS)) {
>                         acpi_irq_penalty[link->irq.active] +=
>                             PIRQ_PENALTY_PCI_POSSIBLE;
>                 }
> @@ -542,14 +544,19 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link)
>                 irq = link->irq.possible[link->irq.possible_count - 1];
>
>         if (acpi_irq_balance || !link->irq.active) {
> -               /*
> -                * Select the best IRQ.  This is done in reverse to promote
> -                * the use of IRQs 9, 10, 11, and >15.
> -                */
> -               for (i = (link->irq.possible_count - 1); i >= 0; i--) {
> -                       if (acpi_irq_penalty[irq] >
> -                           acpi_irq_penalty[link->irq.possible[i]])
> -                               irq = link->irq.possible[i];
> +
> +               if (irq < ACPI_MAX_IRQS) {
> +                       /*
> +                        * Select the best IRQ.  This is done in reverse to
> +                        * promote the use of IRQs 9, 10, 11, and >15.
> +                        */
> +                       for (i = (link->irq.possible_count - 1); i >= 0;
> +                               i--) {

Why not

if ((acpi_irq_balance || !link->irq.active) && irq < ACPI_MAX_IRQS) {
 int i = link->irq.possible_count;

 while (--i) {
 …
 }
}

> +                               if ((link->irq.possible[i] < ACPI_MAX_IRQS) &&
> +                                   (acpi_irq_penalty[irq] >
> +                                   acpi_irq_penalty[link->irq.possible[i]]))
> +                                       irq = link->irq.possible[i];
> +                       }
>                 }
>         }
>         if (acpi_irq_penalty[irq] >= PIRQ_PENALTY_ISA_ALWAYS) {

-- 
With Best Regards,
Andy Shevchenko
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1266056

FromSinan Kaya <okaya@codeaurora.org>
Date2015-11-09 23:40 +0100
Message-ID<qt3gt-4EA-5@gated-at.bofh.it>
In reply to#1265190

On 11/8/2015 3:35 PM, Andy Shevchenko wrote:
> On Sun, Nov 8, 2015 at 6:07 PM, Sinan Kaya <okaya@codeaurora.org> wrote:
>> The ACPI compiler uses the extended format when
>> used interrupt numbers are greater than 256.
>> The PCI link code currently only supports simple
>> interrupt format. The IRQ numbers are represented
>> using 32 bits when extended IRQ syntax. This patch
>> changes the interrupt number type to 32 bits and
>> places an upper limit of 1020 as possible interrupt
>> id. Additional checks have been placed to prevent
>> out of bounds writes.
>
> In commit messages and in comments I see this narrow lines, any reason
> to make them short, except increasing number of lines?
>

done

>>          if (acpi_irq_balance || !link->irq.active) {
>> -               /*
>> -                * Select the best IRQ.  This is done in reverse to promote
>> -                * the use of IRQs 9, 10, 11, and >15.
>> -                */
>> -               for (i = (link->irq.possible_count - 1); i >= 0; i--) {
>> -                       if (acpi_irq_penalty[irq] >
>> -                           acpi_irq_penalty[link->irq.possible[i]])
>> -                               irq = link->irq.possible[i];
>> +
>> +               if (irq < ACPI_MAX_IRQS) {
>> +                       /*
>> +                        * Select the best IRQ.  This is done in reverse to
>> +                        * promote the use of IRQs 9, 10, 11, and >15.
>> +                        */
>> +                       for (i = (link->irq.possible_count - 1); i >= 0;
>> +                               i--) {
>
> Why not
>
> if ((acpi_irq_balance || !link->irq.active) && irq < ACPI_MAX_IRQS) {
>   int i = link->irq.possible_count;
>
>   while (--i) {
>   …
>   }
> }

done

>
>> +                               if ((link->irq.possible[i] < ACPI_MAX_IRQS) &&
>> +                                   (acpi_irq_penalty[irq] >
>> +                                   acpi_irq_penalty[link->irq.possible[i]]))
>> +                                       irq = link->irq.possible[i];
>> +                       }
>>                  }
>>          }
>>          if (acpi_irq_penalty[irq] >= PIRQ_PENALTY_ISA_ALWAYS) {
>

-- 
Sinan Kaya
Qualcomm Technologies, Inc. on behalf of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a 
Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1265354

FromJiang Liu <jiang.liu@linux.intel.com>
Date2015-11-09 06:30 +0100
Message-ID<qsNbI-292-5@gated-at.bofh.it>
In reply to#1265118
On 2015/11/9 0:07, Sinan Kaya wrote:
> The ACPI compiler uses the extended format when
> used interrupt numbers are greater than 256.
> The PCI link code currently only supports simple
> interrupt format. The IRQ numbers are represented
> using 32 bits when extended IRQ syntax. This patch
> changes the interrupt number type to 32 bits and
> places an upper limit of 1020 as possible interrupt
> id. Additional checks have been placed to prevent
> out of bounds writes.
> 
> Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
> ---
>  drivers/acpi/pci_link.c | 35 ++++++++++++++++++++++-------------
>  1 file changed, 22 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c
> index 7c8408b..18a9190 100644
> --- a/drivers/acpi/pci_link.c
> +++ b/drivers/acpi/pci_link.c
> @@ -1,6 +1,7 @@
>  /*
>   *  pci_link.c - ACPI PCI Interrupt Link Device Driver ($Revision: 34 $)
>   *
> + *  Copyright (c) 2015, The Linux Foundation. All rights reserved.
>   *  Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
>   *  Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
>   *  Copyright (C) 2002       Dominik Brodowski <devel@brodo.de>
> @@ -67,12 +68,12 @@ static struct acpi_scan_handler pci_link_handler = {
>   * later even the link is disable. Instead, we just repick the active irq
>   */
>  struct acpi_pci_link_irq {
> -	u8 active;		/* Current IRQ */
> +	u32 active;		/* Current IRQ */
>  	u8 triggering;		/* All IRQs */
>  	u8 polarity;		/* All IRQs */
>  	u8 resource_type;
>  	u8 possible_count;
> -	u8 possible[ACPI_PCI_LINK_MAX_POSSIBLE];
> +	u32 possible[ACPI_PCI_LINK_MAX_POSSIBLE];
>  	u8 initialized:1;
>  	u8 reserved:7;
>  };
Hi Sinan,
	This data structure become some sort of big, any idea to reduce
memory consumption?
Thanks,
Gerry

> @@ -437,7 +438,7 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq)
>   * enabled system.
>   */
>  
> -#define ACPI_MAX_IRQS		256
> +#define ACPI_MAX_IRQS		1020
>  #define ACPI_MAX_ISA_IRQ	16
>  
>  #define PIRQ_PENALTY_PCI_AVAILABLE	(0)
> @@ -493,7 +494,8 @@ int __init acpi_irq_penalty_init(void)
>  					    penalty;
>  			}
>  
> -		} else if (link->irq.active) {
> +		} else if (link->irq.active &&
> +			(link->irq.active < ACPI_MAX_IRQS)) {
>  			acpi_irq_penalty[link->irq.active] +=
>  			    PIRQ_PENALTY_PCI_POSSIBLE;
>  		}
> @@ -542,14 +544,19 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link)
>  		irq = link->irq.possible[link->irq.possible_count - 1];
>  
>  	if (acpi_irq_balance || !link->irq.active) {
> -		/*
> -		 * Select the best IRQ.  This is done in reverse to promote
> -		 * the use of IRQs 9, 10, 11, and >15.
> -		 */
> -		for (i = (link->irq.possible_count - 1); i >= 0; i--) {
> -			if (acpi_irq_penalty[irq] >
> -			    acpi_irq_penalty[link->irq.possible[i]])
> -				irq = link->irq.possible[i];
> +
> +		if (irq < ACPI_MAX_IRQS) {
> +			/*
> +			 * Select the best IRQ.  This is done in reverse to
> +			 * promote the use of IRQs 9, 10, 11, and >15.
> +			 */
> +			for (i = (link->irq.possible_count - 1); i >= 0;
> +				i--) {
> +				if ((link->irq.possible[i] < ACPI_MAX_IRQS) &&
> +				    (acpi_irq_penalty[irq] >
> +				    acpi_irq_penalty[link->irq.possible[i]]))
> +					irq = link->irq.possible[i];
> +			}
>  		}
>  	}
>  	if (acpi_irq_penalty[irq] >= PIRQ_PENALTY_ISA_ALWAYS) {
> @@ -568,7 +575,9 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link)
>  			    acpi_device_bid(link->device));
>  		return -ENODEV;
>  	} else {
> -		acpi_irq_penalty[link->irq.active] += PIRQ_PENALTY_PCI_USING;
> +		if (link->irq.active < ACPI_MAX_IRQS)
> +			acpi_irq_penalty[link->irq.active] +=
> +				PIRQ_PENALTY_PCI_USING;
>  		printk(KERN_WARNING PREFIX "%s [%s] enabled at IRQ %d\n",
>  		       acpi_device_name(link->device),
>  		       acpi_device_bid(link->device), link->irq.active);
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1265372

FromSinan Kaya <okaya@codeaurora.org>
Date2015-11-09 06:50 +0100
Message-ID<qsNv4-2fT-13@gated-at.bofh.it>
In reply to#1265354

On 11/9/2015 12:24 AM, Jiang Liu wrote:
>> +	u32 possible[ACPI_PCI_LINK_MAX_POSSIBLE];
>> >  	u8 initialized:1;
>> >  	u8 reserved:7;
>> >  };
> Hi Sinan,
> 	This data structure become some sort of big, any idea to reduce
> memory consumption?
> Thanks,
> Gerry
>
Hi Gerry,

There are two constants in the code.

#define ACPI_PCI_LINK_MAX_POSSIBLE	16

I changed the data type above. Previously it was consuming 16 bytes now 
64 bytes.

The second one is this.

#define ACPI_MAX_IRQS 256

I changed ACPI_MAX_IRQS to 1020 from 256. Let's assume 1024.

I'm concerned about this though since you warned. This used to consume 
1024 bytes now 4096 bytes.

static int acpi_irq_penalty[ACPI_MAX_IRQS] = {
	PIRQ_PENALTY_ISA_ALWAYS,	/* IRQ0 timer */
...
}

Sinan

-- 
Sinan Kaya
Qualcomm Technologies, Inc. on behalf of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a 
Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1265455

FromJiang Liu <jiang.liu@linux.intel.com>
Date2015-11-09 09:50 +0100
Message-ID<qsQjg-42K-5@gated-at.bofh.it>
In reply to#1265372
On 2015/11/9 13:45, Sinan Kaya wrote:
> 
> 
> On 11/9/2015 12:24 AM, Jiang Liu wrote:
>>> +    u32 possible[ACPI_PCI_LINK_MAX_POSSIBLE];
>>> >      u8 initialized:1;
>>> >      u8 reserved:7;
>>> >  };
>> Hi Sinan,
>>     This data structure become some sort of big, any idea to reduce
>> memory consumption?
>> Thanks,
>> Gerry
>>
> Hi Gerry,
> 
> There are two constants in the code.
> 
> #define ACPI_PCI_LINK_MAX_POSSIBLE    16
> 
> I changed the data type above. Previously it was consuming 16 bytes now
> 64 bytes.
Aha, I made a mistake. ACPI_PCI_LINK_MAX_POSSIBLE hasn't been changed,
so the space increasing is not so big:)

> 
> The second one is this.
> 
> #define ACPI_MAX_IRQS 256
> 
> I changed ACPI_MAX_IRQS to 1020 from 256. Let's assume 1024.
> 
> I'm concerned about this though since you warned. This used to consume
> 1024 bytes now 4096 bytes.
> 
> static int acpi_irq_penalty[ACPI_MAX_IRQS] = {
>     PIRQ_PENALTY_ISA_ALWAYS,    /* IRQ0 timer */
> ...
> }
> 
> Sinan
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1265687

FromTimur Tabi <timur@codeaurora.org>
Date2015-11-09 15:00 +0100
Message-ID<qsV9h-77p-35@gated-at.bofh.it>
In reply to#1265372
Sinan Kaya wrote:
>
> I'm concerned about this though since you warned. This used to consume
> 1024 bytes now 4096 bytes.
>
> static int acpi_irq_penalty[ACPI_MAX_IRQS] = {
>      PIRQ_PENALTY_ISA_ALWAYS,    /* IRQ0 timer */
> ...
> }

As long as it's not ever put on the stack, it should be fine.

-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the
Code Aurora Forum, hosted by The Linux Foundation.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1265807

FromSinan Kaya <okaya@codeaurora.org>
Date2015-11-09 17:30 +0100
Message-ID<qsXuq-mg-25@gated-at.bofh.it>
In reply to#1265687

On 11/9/2015 8:50 AM, Timur Tabi wrote:
> Sinan Kaya wrote:
>>
>> I'm concerned about this though since you warned. This used to consume
>> 1024 bytes now 4096 bytes.
>>
>> static int acpi_irq_penalty[ACPI_MAX_IRQS] = {
>>      PIRQ_PENALTY_ISA_ALWAYS,    /* IRQ0 timer */
>> ...
>> }
>
> As long as it's not ever put on the stack, it should be fine.
>

Alright...

If 1k global is OK, 4k global should be OK too.

-- 
Sinan Kaya
Qualcomm Technologies, Inc. on behalf of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a 
Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web