Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1283212
| From | Russell King - ARM Linux <linux@arm.linux.org.uk> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: Domain faults when CONFIG_CPU_SW_DOMAIN_PAN is enabled |
| Date | 2015-12-03 18:30 +0100 |
| Message-ID | <qBFRE-879-9@gated-at.bofh.it> (permalink) |
| References | (3 earlier) <qBAIh-4rp-7@gated-at.bofh.it> <qBARY-4KT-1@gated-at.bofh.it> <qBCh4-5K6-13@gated-at.bofh.it> <qBELU-7sA-1@gated-at.bofh.it> <qBFeW-7CN-25@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
[Multipart message — attachments visible in raw view] - view raw
On Thu, Dec 03, 2015 at 04:41:18PM +0000, Russell King - ARM Linux wrote: > On Thu, Dec 03, 2015 at 04:12:06PM +0000, Peter Rosin wrote: > > * uaccess_with_memcpy.c:__copy_to_user() has a mode in which it copies > > "non-atomically" (if faulthandler_disabled() returns 0). If a fault > > happens during __copy_to_user, what prevents some other thread from > > clobbering DACR? > > See the second point above. Moreover, if we sleep in down_read(), > then __switch_to() reads the current DACR value and saves it in the > thread information, and will restore that value when resuming the > thread - even if the thread has been migrated to a different CPU. I thought this was correct, but it isn't - that's what my original solution did, but I think when Will reviewed it, we decided it wasn't necessary - and it isn't necessary for every single case with the exception of this one. This is exactly what's going wrong: the down_read() in these paths calls into the scheduler, which switches away. When we come back, the DACR value is reset by the other thread to 0x51. There's a few ways to solve this: 1. Make the thread switching code save and restore the DACR register as it would do for domains. This imposes an overhead on every single context switch whether or not we happen to be in this _single_ troublesome code. (Patch attached - as there's several, I'm attaching them.) 2. Add additional code to the uaccess-with-memcpy stuff to reset the DACR value prior to using memcpy() or memset(). (Patch attached.) 3. Make uaccess-with-memcpy depend on !CPU_SW_DOMAINS_PAN (suggested by Will) 4. Delete the uaccess-with-memcpy code (also suggested by Will.) I think the best thing I can do is say... "Discuss amongst yourselves" :) -- FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
RE: Domain faults when CONFIG_CPU_SW_DOMAIN_PAN is enabled Peter Rosin <peda@axentia.se> - 2015-12-03 09:40 +0100
Re: Domain faults when CONFIG_CPU_SW_DOMAIN_PAN is enabled Russell King - ARM Linux <linux@arm.linux.org.uk> - 2015-12-03 12:10 +0100
RE: Domain faults when CONFIG_CPU_SW_DOMAIN_PAN is enabled Peter Rosin <peda@axentia.se> - 2015-12-03 12:50 +0100
Re: Domain faults when CONFIG_CPU_SW_DOMAIN_PAN is enabled Russell King - ARM Linux <linux@arm.linux.org.uk> - 2015-12-03 13:00 +0100
RE: Domain faults when CONFIG_CPU_SW_DOMAIN_PAN is enabled Peter Rosin <peda@axentia.se> - 2015-12-03 13:10 +0100
Re: Domain faults when CONFIG_CPU_SW_DOMAIN_PAN is enabled Russell King - ARM Linux <linux@arm.linux.org.uk> - 2015-12-03 14:40 +0100
RE: Domain faults when CONFIG_CPU_SW_DOMAIN_PAN is enabled Peter Rosin <peda@axentia.se> - 2015-12-03 17:20 +0100
Re: Domain faults when CONFIG_CPU_SW_DOMAIN_PAN is enabled Russell King - ARM Linux <linux@arm.linux.org.uk> - 2015-12-03 17:50 +0100
Re: Domain faults when CONFIG_CPU_SW_DOMAIN_PAN is enabled Russell King - ARM Linux <linux@arm.linux.org.uk> - 2015-12-03 18:30 +0100
Re: Domain faults when CONFIG_CPU_SW_DOMAIN_PAN is enabled Nicolas Pitre <nico@fluxnic.net> - 2015-12-03 19:30 +0100
Re: Domain faults when CONFIG_CPU_SW_DOMAIN_PAN is enabled Russell King - ARM Linux <linux@arm.linux.org.uk> - 2015-12-05 14:50 +0100
RE: Domain faults when CONFIG_CPU_SW_DOMAIN_PAN is enabled Peter Rosin <peda@axentia.se> - 2015-12-03 22:40 +0100
Re: Domain faults when CONFIG_CPU_SW_DOMAIN_PAN is enabled Russell King - ARM Linux <linux@arm.linux.org.uk> - 2015-12-10 01:30 +0100
RE: Domain faults when CONFIG_CPU_SW_DOMAIN_PAN is enabled Peter Rosin <peda@axentia.se> - 2015-12-10 16:40 +0100
Re: Domain faults when CONFIG_CPU_SW_DOMAIN_PAN is enabled Russell King - ARM Linux <linux@arm.linux.org.uk> - 2015-12-10 17:30 +0100
RE: Domain faults when CONFIG_CPU_SW_DOMAIN_PAN is enabled Peter Rosin <peda@axentia.se> - 2015-12-10 19:40 +0100
csiph-web