mswan (Michael Swan)
User

Projects

User does not belong to any projects.

Today

  • Clear sailing ahead.

Tomorrow

  • Clear sailing ahead.

Friday

  • Clear sailing ahead.

User Details

User Since
Jun 25 2019, 6:18 AM (252 w, 19 h)
Availability
Available

Recent Activity

Sep 11 2019

mswan added reviewers for D22182: Remove anchorClicked lock which causes deadlock: kfunk, aaronpuchert.

I would like to get this merged in if possible. The work discussed for flushing out future deadlocks should also be done, but deserves its own ticket.

Sep 11 2019, 6:27 PM · KDevelop

Jul 26 2019

mswan added a comment to D22182: Remove anchorClicked lock which causes deadlock.

I have been mega busy for the last while and intend to contribute more to this project when my situation stabilizes in like two weeks. Whenever you have time, I would definitely be interested to hear what sort of challenges you have come across through experimentation. An issue which I have suspected from the onset is actually determining all that needs to be protected by DUChain's lock and those which don't since KDevelop source makes use of these locks so liberally. I'm wondering if in your experimentation there are open questions about the DUChain locking scope.

Jul 26 2019, 7:44 PM · KDevelop

Jul 15 2019

mswan added a comment to D22182: Remove anchorClicked lock which causes deadlock.

Okay, that all makes sense to me. Also, in spite of what I said earlier, I think the explicit DUChain locking should be done and there eventually should be some work done to determine which objects will only interact with one specific DUChain per instance of that object, i.e. an object that should reference a specific DUChain, e.g. ClangSupport. We could make the first pass at this involve replacing all of those DUChainReadLocker lock; lines with DUChainReaderLocker lock(DUChain::lock());, but ideally we would eventually come to some understanding about which objects are instantiated within a specific DUChain context such that multiple instances can coexist with entirely independent DUChain interactions. The eventual use case for this is something like T11223 which at this point has so very many unknowns that it would be difficult to start tailoring changes like proposed here to that end. At this stage with the desired changes loosely described above, I am inclined to think that there needs to be some explicitly stated semantics of DUChain::lock(), i.e. it locks all DUChain instances. If we eventually start adding support for multiple DUChain instances we would at least not have to worry about any of these existing locks being overly permissive given the suggested default semantics. I don't know if anything I have just said changes anything about how we would go about applying Clang Thread Safety annotations to this project, but I suspect that it does. Thoughts?

Jul 15 2019, 2:00 PM · KDevelop
mswan updated the task description for T11223: Option to support target-specific DUChain.
Jul 15 2019, 1:45 PM · KDevelop
mswan updated the task description for T11223: Option to support target-specific DUChain.
Jul 15 2019, 1:32 PM · KDevelop
mswan triaged T11224: Build target context view as Wishlist priority.
Jul 15 2019, 1:19 PM · KDevelop
mswan updated the task description for T11223: Option to support target-specific DUChain.
Jul 15 2019, 1:07 PM · KDevelop
mswan triaged T11223: Option to support target-specific DUChain as Wishlist priority.
Jul 15 2019, 12:58 PM · KDevelop

Jul 11 2019

mswan updated the task description for T11209: Determine better policy for handling ahead-of-time struct definitions.
Jul 11 2019, 10:25 PM · KDevelop
mswan added a comment to T11209: Determine better policy for handling ahead-of-time struct definitions.

Even in contexts where you are specifying the struct itself, it is still matching against the typedef.

Jul 11 2019, 9:32 PM · KDevelop
mswan triaged T11209: Determine better policy for handling ahead-of-time struct definitions as Normal priority.
Jul 11 2019, 7:30 AM · KDevelop

Jul 8 2019

mswan added a comment to D22182: Remove anchorClicked lock which causes deadlock.

I don't find it terribly verbose. Also there are other locks used in the du-chain code, and I think it doesn't hurt to be a little bit more explicit.

Jul 8 2019, 6:22 AM · KDevelop

Jul 7 2019

mswan added a comment to D22182: Remove anchorClicked lock which causes deadlock.

If we make the lock explicit, we can just annotate the constructor with ACQUIRE[_SHARED](duChainLock) (using the macros from the docs).

