Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Mar 2009 14:29:42 -0700 (PDT)
From:      Doug Ambrisko <ambrisko@ambrisko.com>
To:        Roman Divacky <rdivacky@freebsd.org>
Cc:        svn-src-head@freebsd.org, Doug Ambrisko <ambrisko@freebsd.org>, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r190445 - in head/sys: amd64/linux32 compat/linprocfs compat/linux conf dev/ipmi modules/ipmi modules/linprocfs
Message-ID:  <200903262129.n2QLTgV9076134@ambrisko.com>
In-Reply-To: <20090326205356.GA17416@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Roman Divacky writes:
| On Thu, Mar 26, 2009 at 05:14:23PM +0000, Doug Ambrisko wrote:
| > Author: ambrisko
| > Date: Thu Mar 26 17:14:22 2009
| > New Revision: 190445
| > URL: http://svn.freebsd.org/changeset/base/190445
| > 
| > Log:
| >   Add stuff to support upcoming BMC/IPMI flashing of newer Dell machine
| >   via the Linux tool.
| >        -  Add Linux shim to ipmi(4)
| >        -  Create a partitions file to linprocfs to make Linux fdisk see
| >           disks.  This file is dynamic so we can see disks come and go.
| >        -  Convert msdosfs to vfat in mtab since Linux uses that for
| >           msdosfs.
| >        -  In the Linux mount path convert vfat passed in to msdosfs
| >           so Linux mount works on FreeBSD.  Note that tasting works
| >           so that if da0 is a msdos file system
| >                   /compat/linux/bin/mount /dev/da0 /mnt
| >           works.
| >        -  fix a 64it bug for l_off_t.
| >   Grabing sh, mount, fdisk, df from Linux, creating a symlink of mtab to
| >   /compat/linux/etc/mtab and then some careful unpacking of the Linux bmc
| >   update tool and hacking makes it work on newer Dell boxes.  Note, probably
| >   if you can't figure out how to do this, then you probably shouldn't be
| >   doing it :-)
| > 
| > Added:
| >   head/sys/dev/ipmi/ipmi_linux.c   (contents, props changed)
| > Modified:
| >   head/sys/amd64/linux32/linux.h
| >   head/sys/compat/linprocfs/linprocfs.c
| >   head/sys/compat/linux/linux_file.c
| >   head/sys/conf/files.amd64
| >   head/sys/conf/files.i386
| >   head/sys/modules/ipmi/Makefile
| >   head/sys/modules/linprocfs/Makefile
| > 
| > Modified: head/sys/amd64/linux32/linux.h
| > ==============================================================================
| > --- head/sys/amd64/linux32/linux.h	Thu Mar 26 17:04:08 2009	(r190444)
| > +++ head/sys/amd64/linux32/linux.h	Thu Mar 26 17:14:22 2009	(r190445)
| > @@ -79,7 +79,7 @@ typedef l_ulong		l_ino_t;
| >  typedef l_int		l_key_t;
| >  typedef l_longlong	l_loff_t;
| >  typedef l_ushort	l_mode_t;
| > -typedef l_long		l_off_t;
| > +typedef l_ulong		l_off_t;
| 
| where did you get this idea? my copy of linux 2.6.16 shows that off_t
| is being declared as long. can you be more specific about the background
| of this change? what does it fix?

Maybe you have another suggestion to fix this.  The problem showed up
when doing a mmap of 0xcf79c000 into 0xffffffffcf79c000 also a mmap
of 0xf0000 ended up the same way.  This caused it to fail.  Note this
is only on amd64 with a Linux.  It didn't happen with a FreeBSD i386
version on amd64.  Here is a sample test program:
--------------------------------------------------------------------
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>

test(int fd, off_t off, size_t len){
        char *temp;
        int i;
        unsigned int sum;
        int fdout;
        char str[100];
        int out;

        printf("checking %u/%u %x/%x\n",off,len,off,len);
        temp=mmap(NULL, len, PROT_READ, MAP_SHARED, fd, off);
        printf("Returned %x\n",temp);
        if (temp == MAP_FAILED) {
                perror("Couldn't map");
        } else
                for(i=0;i<len;i++) {
                        sum+=(unsigned int)temp[i];
                }
        printf("   sum ->%x\n",sum);
        sprintf(str, "dump.%x",off);
        fdout=open(str,O_WRONLY|O_CREAT|O_TRUNC,0666);
        if (fdout==-1) {
                printf("failed to create %s\n",str);
        } else {
                out=write(fdout,temp,len);
                printf("What %d %d, %x\n",out,len,temp);
                close(fdout);
        }
/*
        printf("press enter to continue\n");
        scanf("%d",&fdout);
*/
        munmap(temp, len);
}

main(){
        int fd, i;

        fd=open("/dev/mem",O_RDONLY);
        if (fd==-1) {
                printf("Can't open /dev/mem\n");
                exit(1);
        }
        test(fd,0xf0000,4096);
        test(fd,0xfe000,4096);
        test(fd,0xcf7f0000,4096);
        test(fd,0xcf79c000,4096);
}
--------------------------------------------------------------------
I can toss a compiled Linux/i386, FreeBSD/i386 and FreeBSD/amd64 versions
up on my web server.  I added a printf to the native mmap kernel function
to print out the address being passed to it.

Thanks,

Doug A.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200903262129.n2QLTgV9076134>