From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Thread: fdd80,5cdb0c1dbaceb85b X-Google-NewGroupId: yes X-Google-Thread: 1164f8,5cdb0c1dbaceb85b X-Google-NewGroupId: yes X-Google-Attributes: gide311f70d09,gidd180ab3bd8,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.226.10 with SMTP id ro10mr860207pbc.6.1329310725047; Wed, 15 Feb 2012 04:58:45 -0800 (PST) Path: wr5ni27942pbc.0!nntp.google.com!news2.google.com!goblin2!goblin.stu.neva.ru!aioe.org!.POSTED!not-for-mail From: paramucho@hotmail.com (paramucho) Newsgroups: alt.sys.pdp11,vmsnet.pdp-11,comp.sys.dec Subject: Re: PDP11 Values from MFPT Date: Wed, 15 Feb 2012 12:58:37 GMT Organization: Aioe.org NNTP Server Message-ID: <4f3dab02.35785786@nntp.aioe.org> References: <4f339e98.40806741@nntp.aioe.org> <4f360d68.39000374@nntp.aioe.org> <4f396a03.27713593@nntp.aioe.org> <4f37ec05.63303162@nntp.aioe.org> <4f3a87d9.14307647@nntp.aioe.org> <4f3ca414.21534066@nntp.aioe.org> Reply-To: paramucho@hotmail.com NNTP-Posting-Host: CmgvwL3sOlojnxUjt8znzA.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.8.2 X-Newsreader: Forte Agent 1.5/32.451 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit On Tue, 14 Feb 2012 20:54:51 +0100, Johnny Billquist wrote: >>>> >>>>>> What I realized tonight however is that the E11 bug distracted me from >>>>>> noticing a bigger problem: The J11 and SimH might give us the backout >>>>>> information for the stack ([20|26]), but it's of no use because the >>>>>> MTPI stack operand will have already been overwritten by the MMU trap. >>>>>> The value we wanted to write to user space (for example) can't be >>>>>> recovered. >>>>> >>>>> Sweet jesus. That is right. MFPx/MTPx instructions can't be restarted. >>>>> It's a design error in the PDP-11. Gha, that's ugly. >>>> >>>> Yes, but only MTPx is affected. MFPx doesn't have the problem (which >>>> also means that we can use MFPx in solving the MTPx problem). >>> >>> Huh? I did not get that last part. How does MFPx solve the MTPx problem? >>> Doing a read before every write? >> >> "in solving" as in "implementing a workaround." >> >> We get a page fault and we want to see if the instruction causing the >> fault was MTPx? So, how do we look at that instruction? With MFPx. > >Well, this is only a problem when this happens in kernel mode. And you >can just check the failed instruction by checking where the MMR2 >register points to see what instruction was executed. Fine, but there is no reason not to use MFPx. Further, we may still have to perform the same check for code in supervisor mode, and in that case MFPx is a more general solution. Supervisor mode (SP)+ faults will need to have their stacks protected from overwriting from other activities. >> I was thinking of a generalised way of handling (SP)+-related faults >> in kernel mode. > >But this whole problem is a thing when you have something POP something >from the stack. Looking at the previous instruction thought was just for >the MTPx instruction, as that pops the value to write off the stack, and >to restart in kernel mode you then need to re-push the value again. >The idea was simply to restrict the page fault handler to be able to >deal with just a specific sequence, namely PUSH, immediately followed by >MTPx, so that the restart can actually back up and redo the PUSH as well. >But it was just one possible solution to a specific scenario. > >In general, I think that doing page-faulting in the kernel is a bad idea. I'm not convinced... I've been looking at my existing RUST/XM code, and, given what I've learned in the last week or so, I think I could add a pager to it. To do that I'd certainly be handling page faults in the kernel, but from what I've looked at today it doesn't seem that difficult. >>>> "Operational" solutions are available to the other issues as well. For >>>> example, MFPS will never fail to a general register. >>> >>> Right. However, I think I actually prefer the idea that the kernel >>> checks/knows that the page is accessible before doing any access. >> >> It would have to know that the page remained accessible not just >> before the access, but across the access, and that would mean locking >> the page. That could get kind of expensive. > >You already need to be able to lock pages in memory anyway, as well as >have code to check that memory is paged in, and then do the locking. >This is required for things like DMA, so it's not that you need much more. Of course that code will be present, but translating page addresses (two per address range), applying the lock and then releasing the lock is a relatively expensive process--I tend to opt for speed when I can. >And as for "across the access", I'm not really fond of the Unix way of >having user processed get bogged down in the kernel and being preempted >and suspended in kernel mode. I prefer having all the service by the >kernel be finished immediately, and get back out to userland, and wait >there. So you need to be sure that what you are going to access is >available in the beginning, and after that, it will stay around until >your piece of service is finished. No additional checks. Unix wouldn't be my benchmark in that area. My memory maybe faulty, but I seem to recall that RSX handles system calls ("executive directives") in system state, or something like it, effectively blocking any scheduling activity, or even forks. Tell me it isn't true! RT-11, RUST/XM and VMS control preemption entirely through mutexs/semaphores etc and system state. The kernel code which implements system calls for processes is just as preemptable as user mode code (and is reentrant). Anything less than that would seem pretty antiquated to me. Ian