πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: fa.netbsd.tech.kern
Article #131

Re: [Milkymist-devel] [Milkymist port] virtual memory management

#131
From: Yann Sionneau
Date: Mon, 03 Jun 2013 20:11
57 lines
5287 bytes
Thank you all for your answers :)

Le 30/05/13 22:45, Eduardo Horvath a οΏ½crit :
> On Wed, 29 May 2013, Yann Sionneau wrote:
>
>> Hello NetBSD fellows,
>>
>> As I mentioned in my previous e-mail, I may need from time to time a little
>> bit of help since this is my first "full featured OS" port.
>>
>> I am wondering how I can manage virtual memory (especially how to avoid tlb
>> miss, or deal with them) in exception handlers.
> There are essentially three ways to do this.  Which one you chose depends
> on the hardware.
>
> 1) Turn off the MMU on exception
That sounds like the better thing to do from my point of view, I don't 
see any big downside apart from having to duplicate a few pointers in a 
few structures to have both virtual and physical addresses of some data 
structures like PCB, trapframes, page tables.

Is there any big downside I don't see there?
If not, I would pick this solution to implement the virtual memory 
subsystem.
> 2) Keep parts of the address space untranslated
I could modify the MMU to do that, but I would prefer keeping the entire 
4 GB address space for user space :)
> 3) Lock important pages into the TLB
That's pretty easy to do for locking exception vectors in ITLB since 
vectors are contiguous in memory.
Locating every data I need to access to from exception vectors in the 
same couple of pages is not so easy I guess.
Moreover, locking a few TLB entries would mean that those virtual 
addresses ( a few pages ) would not be mappable for user space use since 
I could not eject those entries from the TLB.
I would prefer not locking any TLB entry to have it all available for 
mapping things for user space.
Moreover that would complexify even further TLB management in the vm 
subsystem.
> [...]
>
> So you can implement your VM subsystem several different ways.  Just
> remember that on a TLB-only machine you need to make sure the MMU handlers
> can access the page tables, either bypassing the MMU or using some trick
> that does not result in recursive TLB faults.
In my case, I guess I need to keep the MMU off while looking-up the page 
table and to make sure I have physical address pointers in PCB and in 
trap frames.I also need to have access to physical address of curlwp 
(which therefore would give me access to physical address of curpcb).
Maybe some other interesting structures?
> Eduardo
Thank you so much :)

Best regards,

-- 
Yann Sionneau
Technical Details
Message-ID: <fa.QqmOHe+XhnQId6rhouHmwoFi5Es@ifi.uio.no>
Path: arc1-ca.pugleaf.net!bp1ni34669pbd.1!nntp.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!goblin1!goblin.stu.neva.ru!uio.no!nntp.uio.no!.POSTED!not-for-mail
References: <fa.P+LZ+1jPGPfiK1II+UjtSSikPxk@ifi.uio.no> <fa.a/Nr8kFgmeefrHl8CNZayzk+Fkk@ifi.uio.no>

Show Full Headers
Complete Article Headers
X-Google-Thread: b7e13b6095,8afd96964b6c90d9
X-Google-Attributes: gidb7e13b6095,public,usenet
X-Google-NewGroupId: yes
X-Google-Language: ENGLISH,ASCII
X-Received: by 10.68.137.71 with SMTP id qg7mr3847964pbb.5.1370290297294;
        Mon, 03 Jun 2013 13:11:37 -0700 (PDT)
Path: arc1-ca.pugleaf.net!bp1ni34669pbd.1!nntp.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!goblin1!goblin.stu.neva.ru!uio.no!nntp.uio.no!.POSTED!not-for-mail
From: Yann Sionneau <yann.sionneau@gmail.com>
Newsgroups: fa.netbsd.tech.kern
Subject: Re: [Milkymist-devel] [Milkymist port] virtual memory management
Date: Mon, 03 Jun 2013 20:11:36 UTC
Organization: Internet mailing list
Lines: 57
Sender: tech-kern-owner@NetBSD.org
Message-ID: <fa.QqmOHe+XhnQId6rhouHmwoFi5Es@ifi.uio.no>
References: <fa.P+LZ+1jPGPfiK1II+UjtSSikPxk@ifi.uio.no> <fa.a/Nr8kFgmeefrHl8CNZayzk+Fkk@ifi.uio.no>
NNTP-Posting-Host: mail-jess.uio.no
Mime-Version: 1.0
X-Trace: readme.uio.no 1370290296 16436 129.240.7.9 (3 Jun 2013 20:11:36 GMT)
X-Complaints-To: abuse@uio.no
NNTP-Posting-Date: Mon, 3 Jun 2013 20:11:36 +0000 (UTC)
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:17.0) Gecko/20130509 Thunderbird/17.0.6
Cc: Eduardo Horvath <eeh@NetBSD.org>, 
 Yann Sionneau <yann.sionneau@gmail.com>,
 Radoslaw Kujawa <radoslaw.kujawa@c0ff33.net>, tech-kern@netbsd.org
To: Milkymist developers' list <devel@lists.milkymist.org>
Delivered-To: tech-kern@netbsd.org
X-Virus-Scanned: amavisd-new at NetBSD.org
Authentication-Results: mail.NetBSD.org (amavisd-new);
 dkim=pass (2048-bit key) header.d=gmail.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=message-id:date:from:user-agent:mime-version:to:cc:subject
         :references:in-reply-to:content-type:content-transfer-encoding;
        bh=p7ACO/kJXKJRA0fj85g2X7FV9fK/kFR6aomlMgu4tk4=;
        b=SWN1UD1bj/4HVV4tUt3ojmRD2QKeAx0jFmcx/Y6aRnifxMqLuYEx/jEWwsOTrJqeAL
         RJyZMvkzeeigLnU8yPtTXU+DhLtOWcOwT8oLJpgB7ZPlNs0NRfxzPWby/TVsoOPqHNjD
         PrBVvCjkvQKChZ4VE2z5hlfWvw7vZ4LNhcTlMGysmGgebUQ4IQlEcn9FUEZya0nbU/ay
         DyvVchiPunCa1xZPZEDYu8xF5rWYqmOmuqTtOaHqjdz19CA0OPfrLSvYiK0WDAAx/BID
         UZ8uZeMR6Pet6T1SqxOzxK1gIfnU8tOM1LfACJ/ZD7y30R44R7ihVi7OWGluEiUbA4T6
         Z2GA==
X-Received: by 10.180.185.4 with SMTP id ey4mr14401727wic.49.1370290277030;
        Mon, 03 Jun 2013 13:11:17 -0700 (PDT)
In-Reply-To: <Pine.NEB.4.64.1305302015370.9828@mail.netbsd.org>
List-Id: tech-kern.NetBSD.org
Original-Date: Mon, 03 Jun 2013 22:11:14 +0200
Original-Message-Id: <51ACF862.9060607@gmail.com>
Original-References: <51A64013.8030603@gmail.com> <Pine.NEB.4.64.1305302015370.9828@mail.netbsd.org>
Bytes: 5001
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit