Giter Site home page Giter Site logo

Comments (8)

bradjc avatar bradjc commented on June 5, 2024 1

I always thought process loading should be done through process loading functions. Is there any upstream board that doesn't use the process loading functions? Do you know any downstream project that doesn't rely on process loading functions?

No, and, well, no. But it is a very conscious design choice since we added shared process loading functions back in #511.

from tock.

bradjc avatar bradjc commented on June 5, 2024 1

Boards need the option to be able to disable version checking, but they do not need to be able to dynamically choose whether to check versions or not (say to do it for some process binaries but not others).

I think a reasonable next step would be to:

  1. Change ProcessBinary to use a const to avoid the dynamic bool we don't need.
  2. Mark this as something to remove entirely after the next 2.x release, as I think it is reasonable at this point that all boards want to do version checking.

from tock.

bradjc avatar bradjc commented on June 5, 2024

When we added kernel version checking, we decided that it is up to the specific kernel (ie board) if it wanted to enforce the check or not, hence the argument to ProcessStandard::create(). What is the reason to change that?

We might only have code in the upstream repo that sets it to true, but the expectation was that out-of-tree boards might want to do it differently.

from tock.

Ioan-Cristian avatar Ioan-Cristian commented on June 5, 2024

I understand that downstream projects might not want to require a minimum kernel version. However, my general expectation is that one shouldn't dive into kernel's source code if they want to configure it. In my opinion, kernel configuration should be done either at board level or through configuration parameters. Note that my second proposed solution doesn't prevent Tock upstream code to continue enforcing minimum kernel version:

  • config variable: set to true upstream. Downstream projects may change it depending on their needs.
  • constant generic: load_processes and load_and_check_processes take a boolean constant generic parameter that is set to true in upstream board files. Its value can be changed on a board by board basis by downstream projects.

The difference between the two approaches is evident:

  • config variable: configuration at kernel level
  • constant generic: configuration at board level

I would opt for the second approach since it allows finer configuration. However, such fine configuration may be considered unnecessary. In this case, the first approach is more suitable.

from tock.

lschuermann avatar lschuermann commented on June 5, 2024

I'd be happy with a const generic for this. However, boolean const generics don't carry much inherent meaning when you just look at the instantiation. Similar to how such runtime parameters are more cleanly passed as enums, we can pass this as types:

trait KernelVersionEnforcement {
    fn enforce_mininum_kernel_version() -> bool;
}

enum EnforceMinimumKernelVersion {}
impl KernelVersionEnforcement for EnforceMinimumKernelVersion { ... }

enum SkipVersionCheck {}
impl KernelVersionEnforcement for SkipVersionCheck { ... }

Perhaps with better type names. This would allow us to also ship more granular policies in the future, while not breaking any APIs.

from tock.

bradjc avatar bradjc commented on June 5, 2024

Calling ProcessStandard::create(..., true, ...) is at the board level. The process_loading functions are just helpers that boards can choose to use, and can use different variants if they want.

from tock.

Ioan-Cristian avatar Ioan-Cristian commented on June 5, 2024

However, boolean const generics don't carry much inherent meaning when you just look at the instantiation.

This can be easily avoided by using a const:

const MY_CONST: bool = true;

my_function::<MY_CONST>(...)

Calling ProcessStandard::create(..., true, ...) is at the board level. The process_loading functions are just helpers that boards can choose to use, and can use different variants if they want.

I always thought process loading should be done through process loading functions. Is there any upstream board that doesn't use the process loading functions? Do you know any downstream project that doesn't rely on process loading functions?

from tock.

jrvanwhy avatar jrvanwhy commented on June 5, 2024

Do you know any downstream project that doesn't rely on process loading functions?

I think Ti50 has their own process loading logic, though I'm not 100% sure of that.

from tock.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.