From: Keir Fraser Subject: Re: deleting mtrrs in dom0 Date: Thu, 24 Mar 2005 18:26:44 +0000 Message-ID: <435553ba59f7a34b2121d2aa10334969@cl.cam.ac.uk> References: <20050324180634.GV12479@tpkurt.garloff.de> Mime-Version: 1.0 (Apple Message framework v619.2) Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit In-Reply-To: <20050324180634.GV12479@tpkurt.garloff.de> Sender: xen-devel-admin@lists.sourceforge.net Errors-To: xen-devel-admin@lists.sourceforge.net List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , List-Archive: To: Kurt Garloff Cc: Xen development list List-Id: xen-devel@lists.xenproject.org On 24 Mar 2005, at 18:06, Kurt Garloff wrote: > I seem to be undable to delete MTRRs in domain0: > > root@tpkurt:~ [0]# cat /proc/mtrr > reg00: base=0x00000000 ( 0MB), size= 512MB: write-back, count=0 > reg01: base=0x1ff80000 ( 511MB), size= 512KB: uncachable, count=0 > reg02: base=0xe0000000 (3584MB), size= 32MB: write-combining, count=0 > reg03: base=0xd0000000 (3328MB), size= 256MB: write-combining, count=0 > root@tpkurt:~ [0]# echo "disable=1" /proc/mtrr > disable=1 /proc/mtrr > root@tpkurt:~ [0]# echo "disable=1" >/proc/mtrr > root@tpkurt:~ [1]# cat /proc/mtrr > reg00: base=0x00000000 ( 0MB), size= 512MB: write-back, count=0 > reg01: base=0x1ff80000 ( 511MB), size= 512KB: uncachable, count=0 > reg02: base=0xe0000000 (3584MB), size= 32MB: write-combining, count=0 > reg03: base=0xd0000000 (3328MB), size= 256MB: write-combining, count=0 > > Isn't this supposed to work? It's been hacked just enough to get X working, but the /proc semantics haven't been given much thought. The problem is that reading /proc/mtrr tells you what the real physical MTRRs contain, but these registers weren't initialised by domain0 but by Xen, during SMP bootstrap. So when you attempt to delete them you will probably find error messages in /var/log/messages saying 'reg1 has count=0'. There are a few possible fixes, one being to let domain0 get staright at the MTRRs after it has booted, but this needs great care -- the registers have to be carefully synchronised across all physical CPUs to avoid memory deadlocks. Better might be to have a low-level stateless interface exported by Xen, and have domain0 read the MTRR state during boot and set its refcnt to one for each MTRR that is initialised and in use. -- Keir ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click