From: Peter Stuge Date: Thu, 1 Mar 2012 20:53:41 +0100 Subject: [ath9k-devel] "Failed to stop Tx DMA" and "Could not stop RX" with AR9485 In-Reply-To: <4F4FCBA1.4080601@openwrt.org> References: <4F4E9A36.2080809@lacto.se> <20120301144642.13047.qmail@stuge.se> <4F4FB06F.6030201@openwrt.org> <20120301175339.28512.qmail@stuge.se> <4F4FBC4E.6050109@openwrt.org> <20120301184243.32168.qmail@stuge.se> <4F4FCBA1.4080601@openwrt.org> Message-ID: <20120301195341.5283.qmail@stuge.se> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: ath9k-devel@lists.ath9k.org Felix Fietkau wrote: > >> Instrumenting at a lower level does not necessarily help. Even if you > >> manage to capture all PCI bus traffic, there's still a good chance that > >> this won't help, because the problem could very well be in a completely > >> different layer. > > > > Yes, it depends on what the error is of course. But making > > assumptions is not the way to do debugging. > > Right, that's why I'm trying to bust your assumption that starting > with the lowest layer is a good idea. No assumption involved. > >> > Still, DMA is not exotic, and here are DMA problems again. > >> > >> That last sentence makes no sense at all. > > > > My point is that DMA by peripheral devices and the drivers to manage > > it are established technologies in computer busses across the world, > > so it keeps surprising me that drivers in 2012 get it wrong. > > Which proves to me yet again that you're completely missing the point of > what I'm saying about the likelihood of this being *NOT* DMA related. It is, because the error leads to either or both sides thinking about DMA when they should not. > >> How do you define 'lowest level'? > > > > An example would be to monitor state machines inside the device using > > side channel debugging, while in parallell monitoring state machines > > inside the driver. Then comparing them after the fact and seeing > > where one goes wrong. Find out why, and audit the complete driver for > > similar types of errors. > > In my experience, this generates *way* too much data to be of any use to > narrow down the source of the problem. Filtering out unimportant data is of course a big part of the debugging. The very first thing to do I'd say, and also a recurring thing to do, in order to build the complete picture of what is going on. The more knowledge about the hardware one has, the faster this process is. It might need a few days of work next to the logic analyzer for someone with a predisposition. > The lower you go on the level of abstraction, the more data any kind of > debugging approach generates, meaning way more effort to analyze the > data and make sense of it. Only if the data can't be interpreted, for example, due to lack of documentation. > I don't typically start with the part that's hardest to analyze. High > level states are easier to look into and make sense of, so they're also > easier to rule out. But they mask a myriad of lower level operations. I also did not universally argue against the top-down approach, but if there is a tricky problem then I much prefer to acquire all the data once and look at it carefully, instead of trying to turn knobs to see what happens. > Code review is also a very good starting point. I actually found and > fixed more user visible bugs through code review than any other > debugging method. I expect everyone to do code review and to catch their own simple mistakes. I also expect at least one more person to have done code review before the code ends up in a kernel tree. But it is obviously impractical for a bystander to do code review of ath9k when it was first introduced, because, as always, it's a code drop, and did I mention that there is no documentation, meaning that it's impossible to catch anything but the most stupid mistakes with review alone. > Most issues can be fixed with a good understanding of the code alone, > detailed hardware knowledge is often not as important. Understanding the code is one thing. Understanding the hardware is another. The code can be studied to gain understanding of the code. The hardware can not be studied. Unless one has complete understanding of both code and hardware it's impossible to spot all errors in the code. This is why documentation and information flow is critical to have working software. Reverse engineering the hardware by studying the code leads to an at-best incomplete understanding of the hardware, and copious amounts of life will have been wasted in the process. > This isn't unique to ath9k. Agree completely. > I've fixed bugs in other drivers as well without having any form of > hardware documentation, because I'm able to read and understand > code and my brain can handle a bit of complexity. Sure, it's possible to guess what is causing a problem, but it's more reliable to know for sure. As a bonus, one might discover other smaller issues that can be fixed along the way. > OK, so let me get this straight: You can't imagine how the test result > from disabling PS could be useful for tracking down the problem, so you > automatically assume that it *must* be a lame workaround suggestion? > That seems rather narrow-minded of you. The first time it was suggested and tried it gave a bit of valuable information. Now, several years later, the same test doesn't keep on giving so many useful bits of information anymore.. Since it's a high level test it can't determine with much certainty what the key lower level effects are which make the symptom disappear. > Of course I can see multiple ways in which this information would > be useful, but I guess that may not matter to you. Right, the fact that it can mean *multiple* things is what makes it useless. I never said that the test does not narrow the search, but it's not sufficient to *identify* any issue, so when it is the only suggestion given, over and over, it is, in fact, just a workaround. //Peter