[gem5-users] Re: IGbE / Intel 8254x - NIC support on Gem5 (with #COSSIM changes)

2022-06-22 Thread rshankar2
Nikos,
Thanks again for the instructions below & your time. We'll try again and circle 
back. 

Regards,
Raghu

-Original Message-
From: Νικόλαος Ταμπουρατζής  
Sent: Wednesday, June 22, 2022 4:58 AM
To: The gem5 Users mailing list 
Cc: 'c ning' 
Subject: [gem5-users] Re: IGbE / Intel 8254x - NIC support on Gem5 (with 
#COSSIM changes)

Dear rshankar,

First of all, you need to download the COSSIM gem5 
(https://github.com/H2020-COSSIM/cgem5.git). After that, you need to build the 
gem5 (scons build/X86/gem5.fast -j4).

In addition, you need to mount the x86-ubuntu.img and add the gem5_init.sh in 
/root using qemu (no m5 commands).

After that, in order to simulate the gem5 in dual mode with NIC you need to run

./build/X86/gem5.fast --listener-mode=on ./configs/example/fs.py
--kernel=vmlinux-5.4.49 --disk-image=x86-ubuntu.img --dual

(place the full path of kernel and disk image)

The 1st terminal is in 3456 port (telnet 127.0.0.1 3456).
The 2nd terminal is in 3457 port (telnet 127.0.0.1 3457).

After boot, you need add the localhost and IP in both terminals (eg.  
ifconfig lo 127.0.0.1 & ifconfig eth0 10.0.1.x), where x 2 and 3). You can use 
"ping -c 1 10.0.1.x" to check the functionality.

If you are not familiar with gem5, we suggest you simulate a simple
X86 ubuntu FS node (without NIC) before the above steps.

Best regards,
Nikolaos Tampouratzis

Quoting rshank...@austin.rr.com:

> Nikos, thanks again for your help.
>
> We each tried to chroot from Ubuntu prompt right after the mount 
> commands below (we did not realize of Qemu emulation first or gem5
> contexts)
>
> We'd like to simulate x86 cores with NIC & COSSIM changes in gem5 
> simulation
>
> Any specific instructions we need to add to simulate in the gem5?
>
> Raghu & Ning (cc'd)
>
>
> We followed these steps from prior email:
>
> https://github.com/H2020-COSSIM/cgem5/blob/main/src/dev/x86/SouthBridge.py   
> (see the lines with #COSSIM)
> https://github.com/H2020-COSSIM/cgem5/blob/main/configs/common/FSConfi
> g.py
> (lines 636, 674-676)
> Build the gem5
> You need download the vmlinux-5.4.49 kernel from here:   
> https://github.com/gem5/gem5-resources/tree/stable/src/linux-kernel
> You need download the x86-ubuntu.img image from here:
> http://dist.gem5.org/dist/v21-2/images/x86/ubuntu-18-04/x86-ubuntu.img
> .gz Mount the x86-ubuntu.img and add the gem5_init.sh in /root using:
>
> $ sudo mount -o loop,offset=1048576 x86-ubuntu.img /mnt $ cd /mnt $ 
> sudo mount --bind /proc /mnt/proc $ sudo mount --bind /dev /mnt/dev $ 
> sudo chroot .
> $ cd root
>
>
>
> -Original Message-
> From: Νικόλαος Ταμπουρατζής 
> Sent: Monday, June 20, 2022 10:55 AM
> To: The gem5 Users mailing list 
> Subject: [gem5-users] Re: IGbE / Intel 8254x - NIC support on Gem5?
>
> Dear rshankar,
>
> Do you try to chroot using qemu or gem5? In addition, the m5  
> pseudo-instructions (e.g. m5 readfile) work only inside the gem5  
> simulation.
>
> I write you how to mount the x86 image through qemu in order to  
> emulate it first, make any changes (using chroot .), and then  
> simulate it through gem5 (using m5 pseudo-instructions).
>
> Best regards,
> Nikos
>
>
>
> Quoting rshank...@austin.rr.com:
>
>> Nikolaos & Gem5 community,
>>
>> Thanks for the detailed instructions to run Full system with NICs with
>> #COSSIM edits. My project partner and I tried all the way to the end.
>> Both are experiencing /dev/mem problem as below. We've tried different
>> ways to change to root owner and chmod, but with no luck
>>
>> Any help on how to proceed?
>>
>> Thanks in advance
>>
>>
>> $ sudo chroot .
>> Starting gem5 init... reading run script file.
>> Can't open /dev/mem: Operation not permitted Failed to run m5
>> readfile, exiting!
>> Can't open /dev/mem: Operation not permitted
>> m5 exit failed, dropping to shell.
>>
>> # m5 readfile
>> Can't open /dev/mem: Operation not permitted # whoami root # ls -l
>> /dev/mem
>> crw-r- 1 root kmem 1, 1 Jun  8 10:38 /dev/mem
>>
>> # chown root:kmem /dev/mem
>> # m5 readfile
>> Can't open /dev/mem: Operation not permitted
>>
>> # chmod 660 /dev/mem
>> # m5 readfile
>> Can't open /dev/mem: Operation not permitted
>>
>> # chown root:kmem /dev/mem
>> #
>> # m5 readfile
>> Can't open /dev/mem: Operation not permitted
>>
>> # chmod 666 /dev/mem
>> # ls -l /dev/mem
>> crw-rw-rw- 1 root kmem 1, 1 Jun  8 10:38 /dev/mem # # m5 readfile
>> Can't open /dev/mem: Operation not permitted
>>
>>
>>
>> -Original Message-
>> From: Νικόλαος Ταμπ

[gem5-users] Re: IGbE / Intel 8254x - NIC support on Gem5 (with #COSSIM changes)

2022-06-22 Thread Νικόλαος Ταμπουρατζής

Dear rshankar,

First of all, you need to download the COSSIM gem5  
(https://github.com/H2020-COSSIM/cgem5.git). After that, you need to

build the gem5 (scons build/X86/gem5.fast -j4).

In addition, you need to mount the x86-ubuntu.img and add the  
gem5_init.sh in /root using qemu (no m5 commands).


After that, in order to simulate the gem5 in dual mode with NIC you  
need to run


./build/X86/gem5.fast --listener-mode=on ./configs/example/fs.py  
--kernel=vmlinux-5.4.49 --disk-image=x86-ubuntu.img --dual


(place the full path of kernel and disk image)

The 1st terminal is in 3456 port (telnet 127.0.0.1 3456).
The 2nd terminal is in 3457 port (telnet 127.0.0.1 3457).

After boot, you need add the localhost and IP in both terminals (eg.  
ifconfig lo 127.0.0.1 & ifconfig eth0 10.0.1.x), where x 2 and 3). You  
can use "ping -c 1 10.0.1.x" to check the functionality.


If you are not familiar with gem5, we suggest you simulate a simple  
X86 ubuntu FS node (without NIC) before the above steps.


Best regards,
Nikolaos Tampouratzis

Quoting rshank...@austin.rr.com:


Nikos, thanks again for your help.

We each tried to chroot from Ubuntu prompt right after the mount  
commands below (we did not realize of Qemu emulation first or gem5  
contexts)


We'd like to simulate x86 cores with NIC & COSSIM changes in gem5 simulation

Any specific instructions we need to add to simulate in the gem5?

Raghu & Ning (cc'd)


We followed these steps from prior email:

https://github.com/H2020-COSSIM/cgem5/blob/main/src/dev/x86/SouthBridge.py   
(see the lines with #COSSIM)
https://github.com/H2020-COSSIM/cgem5/blob/main/configs/common/FSConfig.py  
(lines 636, 674-676)

Build the gem5
You need download the vmlinux-5.4.49 kernel from here:   
https://github.com/gem5/gem5-resources/tree/stable/src/linux-kernel
You need download the x86-ubuntu.img image from here:
http://dist.gem5.org/dist/v21-2/images/x86/ubuntu-18-04/x86-ubuntu.img.gz

Mount the x86-ubuntu.img and add the gem5_init.sh in /root using:

$ sudo mount -o loop,offset=1048576 x86-ubuntu.img /mnt
$ cd /mnt
$ sudo mount --bind /proc /mnt/proc
$ sudo mount --bind /dev /mnt/dev
$ sudo chroot .
$ cd root



-Original Message-
From: Νικόλαος Ταμπουρατζής 
Sent: Monday, June 20, 2022 10:55 AM
To: The gem5 Users mailing list 
Subject: [gem5-users] Re: IGbE / Intel 8254x - NIC support on Gem5?

Dear rshankar,

Do you try to chroot using qemu or gem5? In addition, the m5  
pseudo-instructions (e.g. m5 readfile) work only inside the gem5  
simulation.


I write you how to mount the x86 image through qemu in order to  
emulate it first, make any changes (using chroot .), and then  
simulate it through gem5 (using m5 pseudo-instructions).


Best regards,
Nikos



Quoting rshank...@austin.rr.com:


Nikolaos & Gem5 community,

Thanks for the detailed instructions to run Full system with NICs with
#COSSIM edits. My project partner and I tried all the way to the end.
Both are experiencing /dev/mem problem as below. We've tried different
ways to change to root owner and chmod, but with no luck

Any help on how to proceed?

Thanks in advance


$ sudo chroot .
Starting gem5 init... reading run script file.
Can't open /dev/mem: Operation not permitted Failed to run m5
readfile, exiting!
Can't open /dev/mem: Operation not permitted
m5 exit failed, dropping to shell.

# m5 readfile
Can't open /dev/mem: Operation not permitted # whoami root # ls -l
/dev/mem
crw-r- 1 root kmem 1, 1 Jun  8 10:38 /dev/mem

# chown root:kmem /dev/mem
# m5 readfile
Can't open /dev/mem: Operation not permitted

# chmod 660 /dev/mem
# m5 readfile
Can't open /dev/mem: Operation not permitted

# chown root:kmem /dev/mem
#
# m5 readfile
Can't open /dev/mem: Operation not permitted

# chmod 666 /dev/mem
# ls -l /dev/mem
crw-rw-rw- 1 root kmem 1, 1 Jun  8 10:38 /dev/mem # # m5 readfile
Can't open /dev/mem: Operation not permitted



-Original Message-
From: Νικόλαος Ταμπουρατζής 
Sent: Wednesday, May 11, 2022 12:10 PM
To: The gem5 Users mailing list 
Subject: [gem5-users] Re: IGbE / Intel 8254x - NIC support on Gem5?

Dear rshankar,

As I know, the NIC in gem5 is worked only with Full System (FS) mode
in order to load the correct drivers etc. You can add the following in
order to add the NIC in FS mode:

https://github.com/H2020-COSSIM/cgem5/blob/main/src/dev/x86/SouthBridg
e.py
(see the lines with #COSSIM)
https://github.com/H2020-COSSIM/cgem5/blob/main/configs/common/FSConfi
g.py
(lines 636, 674-676)

Build the gem5.

You need download the vmlinux-5.4.49 kernel from here:
https://github.com/gem5/gem5-resources/tree/stable/src/linux-kernel

You need download the x86-ubuntu.img image from here:
http://dist.gem5.org/dist/v21-2/images/x86/ubuntu-18-04/x86-ubuntu.img
.gz

Mount the x86-ubuntu.img and add the gem5_init.sh in /root using:

sudo mount -o loop,offset=1048576 x86-ubuntu.img /mnt cd /mnt sudo
mount --bind /proc /mnt/proc sudo mount --bind /dev /mnt/dev sudo chroot .
cd root

[gem5-users] Re: IGbE / Intel 8254x - NIC support on Gem5 (with #COSSIM changes)

2022-06-20 Thread rshankar2
Nikos, thanks again for your help. 

We each tried to chroot from Ubuntu prompt right after the mount commands below 
(we did not realize of Qemu emulation first or gem5 contexts)

We'd like to simulate x86 cores with NIC & COSSIM changes in gem5 simulation 

Any specific instructions we need to add to simulate in the gem5?

Raghu & Ning (cc'd) 


We followed these steps from prior email:

https://github.com/H2020-COSSIM/cgem5/blob/main/src/dev/x86/SouthBridge.py  
(see the lines with #COSSIM)
https://github.com/H2020-COSSIM/cgem5/blob/main/configs/common/FSConfig.py 
(lines 636, 674-676)
Build the gem5
You need download the vmlinux-5.4.49 kernel from here:  
https://github.com/gem5/gem5-resources/tree/stable/src/linux-kernel
You need download the x86-ubuntu.img image from here:   
http://dist.gem5.org/dist/v21-2/images/x86/ubuntu-18-04/x86-ubuntu.img.gz
Mount the x86-ubuntu.img and add the gem5_init.sh in /root using:

$ sudo mount -o loop,offset=1048576 x86-ubuntu.img /mnt 
$ cd /mnt 
$ sudo mount --bind /proc /mnt/proc 
$ sudo mount --bind /dev /mnt/dev 
$ sudo chroot .
$ cd root



-Original Message-
From: Νικόλαος Ταμπουρατζής  
Sent: Monday, June 20, 2022 10:55 AM
To: The gem5 Users mailing list 
Subject: [gem5-users] Re: IGbE / Intel 8254x - NIC support on Gem5?

Dear rshankar,

Do you try to chroot using qemu or gem5? In addition, the m5 
pseudo-instructions (e.g. m5 readfile) work only inside the gem5 simulation.

I write you how to mount the x86 image through qemu in order to emulate it 
first, make any changes (using chroot .), and then simulate it through gem5 
(using m5 pseudo-instructions).

Best regards,
Nikos



Quoting rshank...@austin.rr.com:

> Nikolaos & Gem5 community,
>
> Thanks for the detailed instructions to run Full system with NICs with 
> #COSSIM edits. My project partner and I tried all the way to the end.
> Both are experiencing /dev/mem problem as below. We've tried different 
> ways to change to root owner and chmod, but with no luck
>
> Any help on how to proceed?
>
> Thanks in advance
>
>
> $ sudo chroot .
> Starting gem5 init... reading run script file.
> Can't open /dev/mem: Operation not permitted Failed to run m5 
> readfile, exiting!
> Can't open /dev/mem: Operation not permitted
> m5 exit failed, dropping to shell.
>
> # m5 readfile
> Can't open /dev/mem: Operation not permitted # whoami root # ls -l 
> /dev/mem
> crw-r- 1 root kmem 1, 1 Jun  8 10:38 /dev/mem
>
> # chown root:kmem /dev/mem
> # m5 readfile
> Can't open /dev/mem: Operation not permitted
>
> # chmod 660 /dev/mem
> # m5 readfile
> Can't open /dev/mem: Operation not permitted
>
> # chown root:kmem /dev/mem
> #
> # m5 readfile
> Can't open /dev/mem: Operation not permitted
>
> # chmod 666 /dev/mem
> # ls -l /dev/mem
> crw-rw-rw- 1 root kmem 1, 1 Jun  8 10:38 /dev/mem # # m5 readfile 
> Can't open /dev/mem: Operation not permitted
>
>
>
> -Original Message-
> From: Νικόλαος Ταμπουρατζής 
> Sent: Wednesday, May 11, 2022 12:10 PM
> To: The gem5 Users mailing list 
> Subject: [gem5-users] Re: IGbE / Intel 8254x - NIC support on Gem5?
>
> Dear rshankar,
>
> As I know, the NIC in gem5 is worked only with Full System (FS) mode 
> in order to load the correct drivers etc. You can add the following in 
> order to add the NIC in FS mode:
>
> https://github.com/H2020-COSSIM/cgem5/blob/main/src/dev/x86/SouthBridg
> e.py
> (see the lines with #COSSIM)
> https://github.com/H2020-COSSIM/cgem5/blob/main/configs/common/FSConfi
> g.py
> (lines 636, 674-676)
>
> Build the gem5.
>
> You need download the vmlinux-5.4.49 kernel from here:
> https://github.com/gem5/gem5-resources/tree/stable/src/linux-kernel
>
> You need download the x86-ubuntu.img image from here:
> http://dist.gem5.org/dist/v21-2/images/x86/ubuntu-18-04/x86-ubuntu.img
> .gz
>
> Mount the x86-ubuntu.img and add the gem5_init.sh in /root using:
>
> sudo mount -o loop,offset=1048576 x86-ubuntu.img /mnt cd /mnt sudo 
> mount --bind /proc /mnt/proc sudo mount --bind /dev /mnt/dev sudo chroot .
> cd root
> nano gem5_init.sh #Add the following script:
>
> #!/bin/bash
>
> # Copyright (c) 2021 The University of Texas at Austin.
> # SPDX-License-Identifier: BSD 3-Clause
>
> echo "Starting gem5 init... reading run script file."
> if ! m5 readfile > /tmp/script; then
>  echo "Failed to run m5 readfile, exiting!!"
>  rm -f /tmp/script
>  if ! m5 exit; then
>  # Useful for booting the disk image in (e.g.,) qemu for debugging
>  echo "m5 exit failed, dropping to shell."
>  /bin/sh
>  fi
> else
>  echo "Running m5 script from /tmp/script !!"
>  chmod 755 /tmp/script
>  /tmp/script
>  echo "Done running script, exiting."
>  rm -f /tmp/script
>  /bin/sh
>  #m5 exit
> fi
>
>
>
> exit
> # now we are back to the host system
> cd
> sudo umount /mnt/proc
> sudo umount /mnt/dev
> sudo umount /mnt
>
>
> Now, you may use this cmd to start the FS execution:
>
>