mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Liu, Chuansheng" <chuansheng.liu@intel.com>
To: "Siddha, Suresh B" <suresh.b.siddha@intel.com>
Cc: "mingo@redhat.com" <mingo@redhat.com>,
	"hpa@zytor.com" <hpa@zytor.com>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"yinghai@kernel.org" <yinghai@kernel.org>,
	"x86@kernel.org" <x86@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH] x86/ioapic: Fix the vector_irq[] is corrupted randomly
Date: Tue, 30 Oct 2012 01:11:53 +0000	[thread overview]
Message-ID: <27240C0AC20F114CBF8149A2696CBE4A1B78F3@SHSMSX101.ccr.corp.intel.com> (raw)
In-Reply-To: <1351542245.12459.39.camel@sbsiddha-desk.sc.intel.com>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 2759 bytes --]



> -----Original Message-----
> From: Siddha, Suresh B
> Sent: Tuesday, October 30, 2012 4:24 AM
> To: Liu, Chuansheng
> Cc: mingo@redhat.com; hpa@zytor.com; tglx@linutronix.de;
> yinghai@kernel.org; x86@kernel.org; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH] x86/ioapic: Fix the vector_irq[] is corrupted randomly
> 
> On Tue, 2012-10-30 at 00:15 +0800, Chuansheng Liu wrote:
> > Not all irq chips are IO-APIC chip.
> >
> > In our system, there are many demux GPIO interrupts except for the
> > io-apic chip interrupts, and these GPIO interrupts are belonged
> > to other irq chips, the chip data is not type of struct irq_cfg
> > either.
> >
> > But in function __setup_vector_irq(), it listed all allocated irqs,
> > and presume all irq chip is ioapic_chip and the chip data is type
> > of struct irq_cfg, it possibly causes the vector_irq is corrupted
> > randomly.
> >
> > For example, one irq 258 is not io-apic chip irq, in __setup_vector_irq(),
> > the chip data is forced to be used as struct irq_cfg, then the value
> > cfg->domain and cfg->vector are wrong to be used to write vector_irq:
> > 		vector = cfg->vector;
> > 		per_cpu(vector_irq, cpu)[vector] = irq;
> >
> > This patch use the .flags to identify if the irq chip is io-apic.
> 
> I have a feeling that your gpio driver is abusing the 'chip_data' in the
> struct irq_data. Shouldn't the driver be using 'handler_data' instead?
Not abusing.

There are many driver codes which has their own chip and chip_data.
For example,
langwell_gpio.c, the chip_data type is struct lnw_gpio;
gpio_omap.c, the chip_data type is struct gpio_bank;

In these cases, if we abused the gpio chip_data type with struct irq_cfg,
we will get very wrong cfg->vector, the value maybe 1 or 1000, anyway,
it is a random value.
> 
> From include/linux/irq.h:
>  * @handler_data:       per-IRQ data for the irq_chip methods
>  * @chip_data:          platform-specific per-chip private data for the chip
>  *                      methods, to allow shared chip implementations
> 
> Also, how are these routed to the processors and the mechanism of the
> vector assignment for these irq's? I presume irq_cfg is needed for the
> setup and the interrupt migration from one cpu to another.
Normally gpio chip just has only one base irq is related with io-apic interrupt,
other allocated *VIRTUAL* irqs are based on this base irq, so no vector assign to them.

But in code __setup_vector_irq(), it list all allocated irqs which include the *VIRTUAL* irqs,
It causes this case that chip_data type is abused.

> 
> What am I missing?
> 
> thanks,
> suresh

ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

      reply	other threads:[~2012-10-30  1:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-29 16:15 Chuansheng Liu
2012-10-29 20:24 ` Suresh Siddha
2012-10-30  1:11   ` Liu, Chuansheng [this message]

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=27240C0AC20F114CBF8149A2696CBE4A1B78F3@SHSMSX101.ccr.corp.intel.com \
    --to=chuansheng.liu@intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=suresh.b.siddha@intel.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=yinghai@kernel.org \
    /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

all inboxes | Powered by JetHome®