Skip to content
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

td-payload: handle retry result of mapping GPA #501

Merged
merged 1 commit into from
Oct 26, 2023

Conversation

gaojiaqi7
Copy link
Member

Fix: #498


use super::paging::{clear_shared_bit, set_shared_bit};

const MAP_GPA_MAX_RETRIES: u8 = 3;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why retry 3 times?

@gaojiaqi7
Copy link
Member Author

Screenshot 2023-03-20 212728

@gaojiaqi7
Copy link
Member Author

We need to keep retrying without a limit

@gaojiaqi7
Copy link
Member Author

Answer from KVM team:

  1. Under what circumstances VMM may return this result?

When the specified range is too large. VMM can't complete the request in practical time. e.g. hundreds of GB.

It's up to VMM implementation.

  1. The spec says guest TD must retry this operation when TDG.VP.VMCALL_RETRY is returned. Should guest TD set any maximum retries or timeout? or it should try again unconditionally, no matter how many times it has already tried?

Retry unconditionally. GHCI spec doesn't have any guide on the retry because it's attack surface for (malicious) VMM against guest TD.

If you want guest to implement guard, it's totally up to you how to protect it. probably it's heuristic protection.

@gaojiaqi7 gaojiaqi7 marked this pull request as draft May 24, 2023 01:40
According to GHCI specification, if `TDG.VP.VMCALL_RETRY` is returned,
TD must retry the mapping for the pages in the region starting at the
GPA specified in r11.

Signed-off-by: Jiaqi Gao <jiaqi.gao@intel.com>
@mxu9
Copy link
Contributor

mxu9 commented Oct 25, 2023

It looks good to me.

@jyao1 jyao1 merged commit 3f18d9f into confidential-containers:main Oct 26, 2023
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Need to retry TDG.VP.VMCALL<MapGPA> if the error code is TDG.VP.VMCALL_RETRY
3 participants