Bug 117350 - compile error in emulators/vmware3
Summary: compile error in emulators/vmware3
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-emulation (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-10-20 05:00 UTC by Yi Wang
Modified: 2008-04-01 15:10 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yi Wang 2007-10-20 05:00:05 UTC
cc -O -pipe -march=athlon-mp -DCDEV_MAJOR_=200 -DDDB -DVMX86_DEBUG -DSMP -DAPIC_
IO  -D_KERNEL -DKLD_MODULE -std=c99 -nostdinc  -I/usr/ports/emulators/vmware3/wo
rk/vmware-distrib/vmmon-only/include -I/usr/ports/emulators/vmware3/work/vmware-
distrib/vmmon-only/common -I/usr/ports/emulators/vmware3/work/vmware-distrib/vmm
on-only/freebsd -I/usr/ports/emulators/vmware3/work/vmware-distrib/vmmon-only/ex
port/include -I/sys -I/usr/ports/emulators/vmware3/work/vmware-distrib/vmmon-onl
y/../vmnet-only/freebsd/ -I. -I@ -I@/contrib/altq -finline-limit=8000 --param in
line-unit-growth=100 --param large-function-growth=1000 -fno-common  -mno-align-
long-strings -mpreferred-stack-boundary=2  -mno-mmx -mno-3dnow -mno-sse -mno-sse
2 -mno-sse3 -ffreestanding -Wall -Wredundant-decls -Wnested-externs -Wstrict-pro
totypes  -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual  -Wundef -Wno
-pointer-sign -fformat-extensions -c /usr/ports/emulators/vmware3/work/vmware-di
strib/vmmon-only/common/task.c
In file included from /usr/ports/emulators/vmware3/work/vmware-distrib/vmmon-onl
y/include/taskswitch.h:25,
                 from /usr/ports/emulators/vmware3/work/vmware-distrib/vmmon-onl
y/common/task.c:54:
/usr/ports/emulators/vmware3/work/vmware-distrib/vmmon-only/include/vm_asm.h: In
 function 'Div643264':
/usr/ports/emulators/vmware3/work/vmware-distrib/vmmon-only/include/vm_asm.h:103
3: error: memory input 4 is not directly addressable
*** Error code 1

Stop in /usr/ports/emulators/vmware3/work/vmware-distrib/vmmon-only.
*** Error code 1

Stop in /usr/ports/emulators/vmware3/work/vmware-distrib/vmmon-only.
*** Error code 1

Stop in /usr/ports/emulators/vmware3/work/vmware-distrib.
*** Error code 1

Stop in /usr/ports/emulators/vmware3.
*** Error code 1

Stop in /usr/ports/emulators/vmware3.

% cat /usr/ports/emulators/vmware3/Makefile | grep ^PORT
PORTNAME=       vmware3
PORTVERSION=    3.2.1.2242
PORTREVISION=   13
PORTEPOCH=      1

Fix: 

Don't know.
How-To-Repeat: every time.
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2007-10-20 05:24:30 UTC
Responsible Changed
From-To: freebsd-ports-bugs->freebsd-emulation

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 Yi Wang 2007-11-26 09:16:07 UTC
Any idea?

This is the latest uname:

uname -a
FreeBSD wangyi.com 7.0-BETA3 FreeBSD 7.0-BETA3 #0: Fri Nov 23 12:18:30 CST 2007
root@wangyi.com:/usr/obj/usr/src/sys/MYKERNEL  i386

And I've already delete make.conf in /etc.

Thanks!

On 10/20/07, FreeBSD-gnats-submit@freebsd.org
<FreeBSD-gnats-submit@freebsd.org> wrote:
> Thank you very much for your problem report.
> It has the internal identification `ports/117350'.
> The individual assigned to look at your
> report is: freebsd-ports-bugs.
>
> You can access the state of your problem report at any time
> via this link:
>
> http://www.freebsd.org/cgi/query-pr.cgi?pr=117350
>
> >Category:       ports
> >Responsible:    freebsd-ports-bugs
> >Synopsis:       compile error in vmware3
> >Arrival-Date:   Sat Oct 20 04:00:05 UTC 2007
>


-- 
Regards,
Wang Yi
Comment 3 Yi Wang 2007-11-26 09:40:09 UTC
Additionally, this is my kernel config file:

cpu		I686_CPU
ident		MYKERNEL
options 	SCHED_ULE		# 4BSD scheduler
options 	PREEMPTION		# Enable kernel thread preemption
options 	INET			# InterNETworking
options 	INET6			# IPv6 communications protocols
options 	SCTP			# Stream Control Transmission Protocol
options 	FFS			# Berkeley Fast Filesystem
options 	SOFTUPDATES		# Enable FFS soft updates support
options 	UFS_ACL			# Support for access control lists
options 	UFS_DIRHASH		# Improve performance on big directories
options 	UFS_GJOURNAL		# Enable gjournal-based UFS journaling
options 	MSDOSFS			# MSDOS Filesystem
options 	CD9660			# ISO 9660 Filesystem
options 	PROCFS			# Process filesystem (requires PSEUDOFS)
options 	PSEUDOFS		# Pseudo-filesystem framework
options 	COMPAT_43TTY		# BSD 4.3 TTY compat [KEEP THIS!]
options 	COMPAT_FREEBSD4		# Compatible with FreeBSD4
options 	COMPAT_FREEBSD5		# Compatible with FreeBSD5
options 	COMPAT_FREEBSD6		# Compatible with FreeBSD6
options 	SCSI_DELAY=5000		# Delay (in ms) before probing SCSI
options 	SYSVSHM			# SYSV-style shared memory
options 	SYSVMSG			# SYSV-style message queues
options 	SYSVSEM			# SYSV-style semaphores
options 	_KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions
options 	KBD_INSTALL_CDEV	# install a CDEV entry in /dev
options 	ADAPTIVE_GIANT		# Giant mutex is adaptive.
options 	STOP_NMI		# Stop CPUS using NMI instead of IPI
options 	AUDIT			# Security event auditing
device		cpufreq
device		pci
device		ata
device		atadisk		# ATA disk drives
device		atapicd		# ATAPI CDROM drives
options 	ATA_STATIC_ID	# Static device numbering
					# output.  Adds ~128k to driver.
					# output.  Adds ~215k to driver.
device		scbus		# SCSI bus (required for SCSI)
device		da		# Direct Access (disks)
device		pass		# Passthrough device (direct SCSI access)
device		atkbdc		# AT keyboard controller
device		atkbd		# AT keyboard
device		vga		# VGA video card driver
device		sc
device		agp		# support several AGP chipsets
device		pmtimer
device		miibus		# MII bus support
device		nfe		# nVidia nForce MCP on-board Ethernet
device		loop		# Network loopback
device		random		# Entropy device
device		ether		# Ethernet support
device		pty		# Pseudo-ttys (telnet etc)
device		md		# Memory "disks"
device		gif		# IPv6 and IPv4 tunneling
device		faith		# IPv6-to-IPv4 relaying (translation)
device		firmware	# firmware assist module
device		bpf		# Berkeley packet filter
device		ohci		# OHCI PCI->USB interface
device		ehci		# EHCI PCI->USB interface (USB 2.0)
device		usb		# USB Bus (required)
device		umass		# Disks/Mass storage - Requires scbus and da
device		ums		# Mouse
device		sound
device		snd_ich
device		pf
device		pflog
device		pfsync
options		LIBICONV
options		NTFS
options		NTFS_ICONV
options		MSDOSFS_ICONV
options		CD9660_ICONV
options 	ALTQ
options 	ALTQ_CBQ	# Class Bases Queueing
options 	ALTQ_RED	# Random Early Detection
options 	ALTQ_RIO	# RED In/Out
options 	ALTQ_HFSC	# Hierarchical Packet Scheduler
options 	ALTQ_CDNR	# Traffic conditioner
options 	ALTQ_PRIQ	# Priority Queueing
options 	ALTQ_NOPCC	# Required if the TSC is unusable
options		COMPAT_LINUX
device		smbus		# Bus support, required for smb below.
device		nfpm
device		nfsmb
options 	DEVICE_POLLING
options 	HZ=1000


On 11/26/07, Yi Wang <wangyi6854@gmail.com> wrote:
> Any idea?
>
> This is the latest uname:
>
> uname -a
> FreeBSD wangyi.com 7.0-BETA3 FreeBSD 7.0-BETA3 #0: Fri Nov 23 12:18:30 CST 2007
> root@wangyi.com:/usr/obj/usr/src/sys/MYKERNEL  i386
>
> And I've already delete make.conf in /etc.
>
> Thanks!
>
> On 10/20/07, FreeBSD-gnats-submit@freebsd.org
> <FreeBSD-gnats-submit@freebsd.org> wrote:
> > Thank you very much for your problem report.
> > It has the internal identification `ports/117350'.
> > The individual assigned to look at your
> > report is: freebsd-ports-bugs.
> >
> > You can access the state of your problem report at any time
> > via this link:
> >
> > http://www.freebsd.org/cgi/query-pr.cgi?pr=117350
> >
> > >Category:       ports
> > >Responsible:    freebsd-ports-bugs
> > >Synopsis:       compile error in vmware3
> > >Arrival-Date:   Sat Oct 20 04:00:05 UTC 2007
> >
>
>
> --
> Regards,
> Wang Yi
>


-- 
Regards,
Wang Yi
Comment 4 fchang 2008-03-04 03:26:40 UTC
Please test this patch.  I tested it on FreeBSD RELEASE-7.0
i386 uniprocessor, and I could boot Windows XP from it.

--- 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 */
Comment 5 Boris B.Samorodov 2008-03-04 07:18:56 UTC
Here is a relevant diff for the port to test:
-----
Index: Makefile
===================================================================
RCS file: /home/pcvs/ports/emulators/vmware3/Makefile,v
retrieving revision 1.96
diff -u -r1.96 Makefile
--- Makefile	25 Oct 2007 00:13:00 -0000	1.96
+++ Makefile	4 Mar 2008 07:15:18 -0000
@@ -105,6 +105,10 @@
 	cd ${WRKSRC} && ${PATCH} < ${FILESDIR}/fbsd6-1.patch
 	cd ${WRKSRC} && ${PATCH} < ${FILESDIR}/fbsd6-2.patch
 .endif
+.if ${OSVERSION} > 700000
+	cd ${WRKSRC} && ${PATCH} < ${FILESDIR}/fbsd7-1.patch
+	cd ${WRKSRC} && ${PATCH} < ${FILESDIR}/fbsd7-2.patch
+.endif
 
 pre-install:
 	${INSTALL_MAN} ${WRKSRC}/man/man1/vmware.1 ${MANPREFIX}/man/man1
Index: files/fbsd7-1.patch
===================================================================
RCS file: files/fbsd7-1.patch
diff -N files/fbsd7-1.patch
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/fbsd7-1.patch	4 Mar 2008 07:15:18 -0000
@@ -0,0 +1,45 @@
+--- vmmon-only/freebsd/driver.c.orig	2008-03-04 10:05:14.000000000 +0300
++++ vmmon-only/freebsd/driver.c	2008-03-04 10:09:23.000000000 +0300
+@@ -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
Index: files/fbsd7-2.patch
===================================================================
RCS file: files/fbsd7-2.patch
diff -N files/fbsd7-2.patch
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/fbsd7-2.patch	4 Mar 2008 07:15:18 -0000
@@ -0,0 +1,18 @@
+--- vmmon-only/include/vm_asm.h.orig	2003-07-24 01:43:38.000000000 +0400
++++ vmmon-only/include/vm_asm.h	2008-03-04 09:29:45.000000000 +0300
+@@ -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 */

-----

WBR
-- 
bsam
Comment 6 agh 2008-03-04 11:02:55 UTC
I get the following in /var/log/messages 
when /usr/local/etc/rc.d/001.vmware.sh is executed:
vmmon: SMP support for this release is BROKEN.
module_register_init: MOD_LOAD (vmmon, 0xc4e89cc0, 0) error 22

sysctl -a | grep ncpu:
hw.ncpu: 2

uname -a:
FreeBSD madcat 7.0-STABLE FreeBSD 7.0-STABLE #1: Tue Mar  4 21:01:57 EST 2008     
agh@madcat:/usr/obj/usr/src/sys/MADCAT  i386

-Al
Comment 7 fchang 2008-03-04 12:52:47 UTC
Indeed I think currently it only works with a UP kernel.
(I had to comment out "SMP" and "apic" in my kernel config)
Sorry I don't know how to fix it for SMP kernel,
but hopefully the patch might at least allow UP users use vmware3.
Comment 8 Yi Wang 2008-04-01 09:23:12 UTC
On 3/4/08, Boris Samorodov <bsam@ipt.ru> wrote:
> Here is a relevant diff for the port to test:
>  -----
>  Index: Makefile
>  ===================================================================
>  RCS file: /home/pcvs/ports/emulators/vmware3/Makefile,v
>  retrieving revision 1.96
>  diff -u -r1.96 Makefile
>  --- Makefile    25 Oct 2007 00:13:00 -0000      1.96
>  +++ Makefile    4 Mar 2008 07:15:18 -0000
>  @@ -105,6 +105,10 @@
>         cd ${WRKSRC} && ${PATCH} < ${FILESDIR}/fbsd6-1.patch
>         cd ${WRKSRC} && ${PATCH} < ${FILESDIR}/fbsd6-2.patch
>   .endif
>  +.if ${OSVERSION} > 700000
>  +       cd ${WRKSRC} && ${PATCH} < ${FILESDIR}/fbsd7-1.patch
>  +       cd ${WRKSRC} && ${PATCH} < ${FILESDIR}/fbsd7-2.patch
>  +.endif
>
>   pre-install:
>         ${INSTALL_MAN} ${WRKSRC}/man/man1/vmware.1 ${MANPREFIX}/man/man1
>  Index: files/fbsd7-1.patch
>  ===================================================================
>  RCS file: files/fbsd7-1.patch
>  diff -N files/fbsd7-1.patch
>  --- /dev/null   1 Jan 1970 00:00:00 -0000
>  +++ files/fbsd7-1.patch 4 Mar 2008 07:15:18 -0000
>  @@ -0,0 +1,45 @@
>  +--- vmmon-only/freebsd/driver.c.orig   2008-03-04 10:05:14.000000000 +0300
>  ++++ vmmon-only/freebsd/driver.c        2008-03-04 10:09:23.000000000 +0300
>  +@@ -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
>
> Index: files/fbsd7-2.patch
>  ===================================================================
>  RCS file: files/fbsd7-2.patch
>  diff -N files/fbsd7-2.patch
>  --- /dev/null   1 Jan 1970 00:00:00 -0000
>  +++ files/fbsd7-2.patch 4 Mar 2008 07:15:18 -0000
>  @@ -0,0 +1,18 @@
>  +--- vmmon-only/include/vm_asm.h.orig   2003-07-24 01:43:38.000000000 +0400
>  ++++ vmmon-only/include/vm_asm.h        2008-03-04 09:29:45.000000000 +0300
>  +@@ -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 */
>
>
> -----
>
>  WBR
>
> --
>  bsam
>


The patch works fine. Thanks a lot!

BTW, when will this patch be commited to the ports tree?

-- 
Regards,
Wang Yi
Comment 9 dfilter service freebsd_committer freebsd_triage 2008-04-01 15:04:05 UTC
bsam        2008-04-01 14:04:00 UTC

  FreeBSD ports repository

  Modified files:
    emulators/vmware3    Makefile 
  Added files:
    emulators/vmware3/files fbsd7-1.patch fbsd7-2.patch 
  Log:
  Unbreak compiling at FreeBSD-7.x. The port seems to work only with
  an UP kernel.
  
  PR:             117350
  Submitted by:   Yi Wang <wangyi6854 at gmail.com>
  Patch by:       fchang at cs.ubc.ca
  Tested by:      Yi Wang <wangyi6854 at gmail.com>
  
  Revision  Changes    Path
  1.97      +4 -0      ports/emulators/vmware3/Makefile
  1.1       +45 -0     ports/emulators/vmware3/files/fbsd7-1.patch (new)
  1.1       +18 -0     ports/emulators/vmware3/files/fbsd7-2.patch (new)
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 10 Boris Samorodov freebsd_committer freebsd_triage 2008-04-01 15:04:42 UTC
State Changed
From-To: open->closed

Committed, thanks!