[gem5-users] Re: Spec2017 GCC benchmark crashes in SE mode

2024-01-16 Thread sun2k23 via gem5-users
you may have below python coding in your *.py configuration file:
process = Process(...)
process.executable = ...


If you want to update the stack base, just add configuration like below: 
process.stackBase = 0x // new stack base value
process.maxStackSize = 0x // stack size


You can have a try, hope it helps.



S2K




At 2024-01-17 01:22:30, "muke101 via gem5-users"  wrote:

I see, thanks for the explanation.

Could you elaborate for me how I should change the stack base address to 
increase available size? I had thought setting a higher address would but GCC 
immediately crashes if I do this. If I set a lower address it works but does 
this provide more space?

Also, is the mmap_end variable relevant at all?


Sent from Proton Mail mobile



 Original Message 
On 16 Jan 2024, 06:07, sun2k23 wrote:

Hi, 


Usually in SE mode, the page would be pre-allocated when the ELF file(what's 
also called image download by me previously) is initiated/downloaded to the 
memory.  The allocated page can be checked when enabling MMU debug-flag. 


I would suggest you to check the error address to confirm whether the related 
page is allocated, and probably not, then you would check whether the error 
address is located inside stack location or somewhere else.  if it's outside 
stack and is an invalid location, maybe you should further enlarge the stack 
space.  except for the process.StackSize, i think maybe you should also modify 
the process.stackBase. 


Please let me know if you fix this issue. 


Regards,
S2K.




At 2024-01-15 09:25:02, "muke101 via gem5-users"  wrote:

Hi, thanks for the reply.

Assuming that the page isn't being allocated when it should be, what could I do 
with this information? I'm not familiar with this part of the Gem5 codebase.

Also, just to be clear, what do you mean by 'when the image download is done'?

Thanks.


Sent from Proton Mail mobile



 Original Message 
On 15 Jan 2024, 01:18, sun2k23 via gem5-users wrote:





Hi,


I have ever met several similar issues but i'm not running Spec2017. I think 
that's because you use this address 0x66195c before allocating page 
firstly. You can enable the debug-flag of MMU to check whether the page related 
to this address is allocated when the image download is done.  


S2k 

At 2024-01-14 04:40:13, "muke101 via gem5-users"  wrote:

Hi, I'm trying to checkpoint spec2017 with NonCachingSimpleCPU according to 
simpoints I generated from native AArch64 binaries. On an unmodified Gem5, a 
page fault occurs in the simulation (pasted the error message at the bottom).


I've read that GCC can run out of stack space when simulated, so I edited 
arch/arm/process.cc to have a max stack size of 16MB instead of the default 
8MB, but this hasn't helped. Can someone confirm this is the right way to 
increase the max stack size? The total memory allowed to the simulation if 50GB 
(set if --mem-size on the command line).



Another possibility is that it's due to me compiling the benchmark without 
'--no-strict-aliasing', which the spec documentation suggests to, but I imagine 
if this were the problem then the program wouldn't had been able to run 
natively, which it does.



Has anyone run into this problem before and been able to solve it?


Thanks.


build/ARM/sim/simulate.cc:194: info: Entering event queue @ 188431954680500.  
Starting simulation...
build/ARM/sim/faults.cc:104: panic: panic condition !handled && 
!tc->getSystemPtr()->trapToGdb(SIGSEGV, tc->contextId()) occurred: Page table 
fault when accessing virtual address 0x66195c
Memory Usage: 52735052 KBytes
Program aborted at tick 191641021589000
--- BEGIN LIBC BACKTRACE ---
/sim_home/luke/PND-Loads/gem5/build/ARM/gem5.fast(+0x97d088)[0xca97c088]
/sim_home/luke/PND-Loads/gem5/build/ARM/gem5.fast(+0x9ef1bc)[0xca9ee1bc]
linux-vdso.so.1(__kernel_rt_sigreturn+0x0)[0x4000161c2688]
/lib/aarch64-linux-gnu/libc.so.6(raise+0xb0)[0x4000164c2598]
--- END LIBC BACKTRACE ---
Aborted (core dumped)




Sent with Proton Mail secure email.___
gem5-users mailing list -- gem5-users@gem5.org
To unsubscribe send an email to gem5-users-le...@gem5.org


[gem5-users] Re: How Can I Save the output file-Full System Simulation

2024-01-16 Thread hu miao via gem5-users
Thank you very much, as you said, the redirected files appeared in the
output folder that I specified.

On Tue, Jan 16, 2024 at 10:16 PM Eliot Moss via gem5-users <
gem5-users@gem5.org> wrote:

> On 1/16/2024 1:15 AM, sun2k23 via gem5-users wrote:
> >
> > I think maybe you can try /sbin/m5  utility, using the writefile option.
> Then you can redirect the virtual OS
> > environment files to local Hosts.
> > The command format is like below:
> >
> >
> > S2K
> >
> >
> >
> > At 2024-01-16 11:41:57, "hu miao via gem5-users" 
> wrote:
> >
> > Hi:
> >  First of all, I am very, very grateful to Hao Nguyen, who
> answered me another question about full system
> > simulation the other day, because I don't know much about gem5 user
> lists, and clicking on the reply below always
> > shows a connection error, so I haven't been able to reply.
> >  I still want to ask a question today about whole-system
> simulation. I'm using a full system simulation to test
> > the MachSuite benchmark, MachSuite contains a lot of algorithms, and
> I want to know how long each algorithm runs. I
> > let the running time of each algorithm be printed to the output
> .txt, which makes it easier for me to organize the
> > data, but I found that the directory that exists after logging in
> with m5term localhost 3456 is [root@gem5-host],
> > and the file is also under this environment, how can I save the
> output .txt file in my own server directory or how
> > can I retrieve the output.txt file from [root@gem5-host].
> > If someone could answer my question, I would greatly appreciate it.
>
> Actually, you can set the output directory from the command line to gem5.
> I do that so that each run goes into a different directory.  I'm sure that
> people have written all kinds of shell scripts wrappers (as I have) to
> handle this.
>
> Eliot Moss
> ___
> gem5-users mailing list -- gem5-users@gem5.org
> To unsubscribe send an email to gem5-users-le...@gem5.org
>
___
gem5-users mailing list -- gem5-users@gem5.org
To unsubscribe send an email to gem5-users-le...@gem5.org


[gem5-users] Re: How to suspend FS simulation after certain number of ticks

2024-01-16 Thread Jason Lowe-Power via gem5-users
Hello,

Unfortunately, we don't have enough time to answer all questions in depth.
You may be able to find more help on either the gem5 slack
 or the gem5 youtube channel
. If you have access to ChatGPT Plus, you
can also use the gem5 GPT .
In fact, we have found that most of the LLMs do a good job answering
gem5-related questions.

In the meantime, here is the output from the gem5 GPT for your question.
This answer has not been checked for correctness, but our experience is
that the answers from the gem5 GPT at a minimum point in the right
direction.

Suspending and resuming a Full System (FS) simulation in gem5, similar to
what you've described for System-call Emulation (SE) mode, is indeed
possible. In FS mode, you can control the simulation flow using the Python
configuration scripts, just as you do in SE mode. However, there are some
nuances to consider when dealing with FS simulations.

For your specific use case, where you want to suspend the simulation after
a certain number of ticks, retrieve the `stats.txt` file, and then resume,
you can follow these steps:

1. **Modify the Python Script**:
   - Open the `/gem5/configs/example/riscv/fs_linux.py` script.
   - In this script, you can insert a loop that calls `m5.simulate()` for a
specified number of ticks. After each `m5.simulate()` call, the script will
regain control, allowing you to perform operations like dumping statistics.
   - Here's an example of how you might modify the script:

 ```python
 import m5
 from m5.objects import *

 # existing configuration code...

 num_ticks = 1e9  # Example: 1 billion ticks
 while m5.curTick() < num_ticks:
 m5.simulate(100)  # simulate for 1 million ticks at a time
 print("Current tick:", m5.curTick())
 m5.stats.dump()  # dump the stats
 ```

   - This script will now run the simulation in chunks of 1 million ticks,
dumping the statistics after each chunk.

2. **Dumping Statistics**:
   - The `m5.stats.dump()` call will update the `stats.txt` file. Make sure
you have set up your statistics correctly in the simulation configuration
so that they are captured and written to the file.

3. **Resuming the Simulation**:
   - The loop will automatically continue the simulation until it reaches
the specified number of ticks. There's no need for explicit "resume"
commands, as `m5.simulate()` both starts and resumes the simulation.

4. **Periodic Checkpoints (Optional)**:
   - If you want to be able to resume the simulation from a particular
point, not just dump statistics, consider using checkpoints. You can create
a checkpoint at each loop iteration or at

