> All right. However this means thread_struct will have to grow in order toWell, noone seems to mind the wasted debugreg[5..6] words. ;-) I'm inclined to make thread_struct smaller than it is now by making it indirect (debugreg[8] -> one pointer). It feels like this would be pretty safe now that we have TIF_DEBUG anyway. Already nothing should be looking at the field when TIF_DEBUG isn't set. I hadn't really thought about this before, but it's pretty straightforward. Each allocation is for one of %dr[0-3] and for its associated bits in %dr7. %dr0 and bits 0,1,16-19; %dr1 and bits 2,3,20-23; etc. %dr7 & (0x000f0003 << N) for %drN, I guess it is. ((((1 << DR_CONTROL_SIZE) - 1) << DR_CONTROL_SHIFT) | ((1 << DR_ENABLE_SIZE) - 1)) << N, I should say. Each allocation owns those 38 bits (70 bits on x86_64). When all those bits are zero, the allocation is not active and might as well not be there (except for whatever semantics you might want to have about an allocation's lifetime as distinct from the event of resetting its contents). gdb already works this way: when it removes a watchpoint, it clears drN to zero when it zeros all the corresponding bits in dr7. (In fact it's in a separate call after changing dr7, because of the ptrace interface.) Your question made me think about the %dr6 issue, too, which I also hadn't thought about before. It looks like your patch handles this correctly, but it's a subtle point that I think warrants some comments in the code. When userland inserts a watchpoint and it's hit, it gets a SIGTRAP via do_debug and eventually looks at dr6 (via ptrace) to see what happened. Kernel watchpoints that come along after the user signal is generated can clobber the CPU %dr6 with new hits, but userland should not perceive this. This works out because what userland sees is thread.debugreg[6], the only place that sets it is do_debug, and a kwatch hit bails out before changing it. Any other new users of the debugreg sharing interface need to be cognizant of the %dr6 issue to avoid stepping on old ptrace uses. Thanks, Roland -
| Thomas Gleixner | Re: Linux 2.6.23-rc9 and a heads-up for the 2.6.24 series.. |
| Karl Meyer | PROBLEM: 2.6.23-rc "NETDEV WATCHDOG: eth0: transmit timed out" |
| Mark Weber | hdparm standby timeout not working for WD raptors? |
| Robin Lee Powell | NFS hang + umount -f: better behaviour requested. |
git: | |
| Adam Roben | Equivalent of `svn switch` for git-svn? |
| Linus Torvalds | Re: On Tabs and Spaces |
| Adam Mercer | git cvsimport error |
| Sam Song | Fwd: [OT] Re: Git via a proxy server? |
| Antti Harri | Re: wine question |
| Paul Pruett | anyone using zoneminder.com on OpenBSD? |
| Josh | Re: removing sendmail |
| Sevan / Venture37 | wpi(4) not working in -CURRENT |
| Bill Day | telnet: Unable to connect to remote host: Network is unreachable |
| Dong Liu | Re: CXterm for LINUX |
| Framstag | ftp-error: bind: Address already in use? |
| Theodore Ts'o | RESULT: comp.os.linux passes: 858: 5 |
| SMDK2410 LCD Framebuffer driver | 5 hours ago | Linux kernel |
| Resetting the bios password for Toshiba Laptop | 5 hours ago | Hardware |
| Problem booting a barebone kernel in VMWare | 8 hours ago | Linux kernel |
| IP layer send packet | 13 hours ago | Linux kernel |
| PID to ELF image full path | 15 hours ago | Linux kernel |
| types of kernel | 1 day ago | Linux kernel |
| magical mounts | 2 days ago | Linux kernel |
| Problem in scim in Fedora 9 | 2 days ago | Linux general |
| The new Western Digital power saving drives | 2 days ago | Hardware |
| Battery Maximizer Software | 3 days ago | Linux kernel |
