From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Gibson Subject: Re: [PATCH 1/2] KVM: PPC: Book3S HV: Make use of unused threads when running guests Date: Tue, 2 Jun 2015 16:29:56 +1000 Message-ID: <20150602062956.GI3186@voom.fritz.box> References: <1432790240-28679-1-git-send-email-paulus@samba.org> <1432790240-28679-2-git-send-email-paulus@samba.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="u/L2/WlOHZg+YGU4" Cc: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, Alexander Graf To: Paul Mackerras Return-path: Content-Disposition: inline In-Reply-To: <1432790240-28679-2-git-send-email-paulus@samba.org> Sender: kvm-ppc-owner@vger.kernel.org List-Id: kvm.vger.kernel.org --u/L2/WlOHZg+YGU4 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, May 28, 2015 at 03:17:19PM +1000, Paul Mackerras wrote: > When running a virtual core of a guest that is configured with fewer > threads per core than the physical cores have, the extra physical > threads are currently unused. This makes it possible to use them to > run one or more other virtual cores from the same guest when certain > conditions are met. This applies on POWER7, and on POWER8 to guests > with one thread per virtual core. (It doesn't apply to POWER8 guests > with multiple threads per vcore because they require a 1-1 virtual to > physical thread mapping in order to be able to use msgsndp and the > TIR.) >=20 > The idea is that we maintain a list of preempted vcores for each > physical cpu (i.e. each core, since the host runs single-threaded). > Then, when a vcore is about to run, it checks to see if there are > any vcores on the list for its physical cpu that could be > piggybacked onto this vcore's execution. If so, those additional > vcores are put into state VCORE_PIGGYBACK and their runnable VCPU > threads are started as well as the original vcore, which is called > the master vcore. >=20 > After the vcores have exited the guest, the extra ones are put back > onto the preempted list if any of their VCPUs are still runnable and > not idle. >=20 > This means that vcpu->arch.ptid is no longer necessarily the same as > the physical thread that the vcpu runs on. In order to make it easier > for code that wants to send an IPI to know which CPU to target, we > now store that in a new field in struct vcpu_arch, called thread_cpu. >=20 > Signed-off-by: Paul Mackerras Reviewed-by: David Gibson --=20 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 --u/L2/WlOHZg+YGU4 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJVbU1jAAoJEGw4ysog2bOSzMsP/0Jt/sFRGpYxOfkJFCcDnZmL TrrohkOGZixWE1takxq5zdt3I62hvYC3vDWorXbzdjLE1k+ZhshcBQUhpmWsUPyX WldfD7VJ0dLRQFjqsdjdiqDRsgXJw7C4aTrxnE30FOFUCrmuc/SvdLFOFheuNeRJ 388C9vDHGr9WThT2KnlVFyKmPCH1xHJah4YL1DiJZxXJzyBMiew7tYgZHGsmZ6Xi 2z2FNO5bCai/zO1nL68tQrCQybyqX/AWUBwJH/dLl4c+T33tSM/9k5VNEPwQk3oe /HYy1QUElklv9xXPta+JBVGUYmHCTfA3Tt5tiQ/S8uhcUYpkKIBUmfNKCR1FH6qg PYQ8N7MorxtwHP0tmULsEiDt20UPfU4hTjCTw6Pgg8D8BYo8w+rz06+hsz+mIKk5 4TBIfhwkp0WiK6uK5kB9MJxYPm+SnXZ9el6cHj4rl+pPv6ghz6+o+RljHmtZsFeF JZfi816CV+Hijk+gy6YHpH10BySCJBzZ5/GkuhscEuyhhPzFBeTF1Mkz7G+iSDmZ CnvgMTrPBCt4QdDgDwxgxl8SpanWNukUHCCHRvG9q595RWOjabn1p58tAeDa4VCr sxfTxhtcGLsJkjZyV/BBw3/PbwgFvfVjAUlbab+wStZ0gA5NfGBnEmZbzQcx/QnT gwjbjOef2Fo9izFZHemr =0GML -----END PGP SIGNATURE----- --u/L2/WlOHZg+YGU4--