specific intervals. Here's how you can add checkpoint creation:

   ```python
   checkpoint_interval = 1e7  # Example: every 10 million ticks
   next_checkpoint = checkpoint_interval

   while m5.curTick() < num_ticks:
   m5.simulate(min(checkpoint_interval, num_ticks - m5.curTick()))
   print("Current tick:", m5.curTick())
   m5.stats.dump()  # dump the stats

   if m5.curTick() >= next_checkpoint:
   m5.checkpoint('checkpoint%d' % (m5.curTick()))
   next_checkpoint += checkpoint_interval
   ```

   - This will create a checkpoint file every 10 million ticks (or at the
specified interval).

5. **Considerations for FS Mode**:
   - In FS mode, especially with complex simulations, be aware that there
might be additional complications, such as device states and interactions
with the simulated OS. Always test your modified script to ensure that it
behaves as expected.

6. **Running the Modified Script**:
   - Once you've modified your `fs_linux.py` script, run it as you normally
would to start the simulation.

By following these steps, you should be able to achieve your goal of
suspending the FS simulation at specific tick intervals, dumping the stats,
and then resuming the simulation. Remember that gem5 is a complex tool, and
small changes in the simulation script can have significant impacts on the
behavior and performance of your simulation, so careful testing and
validation of your modified script are recommended.

On Tue, Jan 16, 2024 at 1:16 AM elio.vinciguerra--- via gem5-users <
gem5-users@gem5.org> wrote:

> Or, at least, I would need to do it in such a way as to have the
> historical progression of the "stats.txt" file during the simulation. So I
> need to suspend the simulation at a certain tick, get the "stats.txt" file,
> resume the simulation, or I need a solution that allows me to dump at a
> certain tick.
> ___
> gem5-users mailing list -- gem5-users@gem5.org
> To unsubscribe send an email to gem5-users-le...@gem5.org
>
___
gem5-users mailing list -- gem5-users@gem5.org
To unsubscribe send an email to gem5-users-le...@gem5.org


[gem5-users] Re: Spec2017 GCC benchmark crashes in SE mode

2024-01-16 Thread muke101 via gem5-users
I see, thanks for the explanation.

Could you elaborate for me how I should change the stack base address to 
increase available size? I had thought setting a higher address would but GCC 
immediately crashes if I do this. If I set a lower address it works but does 
this provide more space?

Also, is the mmap_end variable relevant at all?

Sent from Proton Mail mobile

 Original Message 
On 16 Jan 2024, 06:07, sun2k23 wrote:

