7392 remove event channel support from lofi and implement lofi_devlink_cache.
Review Request #218 — Created Sept. 17, 2016 and submitted
Information | |
---|---|
tsoome | |
illumos-gate | |
7392 | |
Reviewers | |
general | |
lofi: remove event channel support from lofi and implement lofi_devlink_cache.
I did run following sequence myself: modunload -i <lofi>; zoneadm -z lz halt; modunload -i <lofi>; zoneadm -z lz boot
did not got any issues.richlowe: I have booted/halted/modunloaded a zone 200 times, and not crashed yet.
Summary: |
|
||||
---|---|---|---|---|---|
Bugs: |
|
-
Although the general approach seems fine to me, it is unclear to my why you are putting so much of this knowledge into modctl, when modctl doesn't seem to be relevant. All of the loadable modules are now being polluted by the new external definition for the mod_devlink_cache, but that is not relevant to any loadable module except lofi. Am I missing something here?
It seems like you could modify this implementation to be much more constrained between the relevant components.
Since log_sysevent is already lofi-aware via the notify_lofi function, is there some reason you don't keep the relationship constrained to the the lofi module and the log_sysevent code? It seems like it would be much less invasive to have all of the devlink caching implementation inside the lofi module where it is being used. You could have an external hook in log_sysevent which gets initialized when the lofi module is loaded and lets the notify_lofi function know that it needs to start adding the events to the lofi nvlist.
I'd like to understand why the current implementation was chosen before this gets approved.
Change Summary:
Moved cache from modctl to log_sysevent. For this update, I did keep the variable and header file names.
Diff: |
Revision 3 (+119 -113) |
---|
-
Toomas, thanks, this looks like you are on the right path. I think you need to cleanup the names now since using the "mod*" naming doesn't make sense with this tighter implementation. I am also confused about the code in notify_lofi. It looks like you are freeing the event nvlist when this is not a lofi-specific event, but the caller (log_usr_sysevent) still wants to use the event after notify_lofi has been called. Have you tested this with a sysevent consumer so you can see that all of the events are being delivered upstream even though some events are also being used for lofi?
-
Toomas, sorry, yes, I see that sysevent_get_attr_list will duplicate the nvlist, so ignore that part of my comment. I think your suggestion of using a "lofi*" style name is good.
-
Toomas, thanks for fixing the naming. I think that will be much cleaner going forward. I only have a couple of small nits on your latest set of changes.
usr/src/uts/common/io/lofi.c
2989 fix the comment to match the new namingusr/src/uts/common/os/modctl.c
remove this file from your changeset
-
Hi Toomas. This looks good. There was one thing I noticed while doing a final review. I'm sorry I didn't see this earlier. Other than this nit, the rest looks good.
You can remove the redundant code in log_sysevent.c at lines 1799-1810 by rewriting it like this. You also don't need the redundant strcmp at line 1804 since you already checked that at lines 1779-1780.
mutex_enter(&lofi_devlink_cache.ln_lock);
if (strcmp(class, EC_DEV_ADD) == 0) {
fnvlist_add_nvlist(lofi_devlink_cache.ln_data, name, nvlist);
} else {
/ Can not use fnvlist_remove() as we can get ENOENT. /
(void) nvlist_remove_all(lofi_devlink_cache.ln_data, name);
}
cv_broadcast(&lofi_devlink_cache.ln_cv);
mutex_exit(&lofi_devlink_cache.ln_lock);
Change Summary:
fixed issue description
Summary: |
|
||||||
---|---|---|---|---|---|---|---|
Description: |
|