kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Dionna Glaze <dionnaglaze@google.com>, kvm@vger.kernel.org
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
	linux-coco@lists.linux.dev, Dionna Glaze <dionnaglaze@google.com>,
	Thomas Lendacky <Thomas.Lendacky@amd.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Joerg Roedel <jroedel@suse.de>, Peter Gonda <pgonda@google.com>,
	Borislav Petkov <bp@alien8.de>,
	Sean Christopherson <seanjc@google.com>
Subject: Re: [PATCH v4 1/2] kvm: sev: Add SEV-SNP guest request throttling
Date: Fri, 16 May 2025 02:21:06 +0800	[thread overview]
Message-ID: <202505160203.9PdDhrOM-lkp@intel.com> (raw)
In-Reply-To: <20250514184136.238446-2-dionnaglaze@google.com>

Hi Dionna,

kernel test robot noticed the following build errors:

[auto build test ERROR on kvm/queue]
[also build test ERROR on kvm/next mst-vhost/linux-next linus/master v6.15-rc6 next-20250515]
[cannot apply to 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/20250515-064452
base:   https://git.kernel.org/pub/scm/virt/kvm/kvm.git queue
patch link:    https://lore.kernel.org/r/20250514184136.238446-2-dionnaglaze%40google.com
patch subject: [PATCH v4 1/2] kvm: sev: Add SEV-SNP guest request throttling
config: x86_64-rhel-9.4 (https://download.01.org/0day-ci/archive/20250516/202505160203.9PdDhrOM-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250516/202505160203.9PdDhrOM-lkp@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202505160203.9PdDhrOM-lkp@intel.com/

All errors (new ones prefixed by >>):

   arch/x86/kvm/svm/sev.c: In function 'snp_set_request_throttle_ms':
   arch/x86/kvm/svm/sev.c:2542:13: warning: unused variable 'ret' [-Wunused-variable]
    2542 |         int ret;
         |             ^~~
   arch/x86/kvm/svm/sev.c: In function 'sev_mem_enc_ioctl':
>> arch/x86/kvm/svm/sev.c:2666:14: error: 'KVM_SEV_SNP_SET_REQUEST_THROTTLE_RATE_MS' undeclared (first use in this function); did you mean 'KVM_SEV_SNP_SET_REQUEST_THROTTLE_RATE'?
    2666 |         case KVM_SEV_SNP_SET_REQUEST_THROTTLE_RATE_MS:
         |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |              KVM_SEV_SNP_SET_REQUEST_THROTTLE_RATE
   arch/x86/kvm/svm/sev.c:2666:14: note: each undeclared identifier is reported only once for each function it appears in
   arch/x86/kvm/svm/sev.c: In function 'snp_handle_guest_req':
>> arch/x86/kvm/svm/sev.c:4039:17: error: 'rc' undeclared (first use in this function); did you mean 'rq'?
    4039 |                 rc = SNP_GUEST_VMM_ERR_BUSY;
         |                 ^~
         |                 rq


vim +2666 arch/x86/kvm/svm/sev.c

  2537	
  2538	static int snp_set_request_throttle_ms(struct kvm *kvm, struct kvm_sev_cmd *argp)
  2539	{
  2540		struct kvm_sev_info *sev = to_kvm_sev_info(kvm);
  2541		struct kvm_sev_snp_set_request_throttle_rate params;
> 2542		int ret;
  2543		u64 jiffies;
  2544	
  2545		if (!sev_snp_guest(kvm))
  2546			return -ENOTTY;
  2547	
  2548		if (copy_from_user(&params, u64_to_user_ptr(argp->data), sizeof(params)))
  2549			return -EFAULT;
  2550	
  2551		jiffies = (params.interval_ms * HZ) / 1000;
  2552	
  2553		if (!jiffies || !params.burst)
  2554			return -EINVAL;
  2555	
  2556		ratelimit_state_init(&sev->snp_guest_msg_rs, jiffies, params.burst);
  2557	
  2558		return 0;
  2559	}
  2560	
  2561	int sev_mem_enc_ioctl(struct kvm *kvm, void __user *argp)
  2562	{
  2563		struct kvm_sev_cmd sev_cmd;
  2564		int r;
  2565	
  2566		if (!sev_enabled)
  2567			return -ENOTTY;
  2568	
  2569		if (!argp)
  2570			return 0;
  2571	
  2572		if (copy_from_user(&sev_cmd, argp, sizeof(struct kvm_sev_cmd)))
  2573			return -EFAULT;
  2574	
  2575		mutex_lock(&kvm->lock);
  2576	
  2577		/* Only the enc_context_owner handles some memory enc operations. */
  2578		if (is_mirroring_enc_context(kvm) &&
  2579		    !is_cmd_allowed_from_mirror(sev_cmd.id)) {
  2580			r = -EINVAL;
  2581			goto out;
  2582		}
  2583	
  2584		/*
  2585		 * Once KVM_SEV_INIT2 initializes a KVM instance as an SNP guest, only
  2586		 * allow the use of SNP-specific commands.
  2587		 */
  2588		if (sev_snp_guest(kvm) && sev_cmd.id < KVM_SEV_SNP_LAUNCH_START) {
  2589			r = -EPERM;
  2590			goto out;
  2591		}
  2592	
  2593		switch (sev_cmd.id) {
  2594		case KVM_SEV_ES_INIT:
  2595			if (!sev_es_enabled) {
  2596				r = -ENOTTY;
  2597				goto out;
  2598			}
  2599			fallthrough;
  2600		case KVM_SEV_INIT:
  2601			r = sev_guest_init(kvm, &sev_cmd);
  2602			break;
  2603		case KVM_SEV_INIT2:
  2604			r = sev_guest_init2(kvm, &sev_cmd);
  2605			break;
  2606		case KVM_SEV_LAUNCH_START:
  2607			r = sev_launch_start(kvm, &sev_cmd);
  2608			break;
  2609		case KVM_SEV_LAUNCH_UPDATE_DATA:
  2610			r = sev_launch_update_data(kvm, &sev_cmd);
  2611			break;
  2612		case KVM_SEV_LAUNCH_UPDATE_VMSA:
  2613			r = sev_launch_update_vmsa(kvm, &sev_cmd);
  2614			break;
  2615		case KVM_SEV_LAUNCH_MEASURE:
  2616			r = sev_launch_measure(kvm, &sev_cmd);
  2617			break;
  2618		case KVM_SEV_LAUNCH_FINISH:
  2619			r = sev_launch_finish(kvm, &sev_cmd);
  2620			break;
  2621		case KVM_SEV_GUEST_STATUS:
  2622			r = sev_guest_status(kvm, &sev_cmd);
  2623			break;
  2624		case KVM_SEV_DBG_DECRYPT:
  2625			r = sev_dbg_crypt(kvm, &sev_cmd, true);
  2626			break;
  2627		case KVM_SEV_DBG_ENCRYPT:
  2628			r = sev_dbg_crypt(kvm, &sev_cmd, false);
  2629			break;
  2630		case KVM_SEV_LAUNCH_SECRET:
  2631			r = sev_launch_secret(kvm, &sev_cmd);
  2632			break;
  2633		case KVM_SEV_GET_ATTESTATION_REPORT:
  2634			r = sev_get_attestation_report(kvm, &sev_cmd);
  2635			break;
  2636		case KVM_SEV_SEND_START:
  2637			r = sev_send_start(kvm, &sev_cmd);
  2638			break;
  2639		case KVM_SEV_SEND_UPDATE_DATA:
  2640			r = sev_send_update_data(kvm, &sev_cmd);
  2641			break;
  2642		case KVM_SEV_SEND_FINISH:
  2643			r = sev_send_finish(kvm, &sev_cmd);
  2644			break;
  2645		case KVM_SEV_SEND_CANCEL:
  2646			r = sev_send_cancel(kvm, &sev_cmd);
  2647			break;
  2648		case KVM_SEV_RECEIVE_START:
  2649			r = sev_receive_start(kvm, &sev_cmd);
  2650			break;
  2651		case KVM_SEV_RECEIVE_UPDATE_DATA:
  2652			r = sev_receive_update_data(kvm, &sev_cmd);
  2653			break;
  2654		case KVM_SEV_RECEIVE_FINISH:
  2655			r = sev_receive_finish(kvm, &sev_cmd);
  2656			break;
  2657		case KVM_SEV_SNP_LAUNCH_START:
  2658			r = snp_launch_start(kvm, &sev_cmd);
  2659			break;
  2660		case KVM_SEV_SNP_LAUNCH_UPDATE:
  2661			r = snp_launch_update(kvm, &sev_cmd);
  2662			break;
  2663		case KVM_SEV_SNP_LAUNCH_FINISH:
  2664			r = snp_launch_finish(kvm, &sev_cmd);
  2665			break;
> 2666		case KVM_SEV_SNP_SET_REQUEST_THROTTLE_RATE_MS:
  2667			r = snp_set_request_throttle_ms(kvm, &sev_cmd);
  2668			break;
  2669		default:
  2670			r = -EINVAL;
  2671			goto out;
  2672		}
  2673	
  2674		if (copy_to_user(argp, &sev_cmd, sizeof(struct kvm_sev_cmd)))
  2675			r = -EFAULT;
  2676	
  2677	out:
  2678		mutex_unlock(&kvm->lock);
  2679		return r;
  2680	}
  2681	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

  parent reply	other threads:[~2025-05-15 18:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-14 18:41 [PATCH v4 0/2] kvm: sev: Add SNP guest request throttling Dionna Glaze
2025-05-14 18:41 ` [PATCH v4 1/2] kvm: sev: Add SEV-SNP " Dionna Glaze
2025-05-14 18:50   ` Dionna Amalie Glaze
2025-05-15 18:21   ` kernel test robot [this message]
2025-05-14 18:41 ` [PATCH v4 2/2] kvm: sev: If ccp is busy, report busy to guest Dionna Glaze
2025-05-14 18:41 ` [PATCH v4 2/2] The ccp driver can be overloaded even with guest request rate limits. The return value of -EBUSY means that there is no firmware error to report back to user space, so the guest VM would see this as exitinfo2 = 0. The false success can trick the guest to update its message sequence number when it shouldn't have Dionna Glaze
2025-05-14 18:47   ` Dionna Amalie Glaze

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202505160203.9PdDhrOM-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=Thomas.Lendacky@amd.com \
    --cc=bp@alien8.de \
    --cc=dionnaglaze@google.com \
    --cc=jroedel@suse.de \
    --cc=kvm@vger.kernel.org \
    --cc=linux-coco@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=pbonzini@redhat.com \
    --cc=pgonda@google.com \
    --cc=seanjc@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).