Skip to content

Conversation

@miguelafsilva5
Copy link
Member

PR Description

This PR removes an unused variable from the addr_space struct. The cpu variable was being set, but never used.
This might be needed because a later PR will need a slight modification on the vm_init function where the order of function will be re-arranged.
However, there are 2 problems that I could identify with this change:

  • In function mem_section_shared_cpus in core/mpu/mem.c (252) the following code could/should be changed from:
else {
        cpus = cpu()->vcpu->vm->cpus;
    }

to

else {
        cpus = as->cpus;
    }
  • And the prototype of as_init becomes different from MPU platforms (4 parameters) to MMU platforms (5 parameters)

I would like to get some opinions regarding this topic. @josecm @DavidMCerdeira @danielRep

@josecm josecm self-assigned this Oct 8, 2025
@josecm
Copy link
Member

josecm commented Oct 8, 2025

@miguelafsilva5 I think we can keep the first option for now. I see no advantages on using an explicit cpus field in the address space struct if all cases are covered.

However, when we move to cpu sharing, using the second option would be useful, since we cannot assume only a single vcpu is hosted in this cpu, thus is not implimed that the vm for the address space being managed iis the one from the currently active one (i.e., cpu()->vcpu->vm).

@danielRep
Copy link
Member

@miguelafsilva5 I think we can keep the first option for now. I see no advantages on using an explicit cpus field in the address space struct if all cases are covered.

However, when we move to cpu sharing, using the second option would be useful, since we cannot assume only a single vcpu is hosted in this cpu, thus is not implimed that the vm for the address space being managed iis the one from the currently active one (i.e., cpu()->vcpu->vm).

I agree.

@miguelafsilva5 miguelafsilva5 changed the base branch from main to fix/linker-symbols October 17, 2025 13:30
Base automatically changed from fix/linker-symbols to main October 24, 2025 10:41
The cpu variable from struct addr_space was not being used
throughout the code.

Signed-off-by: Miguel Silva <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants