Re: [PATCH] x86/spinlocks: Fix regression in spinlock contention detection

2015-05-08 Thread Greg KH
On Thu, May 07, 2015 at 12:13:22AM -0700, Tahsin Erdogan wrote: > > Perhaps we need to CC stable (3.19) too..? > > > > Hi Greg, > Could you please push this patch to 3.19 ? > > commit sha: e8a4a2696fecb398b0288c43c0e0dbb91e265bb2 It's not even in a released version from Linus, so I can't add it

Re: [PATCH] x86/spinlocks: Fix regression in spinlock contention detection

2015-05-08 Thread Greg KH
On Thu, May 07, 2015 at 12:13:22AM -0700, Tahsin Erdogan wrote: Perhaps we need to CC stable (3.19) too..? Hi Greg, Could you please push this patch to 3.19 ? commit sha: e8a4a2696fecb398b0288c43c0e0dbb91e265bb2 It's not even in a released version from Linus, so I can't add it to

Re: [PATCH] x86/spinlocks: Fix regression in spinlock contention detection

2015-05-07 Thread Tahsin Erdogan
> Perhaps we need to CC stable (3.19) too..? > Hi Greg, Could you please push this patch to 3.19 ? commit sha: e8a4a2696fecb398b0288c43c0e0dbb91e265bb2 thanks -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More

Re: [PATCH] x86/spinlocks: Fix regression in spinlock contention detection

2015-05-07 Thread Tahsin Erdogan
Perhaps we need to CC stable (3.19) too..? Hi Greg, Could you please push this patch to 3.19 ? commit sha: e8a4a2696fecb398b0288c43c0e0dbb91e265bb2 thanks -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More

Re: [PATCH] x86/spinlocks: Fix regression in spinlock contention detection

2015-05-06 Thread Raghavendra K T
On 05/05/2015 09:45 AM, Tahsin Erdogan wrote: A spinlock is regarded as contended when there is at least one waiter. Currently, the code that checks whether there are any waiters rely on tail value being greater than head. However, this is not true if tail reaches the max value and wraps back to

Re: [PATCH] x86/spinlocks: Fix regression in spinlock contention detection

2015-05-06 Thread Raghavendra K T
On 05/05/2015 09:45 AM, Tahsin Erdogan wrote: A spinlock is regarded as contended when there is at least one waiter. Currently, the code that checks whether there are any waiters rely on tail value being greater than head. However, this is not true if tail reaches the max value and wraps back to

Re: [PATCH] x86/spinlocks: Fix regression in spinlock contention detection

2015-05-05 Thread Peter Zijlstra
On Tue, May 05, 2015 at 07:10:19AM -0700, Tahsin Erdogan wrote: > The conversion to signed happens with types shorter than int > (__ticket_t is either u8 or u16). Argh yes, I see. (ISO C99) 6.3.1.1 rule 2 states that: "If an int can represent all values of the original type, the value is

Re: [PATCH] x86/spinlocks: Fix regression in spinlock contention detection

2015-05-05 Thread Raghavendra K T
On 05/05/2015 07:33 PM, Tahsin Erdogan wrote: The conversion to signed happens with types shorter than int (__ticket_t is either u8 or u16). By changing Raghavendra's program to use unsigned short int, you can see the problem: #include #define LOCK_INC 2 int main() {

Re: [PATCH] x86/spinlocks: Fix regression in spinlock contention detection

2015-05-05 Thread Waiman Long
On 05/05/2015 11:25 AM, Raghavendra K T wrote: On 05/05/2015 07:33 PM, Tahsin Erdogan wrote: The conversion to signed happens with types shorter than int (__ticket_t is either u8 or u16). By changing Raghavendra's program to use unsigned short int, you can see the problem:

Re: [PATCH] x86/spinlocks: Fix regression in spinlock contention detection

2015-05-05 Thread Raghavendra K T
On 05/05/2015 09:02 PM, Waiman Long wrote: On 05/05/2015 11:25 AM, Raghavendra K T wrote: On 05/05/2015 07:33 PM, Tahsin Erdogan wrote: The conversion to signed happens with types shorter than int (__ticket_t is either u8 or u16). By changing Raghavendra's program to use unsigned short int,

Re: [PATCH] x86/spinlocks: Fix regression in spinlock contention detection

2015-05-05 Thread Tahsin Erdogan
The conversion to signed happens with types shorter than int (__ticket_t is either u8 or u16). By changing Raghavendra's program to use unsigned short int, you can see the problem: #include #define LOCK_INC 2 int main() { unsigned short int head = 32700, tail=2;

Re: [PATCH] x86/spinlocks: Fix regression in spinlock contention detection

2015-05-05 Thread Tahsin Erdogan
//#define LOCK_INC ((unsigned int)2) // case 1 This works because it is casting to unsigned int. If you change it to unsigned short int, it becomes consistent with case 2. On Tue, May 5, 2015 at 8:25 AM, Raghavendra K T wrote: > On 05/05/2015 07:33 PM, Tahsin Erdogan wrote: >> >> The conversion

Re: [PATCH] x86/spinlocks: Fix regression in spinlock contention detection

2015-05-05 Thread Peter Zijlstra
On Tue, May 05, 2015 at 04:08:22PM +0530, Raghavendra K T wrote: > > #include > > #define LOCK_INC 2 Note that to be completely identical to the kernel code you should've written: #define LOCK_INC((unsigned int)2) as per: #define TICKET_LOCK_INC

Re: [PATCH] x86/spinlocks: Fix regression in spinlock contention detection

2015-05-05 Thread Raghavendra K T
On 05/05/2015 02:47 PM, Peter Zijlstra wrote: On Mon, May 04, 2015 at 09:15:31PM -0700, Tahsin Erdogan wrote: A spinlock is regarded as contended when there is at least one waiter. Currently, the code that checks whether there are any waiters rely on tail value being greater than head. However,

Re: [PATCH] x86/spinlocks: Fix regression in spinlock contention detection

2015-05-05 Thread Peter Zijlstra
On Mon, May 04, 2015 at 09:15:31PM -0700, Tahsin Erdogan wrote: > A spinlock is regarded as contended when there is at least one waiter. > Currently, the code that checks whether there are any waiters rely on > tail value being greater than head. However, this is not true if tail > reaches the max

Re: [PATCH] x86/spinlocks: Fix regression in spinlock contention detection

2015-05-05 Thread Tahsin Erdogan
The conversion to signed happens with types shorter than int (__ticket_t is either u8 or u16). By changing Raghavendra's program to use unsigned short int, you can see the problem: #include stdio.h #define LOCK_INC 2 int main() { unsigned short int head = 32700,

Re: [PATCH] x86/spinlocks: Fix regression in spinlock contention detection

2015-05-05 Thread Raghavendra K T
On 05/05/2015 07:33 PM, Tahsin Erdogan wrote: The conversion to signed happens with types shorter than int (__ticket_t is either u8 or u16). By changing Raghavendra's program to use unsigned short int, you can see the problem: #include stdio.h #define LOCK_INC 2 int main() {

Re: [PATCH] x86/spinlocks: Fix regression in spinlock contention detection

2015-05-05 Thread Tahsin Erdogan
//#define LOCK_INC ((unsigned int)2) // case 1 This works because it is casting to unsigned int. If you change it to unsigned short int, it becomes consistent with case 2. On Tue, May 5, 2015 at 8:25 AM, Raghavendra K T raghavendra...@linux.vnet.ibm.com wrote: On 05/05/2015 07:33 PM, Tahsin

Re: [PATCH] x86/spinlocks: Fix regression in spinlock contention detection

2015-05-05 Thread Waiman Long
On 05/05/2015 11:25 AM, Raghavendra K T wrote: On 05/05/2015 07:33 PM, Tahsin Erdogan wrote: The conversion to signed happens with types shorter than int (__ticket_t is either u8 or u16). By changing Raghavendra's program to use unsigned short int, you can see the problem:

Re: [PATCH] x86/spinlocks: Fix regression in spinlock contention detection

2015-05-05 Thread Raghavendra K T
On 05/05/2015 09:02 PM, Waiman Long wrote: On 05/05/2015 11:25 AM, Raghavendra K T wrote: On 05/05/2015 07:33 PM, Tahsin Erdogan wrote: The conversion to signed happens with types shorter than int (__ticket_t is either u8 or u16). By changing Raghavendra's program to use unsigned short int,

Re: [PATCH] x86/spinlocks: Fix regression in spinlock contention detection

2015-05-05 Thread Peter Zijlstra
On Tue, May 05, 2015 at 07:10:19AM -0700, Tahsin Erdogan wrote: The conversion to signed happens with types shorter than int (__ticket_t is either u8 or u16). Argh yes, I see. (ISO C99) 6.3.1.1 rule 2 states that: If an int can represent all values of the original type, the value is converted

Re: [PATCH] x86/spinlocks: Fix regression in spinlock contention detection

2015-05-05 Thread Peter Zijlstra
On Mon, May 04, 2015 at 09:15:31PM -0700, Tahsin Erdogan wrote: A spinlock is regarded as contended when there is at least one waiter. Currently, the code that checks whether there are any waiters rely on tail value being greater than head. However, this is not true if tail reaches the max

Re: [PATCH] x86/spinlocks: Fix regression in spinlock contention detection

2015-05-05 Thread Raghavendra K T
On 05/05/2015 02:47 PM, Peter Zijlstra wrote: On Mon, May 04, 2015 at 09:15:31PM -0700, Tahsin Erdogan wrote: A spinlock is regarded as contended when there is at least one waiter. Currently, the code that checks whether there are any waiters rely on tail value being greater than head. However,

Re: [PATCH] x86/spinlocks: Fix regression in spinlock contention detection

2015-05-05 Thread Peter Zijlstra
On Tue, May 05, 2015 at 04:08:22PM +0530, Raghavendra K T wrote: #include stdio.h #define LOCK_INC 2 Note that to be completely identical to the kernel code you should've written: #define LOCK_INC((unsigned int)2) as per: #define TICKET_LOCK_INC

[PATCH] x86/spinlocks: Fix regression in spinlock contention detection

2015-05-04 Thread Tahsin Erdogan
A spinlock is regarded as contended when there is at least one waiter. Currently, the code that checks whether there are any waiters rely on tail value being greater than head. However, this is not true if tail reaches the max value and wraps back to zero, so arch_spin_is_contended() incorrectly

[PATCH] x86/spinlocks: Fix regression in spinlock contention detection

2015-05-04 Thread Tahsin Erdogan
A spinlock is regarded as contended when there is at least one waiter. Currently, the code that checks whether there are any waiters rely on tail value being greater than head. However, this is not true if tail reaches the max value and wraps back to zero, so arch_spin_is_contended() incorrectly