Skip to content
Snippets Groups Projects

Draft: Add VFS support for kmod (and PMU)

Closed Imported Pierre Gondois requested to merge Pierre.Gondois/lisa:pg/mod_config_v2 into main

Add a VFS to interact with the lisa kmod and configure it dynamically.

Merge request reports

Approval is optional

Closed by Douglas RaillardDouglas Raillard 3 months ago (Jul 16, 2025 3:33pm UTC)

Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
82 * Feature was enabled, and de-activating this config
83 * disabled the feature.
84 */
85 if (feature->__explicitly_enabled && !cfg->activated)
86 deinit_single_features(feature->name);
87 continue;
88 }
89
90 if (cfg->activated) {
91 /*
92 * Feature was enabled. By default, de-init before re-init the feature
93 * to catch potential modifications.
94 */
95 if (feature->__explicitly_enabled)
96 deinit_single_features(feature->name);
97 init_single_feature(feature->name);
  • 37 if (new_value)
    38 ret = feature_param_remove_config_common(entry);
    39 else
    40 ret = feature_param_merge_common(entry);
    41 if (ret) {
    42 pr_err("Could not rollback config values\n");
    43 return ret;
    44 }
    45 }
    46 }
    47
    48 return ret;
    49 }
    50
    51 static inline
    52 bool is_feature_set(char *name)
  • 195 // feature_param type handlers
    196 /////////////////////////////////////
    197
    198 static int
    199 feature_param_set_common(struct feature_param_entry *entry, void *data)
    200 {
    201 struct feature_param_entry_value *val;
    202 int ret = 0;
    203
    204 switch (entry->param->mode) {
    205 case FT_PARAM_MODE_SINGLE:
    206 /* Single parameter, replace the pre-existing value. */
    207 /*
    208 * TODO This might not be a good idea. The value is replaced
    209 * even when the user thinks the value is appended.
    210 * I.e. 'echo 1 >> file' will replace the pre-existing value.
  • 75 * different configs. The resulting value is a set of all the
    76 * values of the different configs.
    77 */
    78 FT_PARAM_MODE_SET = 1,
    79 };
    80
    81 enum feature_param_type {
    82 /* Standard parameter. */
    83 FT_PARAM_TYPE_STD = 0,
    84 /* Specific to the 'lisa_features_param' parameter handling. */
    85 FT_PARAM_TYPE_AVAILABLE_FT,
    86 };
    87
    88 struct feature_param {
    89 const char *name;
    90 enum feature_param_mode mode;
  • 222 int deinit_single_features(char *selected);
    223
    224 /**
    225 * find_feature() - Find the (struct feature) matching the input name.
    226 * @name: Name of the feature to find.
    227 *
    228 * Return: (struct feature*) matching the input name if success.
    229 * NULL otherwise.
    230 */
    231 struct feature *find_feature(char *name);
    232
    233 /**
    234 * find_feature_param() - Find the (struct feature_param) of a feature
    235 * matching the input name.
    236 * @name: Name of the feature to find.
    237 * @feature: Feature to search the (struct feature_param) from.
  • Only looked at the C code so far, let's keep the Python part for later when we are done with the C.

  • Congregate Migrate @congregate_migrate started a thread on an outdated change in commit 763b85f9
  • 137 149 int __placeholder_deinit(struct feature *feature) {
    138 150 return 0;
    139 151 }
    152
    153 struct feature *find_feature(char *name)
  • Congregate Migrate @congregate_migrate started a thread on an outdated change in commit 763b85f9
  • 138 #define PARAM_SINGLE(name, perms, param_type, feature) \
    139 __PARAM(name, FT_PARAM_MODE_SINGLE, FT_PARAM_TYPE_STD, perms, param_type, __EVENT_FEATURE(feature))
    140 #define PARAM_SET(name, perms, param_type, feature) \
    141 __PARAM(name, FT_PARAM_MODE_SET, FT_PARAM_TYPE_STD, perms, param_type, __EVENT_FEATURE(feature))
    142
    143 #define FEATURE_PARAMS(...) \
    144 .params = (struct feature_param* []){__VA_ARGS__, NULL} \
    145
    146 #define EXPAND(...) __VA_ARGS__
    147 #define DEFINE_FEATURE_PARAMS(...) EXPAND(__VA_ARGS__)
    148
    149 #define for_each_feature_param(param, pparam, feature) \
    150 if (feature->params) \
    151 for (pparam = feature->params, param = *pparam; param != NULL; pparam++, param = *pparam)
    152
    153 #define feature_param_entry_print(param, val) { \
    • As useful as it is, it might be better to make it a 'debug' option or to switch pr_err to pr_debug at least, I think. Failed attempt to set given parameter should be advertised through write syscall, and that should suffice. Also - why not making it an inline function ? With macro it would be good to make sure it's parameters are safely used - as of use in brackets ....

      By Beata Michalska on 2024-02-15T15:41:05

    • I'm not sure I understand what you mean with write syscall (more exactly to which file should the message go). Understood for the rest.

      By Pierre Gondois on 2024-02-19T11:40:14

    • This macro is being used to report details about a failure upon an attempt to activate given config: so upon writing to dedicated node (lisa_activate_write). It should be sufficient to report an error through fs write function (lisa_activate_write), and potentially leave this functionality for debug version only (?) Also at one point it has been considered to create a dedicated node per feature reporting last encountered error which could be used instead.

      By Beata Michalska on 2024-02-25T16:34:04

    • Ok understood. I'm updating the pr_err to pr_debug in general then.

      By Pierre Gondois on 2024-02-26T12:44:21

    • Congregate Migrate changed this line in version 2 of the diff · Imported

      changed this line in version 2 of the diff

      By Pierre Gondois on 2024-02-27T11:55:37

    • Please register or sign in to reply
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading