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
PSA - Add notes about empty groups for the ActionSelector extern #662
PSA - Add notes about empty groups for the ActionSelector extern #662
Conversation
@konne-google I do not seem to be able to add you as a reviewer for this change, but if I recall correctly you were interested in this, so wanted to notify you of this proposed change in case you had comments. Also adding @vgurevich |
This looks good. Thanks for the update! |
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 left a few comments
p4-16/psa/PSA.mdk
Outdated
@@ -2069,7 +2069,16 @@ specified as a parameter when instantiating the action selector. | |||
Action selector members may only specify action types defined | |||
in the `actions` attribute of the implemented table. All actions in a group must be | |||
of the same type. The action parameters for actions in the same group are allowed | |||
to differ, and the action of different groups in a selector may be different. | |||
to differ, and the action of different groups in a selector may be different. More precisely, a PSA implementation is allowed to, but need not, support an action selector group where different members use different action types. |
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.
Line wrap?
Doesn't the precision contradict the statement above:
All actions in a group must be of the same type.
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.
If the way it is written now is confusing, I would prefer to modify the sentence "All actions in a group must be of the same type." Except in rare circumstances where we actually want to prevent something, I think PSA should specify "implementations should support at least this", and should usually not say "an implementation cannot do X".
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 think the first sentence should be changed. Right now IMO they strictly contradict each other.
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.
Eliminated the contradiction, by changing the whole paragraph. Hopefully the meaning is still reasonably clear.
p4-16/psa/PSA.mdk
Outdated
PSA implementations are allowed to support adding entries in a table | ||
that point at groups which currently have no members, but they are | ||
also allowed to have non-portable implementation specific behavior if | ||
this occurs in the data plane. This limitation of a PSA data plane |
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.
double whitespace
p4-16/psa/PSA.mdk
Outdated
@@ -2422,7 +2431,11 @@ In particular, ActionProfile and ActionSelector single operations, | |||
such as adding a member to a group, removing a member from a group, | |||
adding an empty group, deleting an empty group, or modifying the | |||
action parameters of an action added earlier to a group, should all be | |||
atomic. | |||
atomic. One possible exception is a PSA implementation that uses the |
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.
double whitespace again it seems (and there are other occurrences as well). This is funny because I have seen it in a PR from Tom Everman as well; does it come from the text editor?
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 checked Wikipedia on this, out of curiosity. Quoting from the first paragraph of the Wikipedia page below: "Many people prefer double sentence spacing for informal use because that was how they were taught to type." <-- That is my reason.
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.
if you use emacs it has some very nice commands to operate on phrases.
phrases in emacs are delimited by a sentence terminator and two spaces.
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.
more precisely, that's the default regular expression for phrases. you can customize it. but it makes expressions such as i.e. or e.g. that and with a period unambiguous.
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.
@jafingerhut My bad I had no idea this was a thing. I should have Googled it first.
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.
@antoninbas Not bad on your part at all. Until a month ago I did not even realize that a few people are vehemently anti-double-space-between-sentences, e.g. whoever made the image early in this article: https://www.cultofpedagogy.com/two-spaces-after-period/
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.
Lol. Given that the using a single space after a period is called "French spacing" (https://en.wikipedia.org/wiki/History_of_sentence_spacing#French_and_English_spacing), I think my ignorance can be excused :)
|
||
In either case, an implementation might also support putting the `if` | ||
statement inside of the action `set_output_port`, but this is not | ||
required by PSA. |
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.
did you want to mention "fast-failover" as one possible reason for the group to become empty without action from the switch or controller software? That's a valid way to implement the P4Runtime "watch" attribute if the HW supports it. In this case, the behavior may be undefined until the software is notified that the group is empty and can take action.
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.
This whole description is for hiding the fact that a data plane implementation cannot support empty action selector groups, from the controller software.
It does it by explicitly having the switch/P4Runtime agent software do the hiding, via explicit actions some part of that software.
Are you thinking of a data plane that might do this without the involvement of target-specific switch software at all, e.g. in an ASIC? I've not seen networking ASICs that declare ports down on their own, without software getting involved.
All that said, I am fine with adding fast failover and/or watch attribute implementation as motivating reasons for wanting to use this workaround.
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.
Hashing this out in live conversation might be better, but I am also confused by this sentence of your comment: "In this case, the behavior may be undefined until the software is notified that the group is empty and can take action." The reason for this new appendix is to avoid undefined behavior, even if the data plane does not have predictable behavior for empty action selector groups. The combined "data plane + P4Runtime agent" system can still have predictable portable behavior for times when the "action selector group is empty, as far as the controller knows".
p4-16/psa/PSA.mdk
Outdated
P4Runtime server implementation (hereafter called the agent). The | ||
basic idea is that first the controller specifies the action (with | ||
action parameter values) to be performed when the group is empty. The | ||
details of the message are left for the P4Runtime API specification to |
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 can bring this up at the WG tomorrow
... in response to discussion at the last P4 architecture work group meeting. Recommend, but do not require, that PSA data plane support empty groups by executing the table's default action if an empty group is encountered during packet processing time, with no restrictions on the names of the default action vs. the actions used in the non-empty groups. Describe some details of a faithful empty group implementation in the new appendix, and why the proposed workaround does not quite live up to that standard.
@konne-google @cc10512 @vgurevich @wmohsin @hanw @antoninbas I have updated the text a bit based on discussion we had at the P4 API and architecture work group meetings held on 2018-Aug-15. The basic changes are:
|
This looks good to me now. |
@jafingerhut my understanding was that we were considering adding a new table property to indicate which action to execute when the selector group is empty. Any reason why this has to be the same as the default action for a match miss?
|
@antoninbas No, no reason I can think of that the 'encountered an empty action selector group' action must be the same as the default action. I probably thought of making the same while writing up the idea and thought it would simplify things if the default action for both were identical. So if we make a new table property, e.g. one with a name like |
This is like `default_action`, except that it specifies an action for a table with ActionSelector implementation to execute if an empty group is encountered.
@antoninbas @konne-google I have updated the PR to add a new table property |
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
p4-16/psa/PSA.mdk
Outdated
P4Runtime server implementation (hereafter called the agent). The | ||
basic idea is that first the controller specifies the action (with | ||
action parameter values) to be performed when the group is empty. The | ||
details of the message are left for the P4Runtime API specification to |
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 likely that now that we have the new table property, we will not add this to P4Runtime 1.0
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.
Understood. Do you think that this appendix is clear enough that it is not required behavior, but one possible idea that might help PSA implementers understand and/or create their own implementation of the empty group action behavior?
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 think it's clear but that specific paragraph is maybe a bit out-of-sync with the rest. Up until that paragraph we talk about the "empty group action" (which can be set through the new table property). But in this paragraph we have:
since PSA allows different groups to use different action
types, it seems best to allow the controller to specify a different
empty group action per group.
I understand that it is because you are trying to take into account the constraint that some HW may be limited to using the same action in any given group, while making sure that the solution is generic enough to allow different groups to use different actions.
In my case the most likely implementation will be to create a new group and update the match rules pointing to that group, but it is not ideal if there is more than one match rule for any given group.
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 have modified this paragraph to remove any mention of the controller specifying the empty action group, for now mentioning only the agent obtaining it from the compiled representation of the P4 program.
The `psa_empty_group_action` property of a table is similar to the | ||
`default_action` property in the following ways: | ||
|
||
+ They both have actions as their 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.
For P4Runtime 1.0 - to avoid making the TableEntry message too complex - it is likely that we will require the "empty group action" to be const.
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.
Understood. Is it reasonable to document that detail in the P4Runtime API spec? Or would it better be mentioned here as something like "See the P4Runtime API spec for details, but at least P4Runtime API v1.0 will not define any messages for modifying the empty group action."
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 we definitely to mention this in the spec. I have opened an issue to keep track of this: p4lang/p4runtime#43
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 have gone ahead and added a sentence similar to the one I mentioned above. Here is the proposed text:
"In the absence of a const
modifier, the control software is
allowed to change the action. The P4 API working group has no plans
to define a message for modifying a table's empty group action in
version 1.0 of the P4Runtime API specification, but such a message
might be added in a later version."
p4-16/psa/PSA.mdk
Outdated
|
||
Below we describe one way that nearly achieves the goals above, except | ||
that it requires the empty group action to have the same name as the | ||
non-empty groups of the action selector. This may be too onerous of a |
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.
maybe it would be clearer to repeat the word "action" 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.
If you meant replacing "the same name as" with "the same action name as", then I have made that change.
If you meant something else, let me know.
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 may be misunderstanding the sentence, but I meant:
"it requires the empty group action to be the same as the action for non-empty groups"
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.
Not sure if this clarifies anything here, but somehow we need a clear way to describe the proposed restriction on the actions that are allowed within the same action selector group.
I've been trying to use "action name" to mean the name of the action, without any action parameter values specified.
If "action" means "action name plus action parameter values", then there are places in this description we definitely don't want to use the word "action" alone.
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 think we're on the same page, you should feel free to merge
I think replacing "name" with "action name" like you did in your latest commit made the sentence clearer
@cc10512 I think Antonin and Konstantin are OK with these changes now. I have read through them one last time and done one hopefully final typo fix. If you could give it a read, I'll be happy to merge it once it is in a state where you approve, too. Here is a summary of the 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.
Please tighten up the spec itself. It is a bit too intermingled with restrictions and future plans. Some of those are already discussed in the appendix, and we can do more in terms of examples. However, it should be more clear what is the PSA specification that we define for this version.
p4-16/psa/PSA.mdk
Outdated
does have this restriction, it must still allow different members of | ||
the same group to have different action parameter values. PSA | ||
implementations must also allow the action names of different groups | ||
in a selector to be different. |
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 think this paragraph may benefit from a bit of reorganization for clarity.
In particular, it would be good to first list the requirements: must have at lease one action in each group, allow different actions in different groups. And introduce the psa_emtpy_group_action
property (it simply occurs later) and its semantics: provide the must have action when there are no entries in the group. Then discuss the possible extensions and restrictions: may allow different parameter values, may restrict to one action.
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.
Thanks for detailed review comments. Take a look at the latest version when you get a chance. I have attempted to address all of your comments, although I am only replying to this one.
p4-16/psa/PSA.mdk
Outdated
earlier `G` was non-empty. We will consider requiring such support in | ||
future versions of PSA. | ||
|
||
Until then, implementations are allowed to have non-portable |
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.
Please specify what is supported today first, rather than base it on what will be required in the future. Then say this may be tightened in the future.
p4-16/psa/PSA.mdk
Outdated
as far as the P4Runtime client controller software can observe. See | ||
Appendix [#appendix-empty-action-selector-groups]. | ||
|
||
The `psa_empty_group_action` property of a table is similar to the |
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.
Please move higher in the section. Have the spec first, then the example.
p4-16/psa/PSA.mdk
Outdated
|
||
+ They both have actions as their values. | ||
+ The P4 source code specifies the initial value. | ||
+ If the table property is not given in the P4 source code, its value |
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.
Is that the psa_empty_group_action
property? Please be precise.
p4-16/psa/PSA.mdk
Outdated
+ They may have a `const` modifier, indicating that control software | ||
is not allowed to change this action. | ||
+ In the absence of a `const` modifier, the control software is | ||
allowed to change the action. The P4 API working group has no plans |
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.
Please remove the plans for the P4 API working group. It is not relevant, and some implementations of P4 runtime may already chose to implement such a message.
Thank you for making the changes. Looks good to me! |
Great. I am going to hurry up and merge this now, before any more comments arise :) |
No description provided.