public inbox for llvm@lists.linux.dev
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Yanfei Xu <yanfei.xu@bytedance.com>, pbonzini@redhat.com
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	kvm@vger.kernel.org, caixiangfeng@bytedance.com,
	fangying.tommy@bytedance.com, yanfei.xu@bytedance.com
Subject: Re: [PATCH] KVM: irqchip: KVM: Reduce allocation overhead in kvm_set_irq_routing()
Date: Thu, 25 Dec 2025 17:34:40 +0800	[thread overview]
Message-ID: <202512251741.UOsoJoam-lkp@intel.com> (raw)
In-Reply-To: <20251224023201.381586-1-yanfei.xu@bytedance.com>

Hi Yanfei,

kernel test robot noticed the following build warnings:

[auto build test WARNING on kvm/queue]
[also build test WARNING on kvm/next linus/master v6.19-rc2 next-20251219]
[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/Yanfei-Xu/KVM-irqchip-KVM-Reduce-allocation-overhead-in-kvm_set_irq_routing/20251224-103451
base:   https://git.kernel.org/pub/scm/virt/kvm/kvm.git queue
patch link:    https://lore.kernel.org/r/20251224023201.381586-1-yanfei.xu%40bytedance.com
patch subject: [PATCH] KVM: irqchip: KVM: Reduce allocation overhead in kvm_set_irq_routing()
config: loongarch-defconfig (https://download.01.org/0day-ci/archive/20251225/202512251741.UOsoJoam-lkp@intel.com/config)
compiler: clang version 19.1.7 (https://github.com/llvm/llvm-project cd708029e0b2869e80abe31ddb175f7c35361f90)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251225/202512251741.UOsoJoam-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/202512251741.UOsoJoam-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> arch/loongarch/kvm/../../../virt/kvm/irqchip.c:190:6: warning: variable 'r' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
     190 |         if (!e)
         |             ^~
   arch/loongarch/kvm/../../../virt/kvm/irqchip.c:233:9: note: uninitialized use occurs here
     233 |         return r;
         |                ^
   arch/loongarch/kvm/../../../virt/kvm/irqchip.c:190:2: note: remove the 'if' if its condition is always false
     190 |         if (!e)
         |         ^~~~~~~
     191 |                 goto out;
         |                 ~~~~~~~~
   arch/loongarch/kvm/../../../virt/kvm/irqchip.c:176:7: note: initialize the variable 'r' to silence this warning
     176 |         int r;
         |              ^
         |               = 0
   1 warning generated.


vim +190 arch/loongarch/kvm/../../../virt/kvm/irqchip.c

   167	
   168	int kvm_set_irq_routing(struct kvm *kvm,
   169				const struct kvm_irq_routing_entry *ue,
   170				unsigned nr,
   171				unsigned flags)
   172	{
   173		struct kvm_irq_routing_table *new, *old;
   174		struct kvm_kernel_irq_routing_entry *e;
   175		u32 i, j, nr_rt_entries = 0;
   176		int r;
   177	
   178		for (i = 0; i < nr; ++i) {
   179			if (ue[i].gsi >= KVM_MAX_IRQ_ROUTES)
   180				return -EINVAL;
   181			nr_rt_entries = max(nr_rt_entries, ue[i].gsi);
   182		}
   183	
   184		nr_rt_entries += 1;
   185	
   186		new = kzalloc(struct_size(new, map, nr_rt_entries), GFP_KERNEL_ACCOUNT);
   187		if (!new)
   188			return -ENOMEM;
   189		e = kcalloc(nr, sizeof(*e), GFP_KERNEL_ACCOUNT);
 > 190		if (!e)
   191			goto out;
   192		new->entries_addr = e;
   193	
   194		new->nr_rt_entries = nr_rt_entries;
   195		for (i = 0; i < KVM_NR_IRQCHIPS; i++)
   196			for (j = 0; j < KVM_IRQCHIP_NUM_PINS; j++)
   197				new->chip[i][j] = -1;
   198	
   199		for (i = 0; i < nr; ++i) {
   200			r = -EINVAL;
   201			switch (ue->type) {
   202			case KVM_IRQ_ROUTING_MSI:
   203				if (ue->flags & ~KVM_MSI_VALID_DEVID)
   204					goto out;
   205				break;
   206			default:
   207				if (ue->flags)
   208					goto out;
   209				break;
   210			}
   211			r = setup_routing_entry(kvm, new, e + i, ue);
   212			if (r)
   213				goto out;
   214			++ue;
   215		}
   216	
   217		mutex_lock(&kvm->irq_lock);
   218		old = rcu_dereference_protected(kvm->irq_routing, 1);
   219		rcu_assign_pointer(kvm->irq_routing, new);
   220		kvm_irq_routing_update(kvm);
   221		kvm_arch_irq_routing_update(kvm);
   222		mutex_unlock(&kvm->irq_lock);
   223	
   224		synchronize_srcu_expedited(&kvm->irq_srcu);
   225	
   226		new = old;
   227		r = 0;
   228		goto out;
   229	
   230	out:
   231		free_irq_routing_table(new);
   232	
   233		return r;
   234	}
   235	

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

      parent reply	other threads:[~2025-12-25  9:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20251224023201.381586-1-yanfei.xu@bytedance.com>
2025-12-24 17:35 ` [PATCH] KVM: irqchip: KVM: Reduce allocation overhead in kvm_set_irq_routing() kernel test robot
2025-12-25  6:04 ` kernel test robot
2025-12-25  9:34 ` kernel test robot [this message]

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=202512251741.UOsoJoam-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=caixiangfeng@bytedance.com \
    --cc=fangying.tommy@bytedance.com \
    --cc=kvm@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=pbonzini@redhat.com \
    --cc=yanfei.xu@bytedance.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