Hi Dionna, kernel test robot noticed the following build warnings: [auto build test WARNING on mst-vhost/linux-next] [also build test WARNING on linus/master v6.15 next-20250606] [cannot apply to kvm/queue kvm/next kvm/linux-next] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Dionna-Glaze/kvm-sev-Add-SEV-SNP-guest-request-throttling/20250605-230536 base: https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git linux-next patch link: https://lore.kernel.org/r/20250605150236.3775954-2-dionnaglaze%40google.com patch subject: [PATCH v6 1/2] kvm: sev: Add SEV-SNP guest request throttling config: x86_64-rhel-9.4-rust (https://download.01.org/0day-ci/archive/20250606/202506061922.q7OljdiN-lkp@xxxxxxxxx/config) compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff) rustc: rustc 1.78.0 (9b00956e5 2024-04-29) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250606/202506061922.q7OljdiN-lkp@xxxxxxxxx/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@xxxxxxxxx> | Closes: https://lore.kernel.org/oe-kbuild-all/202506061922.q7OljdiN-lkp@xxxxxxxxx/ All warnings (new ones prefixed by >>): >> arch/x86/kvm/svm/sev.c:376:6: warning: variable 'throttle_interval' set but not used [-Wunused-but-set-variable] 376 | u64 throttle_interval; | ^ 1 warning generated. vim +/throttle_interval +376 arch/x86/kvm/svm/sev.c 334 335 /* 336 * This sets up bounce buffers/firmware pages to handle SNP Guest Request 337 * messages (e.g. attestation requests). See "SNP Guest Request" in the GHCB 338 * 2.0 specification for more details. 339 * 340 * Technically, when an SNP Guest Request is issued, the guest will provide its 341 * own request/response pages, which could in theory be passed along directly 342 * to firmware rather than using bounce pages. However, these pages would need 343 * special care: 344 * 345 * - Both pages are from shared guest memory, so they need to be protected 346 * from migration/etc. occurring while firmware reads/writes to them. At a 347 * minimum, this requires elevating the ref counts and potentially needing 348 * an explicit pinning of the memory. This places additional restrictions 349 * on what type of memory backends userspace can use for shared guest 350 * memory since there is some reliance on using refcounted pages. 351 * 352 * - The response page needs to be switched to Firmware-owned[1] state 353 * before the firmware can write to it, which can lead to potential 354 * host RMP #PFs if the guest is misbehaved and hands the host a 355 * guest page that KVM might write to for other reasons (e.g. virtio 356 * buffers/etc.). 357 * 358 * Both of these issues can be avoided completely by using separately-allocated 359 * bounce pages for both the request/response pages and passing those to 360 * firmware instead. So that's what is being set up here. 361 * 362 * Guest requests rely on message sequence numbers to ensure requests are 363 * issued to firmware in the order the guest issues them, so concurrent guest 364 * requests generally shouldn't happen. But a misbehaved guest could issue 365 * concurrent guest requests in theory, so a mutex is used to serialize 366 * access to the bounce buffers. 367 * 368 * [1] See the "Page States" section of the SEV-SNP Firmware ABI for more 369 * details on Firmware-owned pages, along with "RMP and VMPL Access Checks" 370 * in the APM for details on the related RMP restrictions. 371 */ 372 static int snp_guest_req_init(struct kvm *kvm) 373 { 374 struct kvm_sev_info *sev = to_kvm_sev_info(kvm); 375 struct page *req_page; > 376 u64 throttle_interval; 377 378 req_page = alloc_page(GFP_KERNEL_ACCOUNT | __GFP_ZERO); 379 if (!req_page) 380 return -ENOMEM; 381 382 sev->guest_resp_buf = snp_alloc_firmware_page(GFP_KERNEL_ACCOUNT | __GFP_ZERO); 383 if (!sev->guest_resp_buf) { 384 __free_page(req_page); 385 return -EIO; 386 } 387 388 sev->guest_req_buf = page_address(req_page); 389 mutex_init(&sev->guest_req_mutex); 390 391 throttle_interval = ((u64)sev_snp_request_ratelimit_khz * HZ) / HZ_PER_KHZ; 392 ratelimit_state_init(&sev->snp_guest_msg_rs, sev_snp_request_ratelimit_khz, 1); 393 394 return 0; 395 } 396 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki