Re: [PATCH 2/2] ptrace: fixset_task_blockstep()->update_debugctlmsr() logic

From: Oleg Nesterov
Date: Tue Aug 07 2012 - 11:17:51 EST


Hi.

Today I noticed by accident that starting from Aug 4 (at least)
all my emails went to nowhere. I am resending some of them...


Peter, Ingo, could you help?

See the question about nmi at the end.

On 08/03, Sebastian Andrzej Siewior wrote:
>
> On 08/03/2012 07:38 PM, Oleg Nesterov wrote:
>>>> update_debugctlmsr(debugctl);
>>>> + local_irq_enable();
>>>
>>> wouldn't preempt_disable() be enough?
>>
>> preempt_disable() can't help if interrupt handler changes
>> other bits in between?
>
> So perf() uses this register as well. Since perf() uses the raw
> primitives (raw_spin_lock())

Hmm. perf/whatever uses raw_spin_lock() if the lock is raw_spinlock_t.

But this doesn't matter? Whatever irq handler does has nothing to
do with the problem, either local_irq_disable() can prevent this
irq from happening, or not.

> shouldn't you do the same?

raw_local_irq_disable? I don't think so.

> If I recall
> correctly (but it is Friday and late) local_irq_enable() wouldn't
> disable irqs on RT

You mean it doesn't disable irqs in hardware? Yet local_irq_disable()
should protect against the interrupt handler.

OK, I know nothing about RT kernel (unfortunately), perhaps it has
other primitives, but

> and perf takes the raw lock

this certainly doesn't matter, afaics.

And note that __switch_to_xtra() runs under local_irq_disable() too.


However. It seems that perf (intel_pmu_handle_irq) can play with
MSR_IA32_DEBUGCTLMSR bits in nmi? In this case local_irq_disable()
can't help. Doesn't this mean __switch_to_xtra() has problems?

Oleg.

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