Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1686456

Re: [PATCH v7 06/16] lockdep: Detect and handle hist_lock ring buffer overwrite

From Byungchul Park <max.byungchul.park@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH v7 06/16] lockdep: Detect and handle hist_lock ring buffer overwrite
Date 2017-07-13 13:20 +0200
Message-ID <u2Kk2-4UU-27@gated-at.bofh.it> (permalink)
References (6 earlier) <u2HvP-37W-9@gated-at.bofh.it> <u2I8y-3lP-17@gated-at.bofh.it> <u2J4D-3Zi-23@gated-at.bofh.it> <u2JnY-4lu-11@gated-at.bofh.it> <u2JxE-4oH-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Jul 13, 2017 at 7:29 PM, Peter Zijlstra <peterz@infradead.org> wrote:
> On Thu, Jul 13, 2017 at 07:09:53PM +0900, Byungchul Park wrote:
>> On Thu, Jul 13, 2017 at 11:50:52AM +0200, Peter Zijlstra wrote:
>> >     wait_for_completion(&C);
>> >       atomic_inc_return();
>> >
>> >                                     mutex_lock(A1);
>> >                                     mutex_unlock(A1);
>> >
>> >
>> >                                     <IRQ>
>> >                                       spin_lock(B1);
>> >                                       spin_unlock(B1);
>> >
>> >                                       ...
>> >
>> >                                       spin_lock(B64);
>> >                                       spin_unlock(B64);
>> >                                     </IRQ>
>> >
>> >
>> >                                     mutex_lock(A2);
>> >                                     mutex_unlock(A2);
>> >
>> >                                     complete(&C);
>> >
>> >
>> > That gives:
>> >
>> >     xhist[ 0] = A1
>>
>> We have to rollback here later on irq_exit.
>>
>> The followings are ones for irq context.
>>
>> >     xhist[ 1] = B1
>> >     ...
>> >     xhist[63] = B63
>> >
>> > then we wrap and have:
>> >
>> >     xhist[0] = B64
>> >
>> > then we rewind to 1 and invalidate to arrive at:
>> >
>>
>> Now, whether xhist[0] has been overwritten or not is important. If yes,
>> xhist[0] should be NULL, _not_ xhist[1], which is one for irq context so
>> not interest at all.
>>
>> >     xhist[ 0] = B64
>> >     xhist[ 1] = NULL   <-- idx
>>
>> Therefore, it should be,
>>
>>       xhist[ 0] = NULL <- invalidate, cannot use it any more
>>       --- <- on returning back from irq context, start from here
>>       xhist[ 1] = B1 <-- obsolete history of irq
>
> Ah, so you rely on the same_context_xhlock() ? That doesn't work for
> hist (formerly work).

As I mentioned in cover-letter, I applied the rollback mechanism into work
(of workqueue) as well. So it works even for hist.

-- 
Thanks,
Byungchul

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH v7 06/16] lockdep: Detect and handle hist_lock ring  buffer overwrite Peter Zijlstra <peterz@infradead.org> - 2017-07-11 18:20 +0200
  Re: [PATCH v7 06/16] lockdep: Detect and handle hist_lock ring  buffer overwrite Byungchul Park <byungchul.park@lge.com> - 2017-07-12 04:10 +0200
    Re: [PATCH v7 06/16] lockdep: Detect and handle hist_lock ring  buffer overwrite Peter Zijlstra <peterz@infradead.org> - 2017-07-12 10:00 +0200
      Re: [PATCH v7 06/16] lockdep: Detect and handle hist_lock ring  buffer overwrite Byungchul Park <byungchul.park@lge.com> - 2017-07-13 04:10 +0200
        Re: [PATCH v7 06/16] lockdep: Detect and handle hist_lock ring  buffer overwrite Peter Zijlstra <peterz@infradead.org> - 2017-07-13 10:20 +0200
          Re: [PATCH v7 06/16] lockdep: Detect and handle hist_lock ring  buffer overwrite Byungchul Park <byungchul.park@lge.com> - 2017-07-13 11:00 +0200
            Re: [PATCH v7 06/16] lockdep: Detect and handle hist_lock ring  buffer overwrite Peter Zijlstra <peterz@infradead.org> - 2017-07-13 12:00 +0200
              Re: [PATCH v7 06/16] lockdep: Detect and handle hist_lock ring  buffer overwrite Byungchul Park <byungchul.park@lge.com> - 2017-07-13 12:20 +0200
                Re: [PATCH v7 06/16] lockdep: Detect and handle hist_lock ring  buffer overwrite Peter Zijlstra <peterz@infradead.org> - 2017-07-13 12:30 +0200
                Re: [PATCH v7 06/16] lockdep: Detect and handle hist_lock ring  buffer overwrite Peter Zijlstra <peterz@infradead.org> - 2017-07-13 13:20 +0200
                Re: [PATCH v7 06/16] lockdep: Detect and handle hist_lock ring buffer overwrite Byungchul Park <max.byungchul.park@gmail.com> - 2017-07-13 13:30 +0200
                Re: [PATCH v7 06/16] lockdep: Detect and handle hist_lock ring  buffer overwrite Byungchul Park <byungchul.park@lge.com> - 2017-07-14 03:50 +0200
                Re: [PATCH v7 06/16] lockdep: Detect and handle hist_lock ring  buffer overwrite Byungchul Park <byungchul.park@lge.com> - 2017-07-14 08:50 +0200
                Re: [PATCH v7 06/16] lockdep: Detect and handle hist_lock ring buffer overwrite Byungchul Park <max.byungchul.park@gmail.com> - 2017-07-13 13:20 +0200
          Re: [PATCH v7 06/16] lockdep: Detect and handle hist_lock ring  buffer overwrite Byungchul Park <byungchul.park@lge.com> - 2017-07-18 03:30 +0200

csiph-web