> Hi,
>
> Usually in SE mode, the page would be pre-allocated when the ELF file(what's 
> also called image download by me previously) is initiated/downloaded to the 
> memory. The allocated page can be checked when enabling MMU debug-flag.
>
> I would suggest you to check the error address to confirm whether the related 
> page is allocated, and probably not, then you would check whether the error 
> address is located inside stack location or somewhere else. if it's outside 
> stack and is an invalid location, maybe you should further enlarge the stack 
> space. except for the process.StackSize, i think maybe you should also modify 
> the process.stackBase.
>
> Please let me know if you fix this issue.
>
> Regards,
> S2K.
>
> At 2024-01-15 09:25:02, "muke101 via gem5-users"  wrote:
>
>> Hi, thanks for the reply.
>>
>> Assuming that the page isn't being allocated when it should be, what could I 
>> do with this information? I'm not familiar with this part of the Gem5 
>> codebase.
>>
>> Also, just to be clear, what do you mean by 'when the image download is 
>> done'?
>>
>> Thanks.
>>
>> Sent from Proton Mail mobile
>>
>>  Original Message 
>> On 15 Jan 2024, 01:18, sun2k23 via gem5-users  wrote:
>>
>>> Hi,
>>>
>>> I have ever met several similar issues but i'm not running Spec2017. I 
>>> think that's because you use this address 0x66195c before allocating 
>>> page firstly. You can enable the debug-flag of MMU to check whether the 
>>> page related to this address is allocated when the image download is done.
>>>
>>> S2k
>>>
>>> At 2024-01-14 04:40:13, "muke101 via gem5-users"  
>>> wrote:
>>>
 Hi, I'm trying to checkpoint spec2017 with NonCachingSimpleCPU according 
 to simpoints I generated from native AArch64 binaries. On an unmodified 
 Gem5, a page fault occurs in the simulation (pasted the error message at 
 the bottom).

 I've read that GCC can run out of stack space when simulated, so I edited 
 arch/arm/process.cc to have a max stack size of 16MB instead of the 
 default 8MB, but this hasn't helped. Can someone confirm this is the right 
 way to increase the max stack size? The total memory allowed to the 
 simulation if 50GB (set if --mem-size on the command line).

 Another possibility is that it's due to me compiling the benchmark without 
 '--no-strict-aliasing', which the spec documentation suggests to, but I 
 imagine if this were the problem then the program wouldn't had been able 
 to run natively, which it does.

 Has anyone run into this problem before and been able to solve it?

 Thanks.

 build/ARM/sim/simulate.cc:194: info: Entering event queue @ 
 188431954680500. Starting simulation...
 build/ARM/sim/faults.cc:104: panic: panic condition !handled && 
 !tc->getSystemPtr()->trapToGdb(SIGSEGV, tc->contextId()) occurred: Page 
 table fault when accessing virtual address 0x66195c
 Memory Usage: 52735052 KBytes
 Program aborted at tick 191641021589000
 --- BEGIN LIBC BACKTRACE ---
 /sim_home/luke/PND-Loads/gem5/build/ARM/gem5.fast(+0x97d088)[0xca97c088]
 /sim_home/luke/PND-Loads/gem5/build/ARM/gem5.fast(+0x9ef1bc)[0xca9ee1bc]
 linux-vdso.so.1(__kernel_rt_sigreturn+0x0)[0x4000161c2688]
 /lib/aarch64-linux-gnu/libc.so.6(raise+0xb0)[0x4000164c2598]
 --- END LIBC BACKTRACE ---
 Aborted (core dumped)

 Sent with [Proton Mail](https://proton.me/) secure email.___
gem5-users mailing list -- gem5-users@gem5.org
To unsubscribe send an email to gem5-users-le...@gem5.org


[gem5-users] Re: How Can I Save the output file-Full System Simulation

2024-01-16 Thread Eliot Moss via gem5-users

On 1/16/2024 1:15 AM, sun2k23 via gem5-users wrote:


I think maybe you can try /sbin/m5  utility, using the writefile option. Then you can redirect the virtual OS 
environment files to local Hosts.

The command format is like below:


S2K



At 2024-01-16 11:41:57, "hu miao via gem5-users"  wrote:

Hi:
     First of all, I am very, very grateful to Hao Nguyen, who answered me 
another question about full system
simulation the other day, because I don't know much about gem5 user lists, 
and clicking on the reply below always
shows a connection error, so I haven't been able to reply.
     I still want to ask a question today about whole-system simulation. 
I'm using a full system simulation to test
the MachSuite benchmark, MachSuite contains a lot of algorithms, and I want 
to know how long each algorithm runs. I
let the running time of each algorithm be printed to the output .txt, which 
makes it easier for me to organize the
data, but I found that the directory that exists after logging in with 
m5term localhost 3456 is [root@gem5-host],
and the file is also under this environment, how can I save the output .txt 
file in my own server directory or how
can I retrieve the output.txt file from [root@gem5-host].
If someone could answer my question, I would greatly appreciate it.


Actually, you can set the output directory from the command line to gem5.
I do that so that each run goes into a different directory.  I'm sure that
people have written all kinds of shell scripts wrappers (as I have) to
handle this.

Eliot Moss
___
gem5-users mailing list -- gem5-users@gem5.org
To unsubscribe send an email to gem5-users-le...@gem5.org


[gem5-users] Re: How to suspend FS simulation after certain number of ticks

2024-01-16 Thread elio.vinciguerra--- via gem5-users
Or, at least, I would need to do it in such a way as to have the historical 
progression of the "stats.txt" file during the simulation. So I need to suspend 
the simulation at a certain tick, get the "stats.txt" file, resume the 
simulation, or I need a solution that allows me to dump at a certain tick.
___
gem5-users mailing list -- gem5-users@gem5.org
To unsubscribe send an email to gem5-users-le...@gem5.org


[gem5-users] How to suspend FS simulation after certain number of ticks

2024-01-16 Thread elio.vinciguerra--- via gem5-users
Hi all, I would need to suspend the FS simulation after a certain number of 
ticks, and then have it resume normally.

I know that for SE mode this is feasible by inserting `m5.simulate()` in a loop 
and passing as an argument to the same function the number of ticks it should 
simulate.

Is there an analogue for FS mode?

I am using `/gem5/configs/example/riscv/fs_linux.py`
___
gem5-users mailing list -- gem5-users@gem5.org
To unsubscribe send an email to gem5-users-le...@gem5.org