Date: Mon, 3 Mar 2008 11:48:50 -0800 (PST) From: fchang@cs.ubc.ca To: Roman Divacky <rdivacky@FreeBSD.org> Cc: freebsd-emulation@FreeBSD.org Subject: Re: patch for /usr/ports/emulators/vmware3 Message-ID: <Pine.GSO.4.60.0803031146310.29005@cascade.cs.ubc.ca> In-Reply-To: <20080303184435.GA73429@freebsd.org> References: <Pine.GSO.4.60.0803030908590.24210@cascade.cs.ubc.ca> <20080303184435.GA73429@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 3 Mar 2008, Roman Divacky wrote: > I dont think this is correct. you are modifying > the filedescriptor while holding "shared lock". > unless I am wrong it should be changed to FILEDESC_XLOCK/XUNLOCK Yes I think you're right. I just recompiled vmware3 with your correction of FILEDESC_XLOCK/FILEDESC_XUNLOCK, and things still work fine. So I'm happy. Here is the revised patch: --- work/vmware-distrib/vmmon-only/freebsd/driver.c.old 2008-03-03 17:03:25.000000000 +0000 +++ work/vmware-distrib/vmmon-only/freebsd/driver.c 2008-03-03 17:04:13.000000000 +0000 @@ -397,12 +397,12 @@ if ((error = falloc(td, &fp, &fd)) != 0) return error; - FILEDESC_LOCK(p->p_fd); + FILEDESC_XLOCK(p->p_fd); fp->f_data = data; fp->f_flag = flags & FMASK; fp->f_ops = &vmmon_fileops; fp->f_type = DTYPE_SOCKET; - FILEDESC_UNLOCK(p->p_fd); + FILEDESC_XUNLOCK(p->p_fd); #if __FreeBSD_version >= 501111 /* falloc now returns TWO references to the file, not one. */ @@ -1309,6 +1309,19 @@ return FALSE; } +static vm_paddr_t +get_avail_end(void) +{ + vm_paddr_t avail_end; + int i; + avail_end = phys_avail[1]; + for (i = 0; phys_avail[i + 1]; i += 2) { + if (phys_avail[i + 1] > avail_end) + avail_end = phys_avail[i + 1]; + } + return avail_end; +} + /* * Allocate and lock numPages of memory physically continguous addresses * below 4GB. @@ -1341,6 +1354,7 @@ VMDEBUG("vmmon_alloc_low_pages: malloc MemRange failed\n"); return ENOMEM; } + vm_paddr_t avail_end = get_avail_end(); if (avail_end > ISA_DMA_BOUNCE_THRESHOLD) high = trunc_page(ISA_DMA_BOUNCE_THRESHOLD); else --- work/vmware-distrib/vmmon-only/include/vm_asm.h.old 2008-03-03 17:03:22.000000000 +0000 +++ work/vmware-distrib/vmmon-only/include/vm_asm.h 2008-03-03 17:07:21.000000000 +0000 @@ -1020,6 +1020,7 @@ *----------------------------------------------------------------------------- */ +#if 0 static INLINE void Div643264(uint64 dividend, uint32 divisor, @@ -1047,6 +1048,7 @@ *quotient = (uint64)hQuotient << 32 | lQuotient; } #endif +#endif #endif /* VM_ASM_H */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.60.0803031146310.29005>