Jul 7 2019, 7:27 AM · KDevelop

Jul 4 2019

mswan added a comment to D22182: Remove anchorClicked lock which causes deadlock.

I think this DUChain::lock() probably still needs to be exposed as a variable or perhaps it needs to be annotated some way because I suspect that clang is not going to figure out that every value returned from this function is the exact same lock. If I start adding annotations to functions that expect the effectively global DUChain lock to be held beforehand, I would have to write something like REQUIRES(DUChain::lock()) which as I said likely doesn't do what I want.

Jul 4 2019, 2:45 AM · KDevelop
mswan added a comment to D22182: Remove anchorClicked lock which causes deadlock.

Hmm, you're right. Maybe we can get rid of that when we're certain through static checking that this isn't needed anymore.

Well at least the destructor will need that behaviour because it is certainly sane behaviour for someone to unlock a lock somewhere along the line and then leave it unlocked till the end of the function, e.g. the code I included with this ticket. There didn't seem to be a way that I could scope that lock because this lock was needed for a local constructor invocation.

Jul 4 2019, 2:03 AM · KDevelop
mswan added a comment to D22182: Remove anchorClicked lock which causes deadlock.

So it might make sense to try to refactor this DUChain locking abstraction entirely and possibly change all call-sites to respect the new interface. The first obvious question is how do you make this locker thing achieve the same end. It is somewhat convenient that the destructor idempotent behaviour is the way it is. I don't want to invoke lock.lock() at the end of every function to satisfy that destructor and I also wouldn't want to get rid of that destructor behaviour.

Jul 4 2019, 1:36 AM · KDevelop
mswan added a comment to D22182: Remove anchorClicked lock which causes deadlock.

Lock and unlock shouldn't be idempotent.

Jul 4 2019, 1:32 AM · KDevelop
mswan added a comment to D22182: Remove anchorClicked lock which causes deadlock.

This should definitely be tried and I would be interested in the task. There is definitely quite alot of stuff that needs to be annotated to make this work so it might need several hands working on it.

I'd be delighted and would happily work with you on this. I worked on the Thread Safety Analysis feature for a while.

The one problem with adopting that system in KDevelop is that we copy DUChain::lock() into each instance of DUChain{Read,Write}Locker which means that our annotations wouldn't see the DUChainReadLocker in one instance as the same lock in another instance.

I don't think the lock is copied, it's just a pointer to it. That's not an issue, std::lock_guard does that as well. Note that DUChainLock would be annotated with __attribute__((capability("mutex"))), but DUChainReadLocker with __attribute__((scoped_lockable)). The analysis tracks which scoped capability owns which capability.

Since I have never seen DUChain{Read,Write}Locker used with anything other than DUChain::lock()

Wondered about this as well—the constructor allows specifying any lock, but this is used only with DUChain::lock().

this shouldn't be cause for false positive deadlock detection.

Deadlock detection needs to turned on separately anyway. (With -Wthread-safety-negative, because it requires "negative capabilities", i.e. someone not having a lock as opposed to having it.)

I wouldn't worry too much about that for now.

Jul 4 2019, 1:18 AM · KDevelop

Jul 3 2019

mswan added a comment to D22182: Remove anchorClicked lock which causes deadlock.

I looked through all of the paths to the failed assertion discussed in that latter ticket and it appears that all but the invocation in PotentialBuddyCollector::accept is verified to have the reader lock held prior to invocation. There were two paths which needed a lock added given my change, so this change set should not cause any regression on bug #386901.

I've always wondered whether Clang's Thread Safety Analysis could be of any help in KDevelop, perhaps it is.

Jul 3 2019, 1:26 AM · KDevelop

Jul 2 2019

mswan added a reviewer for D22182: Remove anchorClicked lock which causes deadlock: KDevelop.
Jul 2 2019, 2:42 AM · KDevelop

Jul 1 2019

mswan updated the diff for D22182: Remove anchorClicked lock which causes deadlock.

Add now necessary locks to avoid recurrence of bug 386901.

Jul 1 2019, 2:08 AM · KDevelop
mswan requested review of D22182: Remove anchorClicked lock which causes deadlock.
Jul 1 2019, 1:55 AM · KDevelop