public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: Jacob Pan <jacob.jun.pan@linux.intel.com>,
	Alan Cox <alan@linux.intel.com>,
	Arjan van de Ven <arjan@linux.intel.com>,
	LKML <linux-kernel@vger.kernel.org>, Ingo Molnar <mingo@elte.hu>,
	Feng Tang <feng.tang@intel.com>, Len Brown <len.brown@intel.com>
Subject: Re: [PATCH] x86/sfi: fix ioapic gsi range
Date: Mon, 07 Jun 2010 18:10:12 -0700	[thread overview]
Message-ID: <m1wruacosr.fsf@fess.ebiederm.org> (raw)
In-Reply-To: <4C0D8F43.4070900@zytor.com> (H. Peter Anvin's message of "Mon\, 07 Jun 2010 17\:30\:59 -0700")

"H. Peter Anvin" <hpa@zytor.com> writes:

> On 06/07/2010 05:24 PM, Eric W. Biederman wrote:
>> Jacob Pan <jacob.jun.pan@linux.intel.com> writes:
>> 
>>> SFI based platforms should have zero based gsi_base for IOAPICs found in SFI
>>> tables. The current code sets gsi_base starting from 1 when registering ioapic.
>>> The result is that Moorestown platform would have wrong mp_gsi_routing for each
>>> ioapic.
>> 
>> Yes starting at 1 is a bug.
>> 
>>> Background:
>>> In Moorestown/Medfield platforms, there is no legacy IRQs, all gsis and irqs
>>> are one to one mapped, including those < 16. Specifically, IRQ0 and IRQ1 are
>>> used for per-cpu timers. So without this patch, IOAPIC pin to IRQ mapping is
>>> off by one.
>> 
>> The patch looks mostly reasonable the comment is wrong.
>> 
>> You may not use a 1-1 mapping if you don't have legacy irqs.  Linux
>> irqs 0-15 are the ISA irqs you may not use those irq numbers for
>> something different on any architecture, but especially not on x86.
>> The gsi numbers are firmware specific and you may treat however you want.
>> 
>> Does the following patch work for you?
>> 
>> It appears I goofed when it was pointed out that gsi_end was inclusive and
>> didn't change the initialize.
>> 
>> diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
>> index 33f3563..5de84e5 100644
>> --- a/arch/x86/kernel/apic/io_apic.c
>> +++ b/arch/x86/kernel/apic/io_apic.c
>> @@ -90,7 +90,7 @@ int nr_ioapics;
>>  struct mp_ioapic_gsi  mp_gsi_routing[MAX_IO_APICS];
>>  
>>  /* The last gsi number used */
>> -u32 gsi_end;
>> +u32 gsi_end = -1; 
>>  
>
> This seems like asking for signedness problems, especially since this is
> used in range compares all the time.  The real problem here is that
> gsi_end is inclusive, which is almost always the wrong thing for the
> endpoint of a range.  Instead we should have the last number used plus
> one; perhaps it should be called gsi_next or gsi_free.

That does sound better.  Let me see if I can find a few minutes to implement
it that way.

Eric

  reply	other threads:[~2010-06-08  1:11 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-07 23:07 [PATCH] x86/sfi: fix ioapic gsi range Jacob Pan
2010-06-08  0:01 ` jacob pan
2010-06-08  0:24 ` Eric W. Biederman
2010-06-08  0:30   ` H. Peter Anvin
2010-06-08  1:10     ` Eric W. Biederman [this message]
2010-06-08  8:10     ` Alan Cox
2010-06-08 18:11       ` H. Peter Anvin
2010-06-08 20:04         ` Eric W. Biederman
2010-06-08 18:44     ` [PATCH] x86/irq: Rename gsi_end gsi_top, and fix off by one errors Eric W. Biederman
2010-06-09 22:06       ` [tip:x86/urgent] x86, irq: " tip-bot for Eric W. Biederman
2010-06-08  5:50   ` [PATCH] x86/sfi: fix ioapic gsi range jacob pan
2010-06-08 19:41     ` Eric W. Biederman
2010-06-08 19:12       ` Alan Cox
2010-06-08 20:56         ` Yuhong Bao
2010-06-08 22:16           ` Eric W. Biederman
2010-06-08 22:29             ` Alan Cox
2010-06-08 20:36       ` H. Peter Anvin
2010-06-08 20:59         ` Eric W. Biederman
2010-06-08 21:08           ` H. Peter Anvin
2010-06-08 21:51             ` Eric W. Biederman
2010-06-08 20:41       ` jacob pan
2010-06-08 21:22         ` Eric W. Biederman
2010-06-08 22:17           ` jacob pan
2010-06-09 23:44             ` Eric W. Biederman
2010-06-10  8:40               ` jacob pan
2010-06-10 14:39                 ` Eric W. Biederman

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=m1wruacosr.fsf@fess.ebiederm.org \
    --to=ebiederm@xmission.com \
    --cc=alan@linux.intel.com \
    --cc=arjan@linux.intel.com \
    --cc=feng.tang@intel.com \
    --cc=hpa@zytor.com \
    --cc=jacob.jun.pan@linux.intel.com \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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