All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 0/4] Add throttling detection to sev-guest
@ 2022-11-02 15:18 Dionna Glaze
  2022-11-02 15:18 ` [PATCH v5 1/4] ccp: Name -1 return value as SEV_RET_NO_FW_CALL Dionna Glaze
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Dionna Glaze @ 2022-11-02 15:18 UTC (permalink / raw)
  To: linux-kernel, x86
  Cc: Dionna Glaze, Tom Lendacky, Paolo Bonzini, Joerg Roedel,
	Peter Gonda, Thomas Gleixner, Dave Hansen

The guest request synchronous API from SEV-SNP VMs to the host's security
processor consumes a global resource. For this reason, AMD's docs
recommend that the host implements a throttling mechanism. In order for
the guest to know it's been throttled and should try its request again,
we need some good-faith communication from the host that the request
has been throttled.

These patches work with the existing /dev/sev-guest ABI to detect a
throttling code.

Changes from v4:
  * Clarified comment on SEV_RET_NO_FW_CALL
  * Changed ratelimit loop to use sleep_timeout_interruptible
Changes from v3:
  * sev-guest ratelimits itself to one request twice a second.
  * Fixed a type signature to use u64 instead of unsigned int
  * Set *exitinfo2 unconditionally after the ghcb_hv_call.
Changes from v2:
  * Codified the non-firmware-call firmware error code as (u32)-1.
  * Changed sev_issue_guest_request unsigned long *fw_err argument to
    u64 *exitinfo2 to more accurately and type-safely describe the
    value that it outputs.
  * Changed sev_issue_guest_request to always set its exitinfo2
    argument to either the non-firmware-call error code, the
    EXIT_INFO_2 returned from the VMM if the request failed, or 0 on
    success. This fixes a bug that returned uninitialized kernel stack
    memory to the user when there is no error.
  * Changed the throttle behavior to retry in the driver instead of
    returning -EAGAIN, due to possible message sequence number reuse
    on different message contents.

Changes from v1:
  * Changed throttle error code to 2

Cc: Tom Lendacky <Thomas.Lendacky@amd.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Joerg Roedel <jroedel@suse.de>
Cc: Peter Gonda <pgonda@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>

Signed-off-by: Dionna Glaze <dionnaglaze@google.com>

Dionna Glaze (4):
  ccp: Name -1 return value as SEV_RET_NO_FW_CALL
  x86/sev: Change snp_guest_issue_request's fw_err
  virt/coco/sev-guest: Remove err in handle_guest_request
  virt/coco/sev-guest: interpret VMM errors from guest request

 arch/x86/include/asm/sev.h              |  4 +-
 arch/x86/kernel/sev.c                   | 10 +++--
 drivers/crypto/ccp/sev-dev.c            |  2 +-
 drivers/virt/coco/sev-guest/sev-guest.c | 57 ++++++++++++++++++++-----
 include/uapi/linux/psp-sev.h            |  7 +++
 include/uapi/linux/sev-guest.h          | 18 +++++++-
 6 files changed, 78 insertions(+), 20 deletions(-)

-- 
2.38.1.273.g43a17bfeac-goog


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-11-03 19:04 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-02 15:18 [PATCH v5 0/4] Add throttling detection to sev-guest Dionna Glaze
2022-11-02 15:18 ` [PATCH v5 1/4] ccp: Name -1 return value as SEV_RET_NO_FW_CALL Dionna Glaze
2022-11-02 17:30   ` Tom Lendacky
2022-11-02 18:46     ` Borislav Petkov
2022-11-02 15:18 ` [PATCH v5 2/4] x86/sev: Change snp_guest_issue_request's fw_err Dionna Glaze
2022-11-02 15:18 ` [PATCH v5 3/4] virt/coco/sev-guest: Remove err in handle_guest_request Dionna Glaze
2022-11-02 15:18 ` [PATCH v5 4/4] virt/coco/sev-guest: interpret VMM errors from guest request Dionna Glaze
2022-11-03 15:26 ` [PATCH v5 0/4] Add throttling detection to sev-guest Peter Gonda
2022-11-03 19:03   ` Dionna Amalie Glaze

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.