-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow old IoUSB devices for config.enable.usb #4634
base: master
Are you sure you want to change the base?
Allow old IoUSB devices for config.enable.usb #4634
Conversation
49e5d68
to
8cc307e
Compare
@christoph-zededa , although IoUSB is deprecated, is there any use case where IoUSB can still be used? I'm wondering if these changes can break systems using old device models + EVE with IoUsbController? |
I added be643f3 to remove all remaining uses of |
tools/spdx-check.sh
Outdated
@@ -111,6 +111,10 @@ file_to_be_checked() { | |||
return 1 | |||
fi | |||
done | |||
if grep -qi "do not edit" "$file"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which files exactly are you referring to?
Even if a file is generated by a tool, I still think it should contain the header—it's recommended so we know the consequences of using that generating tool. While I agree that we can (and already do) ignore some generated files, we can still add headers to files that come from tools we maintain ourselves.
Could you clarify which specific files you have in mind here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iotype_string.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
COuld we change it to "Code generated by.*stringer"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
pkg/pillar/types/iotype_string.go
Outdated
@@ -0,0 +1,55 @@ | |||
// Code generated by "stringer --type IoType"; DO NOT EDIT. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, I didn't know about that tool—I've always handled it manually. While it looks useful, I'm wondering how maintainable it is. If we change an enum, will the tool be run automatically? If not, then we shouldn't really treat the output as entirely auto-generated, and we’d need to maintain it ourselves. If it is run automatically, then we can skip the header.
So, I see two options:
- Automate the tool run so we don't need a header, or
- Treat the file as manually maintained and add the header.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering how maintainable it is
it throws a compile error if one makes incompatible changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And after that, one has to go and fix it manually. So. it's not rerun automatically. So, it's manually maintained file =)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also have lots of other auto-generated files checked in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like under vendors and API? Or something else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't see this custom String() function earlier. Doesn't the golang built-in String() for an enum produce the correct output?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately not, that's why they created https://pkg.go.dev/golang.org/x/tools/cmd/stringer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah - I guess the protoc compiler generates such functions for protobuf enum values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought the stringer example had the stringer tool run at compile time so this does not need to be checked in to github.
Thus a file with only
//go:generate stringer -type=IoType
checked in to github?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@OhmSpectator and I looked on Friday how other projects do this and lots of them check in this file, too.
ioBundle := &aa.IoBundleList[i] | ||
ioBundle.Error.removeByType(ErrIOBundleDeprecatedType{}) | ||
|
||
if ioBundle.Type == IoUSB { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where exactly does this type originate? Could it come from the controller or from persistent storage? If it can be stored and then a user updates EVE to a newer version, might they encounter this error? Or is it only ever set by our internal code, making it impossible for an older or external value to appear?
If it can come from an older source, is there any way we could safely handle unknown types — perhaps trying to guess the correct type and logging a warning—rather than breaking the system that was previously running without issues?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is derived from an eve-api
type: PhyIoUSB = 2;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nobody is reading these warnings ;-) - see also #4634 (comment)
Afaik the commercial users got informed about the change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Afaik the commercial users got informed about the change.
Unfortunately, it does not prevent them from making mistakes and then requesting fixes from the engineering... We know such cases =(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I must have missed something in the past reviews/discussions and I don't recall us communicating to users that all existing models which published in the controllers (including the eden model files which we can change) need to be changed from IoTypeUsb to IoTypeUsbController.
I thought we introduced IoTypeUsbController as a more clear name, but that existing uses of IoTypeUSb would be interpreted to mean the same thing as IoTypeUsbController. If that is not the case I think we will break existing usage.
Let's set up some time on Monday to talk about this. Perhaps I'm missing something.
Alternatives:
|
I would like @eriknordmark to share his experience in handling such situations. I don't think it's the first time we have to introduce a potentially breaking change. |
@christoph-zededa, in general, how did you come to the idea of this change? Is it related to some issue? |
It is because of two issues I saw this week:
|
dedad09
to
4691a87
Compare
that is either IoUSBController or IoUSBDevice Signed-off-by: Christoph Ostarek <[email protected]>
to hopefully fix flaky test in the future Signed-off-by: Christoph Ostarek <[email protected]>
4691a87
to
05bba0a
Compare
some older model manifests might still be using IoUSB; this code also accepts this type when checking for USB controllers that should only do the PCI reservation when starting of an edge app, because the user might set config.enable.usb to use a local keyboard Signed-off-by: Christoph Ostarek <[email protected]>
05bba0a
to
63dd102
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
pkg/pillar/hypervisor/xen.go
Outdated
@@ -413,7 +413,7 @@ func (ctx xenContext) CreateDomConfig(domainName string, | |||
short := types.PCILongToShort(pa.pciLong) | |||
// USB controller are subject to legacy USB support from | |||
// some BIOS. Use relaxed to get past that. | |||
if pa.ioType == types.IoUSB { | |||
if pa.ioType == types.IoUSBController { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this also use IsUSBController()?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes!
But unfortunately we had there only pciDevice
which seems to become more and more an IoBundle
, so I just embedded it instead: 86a12b9
This seems to have been removed. If that was the intent please update the PR description. |
pciDevice was about to become more and more a copy of types.IoBundle, instead remove all copied files and add a copy to the original types.IoBundle This also enables in the next commit to use IoBundle.IsUSBController() Signed-off-by: Christoph Ostarek <[email protected]>
this one checks for IoUSBController and IoUSB and works better with deprecated models that still use the old type Signed-off-by: Christoph Ostarek <[email protected]>
1194c7c
to
7c58026
Compare
@christoph-zededa, did you manage to resolve all of Erik's doubts? =) |
IMO on EVE side, yes. |
OK, so it's ready for a new round of reviews... Got it. |
IoUsb should not be used anymore in favor of IoUsbController and IoUsbDevice
but let's still be backwards compatible and make an intelligent guess whether a device or a controller was meant