From: "Jan Beulich" Subject: [PATCH] fix MTRR handling Date: Wed, 04 Jan 2006 18:16:54 +0100 Message-ID: <43BC1116.76F0.0078.0@novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part82A07016.0__=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-merge@lists.xensource.com Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part82A07016.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline After fixing the respective problems in the hypervisor it became apparent that there also was a problem in the guest. Attached patch fixes - an obvious cut-and-paste error - return value range issues Clearly this patch should, in an appropriately modified form if necessary, also be applied to trees other than the merge one. Jan --=__Part82A07016.0__= Content-Type: text/plain; name="xenlinux-x86-mtrr.patch" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="xenlinux-x86-mtrr.patch" Index: 2005-12-16/arch/i386/kernel/cpu/mtrr/main-xen.c =================================================================== --- 2005-12-16.orig/arch/i386/kernel/cpu/mtrr/main-xen.c 2005-12-16 15:38:28.000000000 +0100 +++ 2005-12-16/arch/i386/kernel/cpu/mtrr/main-xen.c 2006-01-04 17:43:09.000000000 +0100 @@ -67,8 +67,10 @@ int mtrr_add_page(unsigned long base, un op.u.add_memtype.pfn = base; op.u.add_memtype.nr_pfns = size; op.u.add_memtype.type = type; - if ((error = HYPERVISOR_dom0_op(&op))) + if ((error = HYPERVISOR_dom0_op(&op))) { + BUG_ON(error > 0); return error; + } if (increment) ++usage_table[op.u.add_memtype.reg]; @@ -131,8 +133,12 @@ int mtrr_del_page(int reg, unsigned long if (--usage_table[reg] < 1) { op.cmd = DOM0_DEL_MEMTYPE; op.u.del_memtype.handle = 0; - op.u.add_memtype.reg = reg; - (void)HYPERVISOR_dom0_op(&op); + op.u.del_memtype.reg = reg; + error = HYPERVISOR_dom0_op(&op); + if (error) { + BUG_ON(error > 0); + goto out; + } } error = reg; out: --=__Part82A07016.0__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=__Part82A07016.0__=--