From: Henrik Nordstrom <hno@marasystems.com>
To: Jeff Dike <jdike@addtoit.com>
Cc: User-mode-linux-devel@lists.sourceforge.net
Subject: Re: [uml-devel] iptables-restore randomly crashes under UML
Date: Tue, 2 Dec 2003 01:55:25 +0100 (CET) [thread overview]
Message-ID: <Pine.LNX.4.44.0312020123030.16352-200000@filer.marasystems.com> (raw)
In-Reply-To: <Pine.LNX.4.44.0312020036530.16157-100000@filer.marasystems.com>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 2307 bytes --]
On Tue, 2 Dec 2003, Henrik Nordstrom wrote:
> On Mon, 1 Dec 2003, Henrik Nordstrom wrote:
>
> > I have got so far that it looks like the pte is not modified making me
> > suspect that there is a old page mapping around initially maybe not
> > maching the pte after the call to vmalloc().
>
> This has now been confirmed.
>
> Now remains to figure out why the mapping of the old page is still
> around and why the tlb mappings has not been synched.
This too has now been identified, but I am not sure what is the best way
to fix this.
vfree() calls flush_tlb_all(), but as this does not update the vm_seq
number old the mapping is still there unless there is another page fault
before the page is referenced again. Because of this there is a race if
vmalloc() returns the same area that was last vmfree():d causing that area
to temporarily refer to the old physical location until the next kernel
page fault and quickly resulting in very odd results..
What I wonder is if this can be fixed without dropping the vm_seq
optimization of tt kernel virtual memory updates. But from looking at the
skas implementation I suppose dropping the vm_seq optimization is the
correct way.. (skas does not have this optimization and should thus be
safe from the issue)
I have now removed this vm_seq optimization from my kernel sources and
have verified that the iptables-restore problem is no where to be seen
with this vm_seq optimization disabled. [silly patch attached just to
illustrate the problem area]
What was the design thought behind the vm_seq optimization? I understand
the principle, but not the conditions when it can be safely deduced that
the init_mm has not been updated since the last flush_kernel_vm_range().
I still think the kernel vm pte mappings should be mirrored into the
current process and flush_kernel_vm_range() changed to do incremental
remaps where the kernel vm pte mappings of init_mm differs from the
current process. This applies to both tt and skas mode. With the kernel vm
area being very limited in size such optimization should not be very hard
or costly to accomplish and will by far outperform the mm_seq optimization
of tt.. but my understanding of this is still a little limited so it might
well be the case that this is not worth bothering with.
Regards
Henrik
[-- Attachment #2: tlb_flush_all() workaround for TT mode --]
[-- Type: TEXT/PLAIN, Size: 674 bytes --]
Index: arch/um/kernel/tt/tlb.c
===================================================================
RCS file: /cvsroot/user-mode-linux/linux/arch/um/kernel/tt/tlb.c,v
retrieving revision 1.4
diff -u -w -p -r1.4 tlb.c
--- arch/um/kernel/tt/tlb.c 20 Dec 2002 23:54:49 -0000 1.4
+++ arch/um/kernel/tt/tlb.c 2 Dec 2003 00:51:42 -0000
@@ -197,7 +197,9 @@ void flush_tlb_mm_tt(struct mm_struct *m
fix_range(mm, 0, STACK_TOP, 0);
seq = atomic_read(&vmchange_seq);
+#if THIS_OPTIMIZATION_DOES_NOT_WORK_PROPERLY
if(current->thread.mode.tt.vm_seq == seq) return;
+#endif
current->thread.mode.tt.vm_seq = seq;
flush_kernel_vm_range(start_vm, end_vm, 0);
}
next prev parent reply other threads:[~2003-12-02 3:57 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-11-22 13:09 [uml-devel] iptables-restore randomly crashes under UML Henrik Nordstrom
2003-11-23 23:37 ` Henrik Nordstrom
2003-11-26 0:48 ` Adam Heath
2003-11-26 1:42 ` Henrik Nordstrom
2003-11-26 4:11 ` Henrik Nordstrom
2003-12-01 10:43 ` Henrik Nordstrom
2003-12-01 23:47 ` Henrik Nordstrom
2003-12-02 0:55 ` Henrik Nordstrom [this message]
2003-12-02 16:42 ` Jeff Dike
2003-12-02 16:49 ` Henrik Nordstrom
2003-12-02 18:58 ` Jeff Dike
2003-12-02 21:37 ` Henrik Nordstrom
2003-12-02 18:39 ` Henrik Nordstrom
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.44.0312020123030.16352-200000@filer.marasystems.com \
--to=hno@marasystems.com \
--cc=User-mode-linux-devel@lists.sourceforge.net \
--cc=jdike@addtoit.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox