Re: svn commit: r243764 - head/sys/x86/x86

2012-12-13 Thread Andriy Gapon
on 06/12/2012 22:40 John Baldwin said the following:
> On Saturday, December 01, 2012 1:16:14 pm Andriy Gapon wrote:
>> Author: avg
>> Date: Sat Dec  1 18:16:14 2012
>> New Revision: 243764
>> URL: http://svnweb.freebsd.org/changeset/base/243764
>>
>> Log:
>>   ioapic_program_intpin: program high bits before low bits
>>   
>>   Programming the low bits has a side-effect if unmasking the pin if it is
>>   not disabled.  So if an interrupt was pending then it would be delivered
>>   with the correct new vector but to the incorrect old LAPIC.
>>   
>>   This fix could be made clearer by preserving the mask bit while
>>   programming the low bits and then explicitly resetting the mask bit
>>   after all the programming is done.
>>   
>>   Probability to trip over the fixed bug could be increased by bootverbose
>>   because printing of the interrupt information in ioapic_assign_cpu
>>   lengthened the time window during which an interrupt could arrive while
>>   a pin is masked.
> 
> Can you expand the comment to say that you write 'low' second since it may 
> clear the masked bit?
> 

Will do.

-- 
Andriy Gapon
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r243764 - head/sys/x86/x86

2012-12-06 Thread John Baldwin
On Saturday, December 01, 2012 1:16:14 pm Andriy Gapon wrote:
> Author: avg
> Date: Sat Dec  1 18:16:14 2012
> New Revision: 243764
> URL: http://svnweb.freebsd.org/changeset/base/243764
> 
> Log:
>   ioapic_program_intpin: program high bits before low bits
>   
>   Programming the low bits has a side-effect if unmasking the pin if it is
>   not disabled.  So if an interrupt was pending then it would be delivered
>   with the correct new vector but to the incorrect old LAPIC.
>   
>   This fix could be made clearer by preserving the mask bit while
>   programming the low bits and then explicitly resetting the mask bit
>   after all the programming is done.
>   
>   Probability to trip over the fixed bug could be increased by bootverbose
>   because printing of the interrupt information in ioapic_assign_cpu
>   lengthened the time window during which an interrupt could arrive while
>   a pin is masked.

Can you expand the comment to say that you write 'low' second since it may 
clear the masked bit?

-- 
John Baldwin
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r243764 - head/sys/x86/x86

2012-12-01 Thread Andriy Gapon
Author: avg
Date: Sat Dec  1 18:16:14 2012
New Revision: 243764
URL: http://svnweb.freebsd.org/changeset/base/243764

Log:
  ioapic_program_intpin: program high bits before low bits
  
  Programming the low bits has a side-effect if unmasking the pin if it is
  not disabled.  So if an interrupt was pending then it would be delivered
  with the correct new vector but to the incorrect old LAPIC.
  
  This fix could be made clearer by preserving the mask bit while
  programming the low bits and then explicitly resetting the mask bit
  after all the programming is done.
  
  Probability to trip over the fixed bug could be increased by bootverbose
  because printing of the interrupt information in ioapic_assign_cpu
  lengthened the time window during which an interrupt could arrive while
  a pin is masked.
  
  Reported by:  Andreas Longwitz 
  Tested by:Andreas Longwitz 
  MFC after:12 days

Modified:
  head/sys/x86/x86/io_apic.c

Modified: head/sys/x86/x86/io_apic.c
==
--- head/sys/x86/x86/io_apic.c  Sat Dec  1 18:13:53 2012(r243763)
+++ head/sys/x86/x86/io_apic.c  Sat Dec  1 18:16:14 2012(r243764)
@@ -311,12 +311,12 @@ ioapic_program_intpin(struct ioapic_ints
}
 
/* Write the values to the APIC. */
-   intpin->io_lowreg = low;
-   ioapic_write(io->io_addr, IOAPIC_REDTBL_LO(intpin->io_intpin), low);
value = ioapic_read(io->io_addr, IOAPIC_REDTBL_HI(intpin->io_intpin));
value &= ~IOART_DEST;
value |= high;
ioapic_write(io->io_addr, IOAPIC_REDTBL_HI(intpin->io_intpin), value);
+   intpin->io_lowreg = low;
+   ioapic_write(io->io_addr, IOAPIC_REDTBL_LO(intpin->io_intpin), low);
 }
 
 static int
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"