All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: kvm-ppc@vger.kernel.org
Subject: Re: [bug report] KVM: PPC: Book3S HV: Outline of KVM-HV HPT resizing implementation
Date: Wed, 15 Feb 2017 03:45:25 +0000	[thread overview]
Message-ID: <20170215034525.GG12369@umbus.fritz.box> (raw)
In-Reply-To: <20170211051425.GA16625@mwanda>

[-- Attachment #1: Type: text/plain, Size: 2410 bytes --]

On Sat, Feb 11, 2017 at 08:14:25AM +0300, Dan Carpenter wrote:
> Hello David Gibson,
> 
> The patch 5e9859699aba: "KVM: PPC: Book3S HV: Outline of KVM-HV HPT
> resizing implementation" from Dec 20, 2016, leads to the following
> static checker warning:
> 
> 	arch/powerpc/kvm/book3s_64_mmu_hv.c:1554 kvm_vm_ioctl_resize_hpt_commit()
> 	error: we previously assumed 'resize' could be null (see line
> 	1532)

Nice catch, thanks.  I've sent a patch for this.

> 
> arch/powerpc/kvm/book3s_64_mmu_hv.c
>   1514          mutex_lock(&kvm->lock);
>   1515  
>   1516          resize = kvm->arch.resize_hpt;
>   1517  
>   1518          /* This shouldn't be possible */
>   1519          ret = -EIO;
>   1520          if (WARN_ON(!kvm->arch.hpte_setup_done))
>   1521                  goto out_no_hpt;
>   1522  
>   1523          /* Stop VCPUs from running while we mess with the HPT */
>   1524          kvm->arch.hpte_setup_done = 0;
>   1525          smp_mb();
>   1526  
>   1527          /* Boot all CPUs out of the guest so they re-read
>   1528           * hpte_setup_done */
>   1529          on_each_cpu(resize_hpt_boot_vcpu, NULL, 1);
>   1530  
>   1531          ret = -ENXIO;
>   1532          if (!resize || (resize->order != shift))
>                      ^^^^^^
> Check.
> 
>   1533                  goto out;
>   1534  
>   1535          ret = -EBUSY;
>   1536          if (!resize->prepare_done)
>   1537                  goto out;
>   1538  
>   1539          ret = resize->error;
>   1540          if (ret != 0)
>   1541                  goto out;
>   1542  
>   1543          ret = resize_hpt_rehash(resize);
>   1544          if (ret != 0)
>   1545                  goto out;
>   1546  
>   1547          resize_hpt_pivot(resize);
>   1548  
>   1549  out:
>   1550          /* Let VCPUs run again */
>   1551          kvm->arch.hpte_setup_done = 1;
>   1552          smp_mb();
>   1553  out_no_hpt:
>   1554          resize_hpt_release(kvm, resize);
>                                         ^^^^^^
> Oops.
> 
>   1555          mutex_unlock(&kvm->lock);
>   1556          return ret;
>   1557  }
> 
> regards,
> dan carpenter
> 

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

      reply	other threads:[~2017-02-15  3:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-11  5:14 [bug report] KVM: PPC: Book3S HV: Outline of KVM-HV HPT resizing implementation Dan Carpenter
2017-02-15  3:45 ` David Gibson [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=20170215034525.GG12369@umbus.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=kvm-ppc@vger.kernel.org \
    /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 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.