From: Simon Kagstrom Subject: Re: FreeBSD netfront.c / problem Date: Fri, 10 Mar 2006 11:06:25 +0100 Message-ID: <8764mm62ce.wl%simon.kagstrom@bth.se> References: <877j73636a.wl%simon.kagstrom@bth.se> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Return-path: In-Reply-To: <877j73636a.wl%simon.kagstrom@bth.se> 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-devel list List-Id: xen-devel@lists.xenproject.org At Thu, 09 Mar 2006 16:36:13 +0100, Simon Kagstrom wrote: > 48 for (i = 0, m_new = sc->xn_rx_batch; m_new; > 49 i++, sc->xn_rx_batchlen--, m_new = next) { > 50 > [...] > 70 rx_pfn_array[i] = vtomach(mtod(m_new,vm_offset_t)) >> PAGE_SHIFT; > > The above call fails gives -1 (i.e., an invalid virtual -> machine > translation) time since some mbufs are placed on the same page. > > 71 > 72 /* Remove this page from pseudo phys map before passing back to Xen. */ > 73 xen_phys_machine[((unsigned long)m_new->m_ext.ext_args >> PAGE_SHIFT)] > 74 = INVALID_P2M_ENTRY; > > ... because this invalidates that mapping. I therefore get every > [...] > second entry in rx_pfn_array set to -1. > Questions: I don't know FreeBSD very well, but does FreeBSD always > place the mbufs on separate pages? How could the above code otherwise > work? I think I found the problem myself, in sys/i386-xen/conf/XENCONF, MCLSHIFT is defined to 12, which means that each mbuf cluster will be 4KB large. I had it at 11, which should explain why every second rx_pfn_array was reset. So, then I'm curious: was this the reason for setting MCLSHIFT to 12 in FreeBSD? // Simon