Re: [PATCH v4 1/1] KVM: trigger uevents when creating or destroying a VM

From: kbuild test robot
Date: Tue Jul 11 2017 - 21:04:32 EST


Hi Claudio,

[auto build test ERROR on kvm/linux-next]
[also build test ERROR on v4.12 next-20170711]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Claudio-Imbrenda/KVM-trigger-uevents-when-creating-or-destroying-a-VM/20170712-023748
base: https://git.kernel.org/pub/scm/virt/kvm/kvm.git linux-next
config: powerpc-defconfig (attached as .config)
compiler: powerpc64-linux-gnu-gcc (Debian 6.3.0-18) 6.3.0 20170516
reproduce:
wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=powerpc

All errors (new ones prefixed by >>):

arch/powerpc/kvm/../../../virt/kvm/kvm_main.c: In function 'kvm_uevent_notify_change':
>> arch/powerpc/kvm/../../../virt/kvm/kvm_main.c:3892:24: error: 'struct mm_struct' has no member named 'owner'
if (kvm->mm && kvm->mm->owner) {
^~
arch/powerpc/kvm/../../../virt/kvm/kvm_main.c:3893:40: error: 'struct mm_struct' has no member named 'owner'
add_uevent_var(env, "PID=%d", kvm->mm->owner->pid);
^~

vim +3892 arch/powerpc/kvm/../../../virt/kvm/kvm_main.c

3864
3865 static void kvm_uevent_notify_change(unsigned int type, struct kvm *kvm)
3866 {
3867 struct kobj_uevent_env *env;
3868 char *tmp, *pathbuf = NULL;
3869 unsigned long long created, active;
3870
3871 if (!kvm_dev.this_device || !kvm)
3872 return;
3873
3874 spin_lock(&kvm_lock);
3875 if (type == KVM_EVENT_CREATE_VM) {
3876 kvm_createvm_count++;
3877 kvm_active_vms++;
3878 } else if (type == KVM_EVENT_DESTROY_VM) {
3879 kvm_active_vms--;
3880 }
3881 created = kvm_createvm_count;
3882 active = kvm_active_vms;
3883 spin_unlock(&kvm_lock);
3884
3885 env = kzalloc(sizeof(*env), GFP_KERNEL);
3886 if (!env)
3887 return;
3888
3889 add_uevent_var(env, "CREATED=%llu", created);
3890 add_uevent_var(env, "COUNT=%llu", active);
3891
> 3892 if (kvm->mm && kvm->mm->owner) {
3893 add_uevent_var(env, "PID=%d", kvm->mm->owner->pid);
3894 } else if (kvm->debugfs_dentry) {
3895 char p[ITOA_MAX_LEN];
3896
3897 snprintf(p, sizeof(p), "%s", kvm->debugfs_dentry->d_name.name);
3898 tmp = strchrnul(p + 1, '-');
3899 *tmp = '\0';
3900 add_uevent_var(env, "PID=%s", p);
3901 }
3902
3903 if (type == KVM_EVENT_CREATE_VM)
3904 add_uevent_var(env, "EVENT=create");
3905 else if (type == KVM_EVENT_DESTROY_VM)
3906 add_uevent_var(env, "EVENT=destroy");
3907
3908 if (kvm->debugfs_dentry) {
3909 pathbuf = kmalloc(PATH_MAX, GFP_KERNEL);
3910 if (pathbuf) {
3911 /* sizeof counts the final '\0' */
3912 int len = sizeof("STATS_PATH=") - 1;
3913 const char *pvar = "STATS_PATH=";
3914
3915 tmp = dentry_path_raw(kvm->debugfs_dentry,
3916 pathbuf + len,
3917 PATH_MAX - len);
3918 if (!IS_ERR(tmp)) {
3919 memcpy(tmp - len, pvar, len);
3920 env->envp[env->envp_idx++] = tmp - len;
3921 }
3922 }
3923 }
3924 /* no need for checks, since we are adding at most only 5 keys */
3925 env->envp[env->envp_idx++] = NULL;
3926 kobject_uevent_env(&kvm_dev.this_device->kobj, KOBJ_CHANGE, env->envp);
3927 kfree(env);
3928 kfree(pathbuf);
3929 }
3930

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip