From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752021AbcF1FjP (ORCPT ); Tue, 28 Jun 2016 01:39:15 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:11850 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751941AbcF1FjK (ORCPT ); Tue, 28 Jun 2016 01:39:10 -0400 X-IBM-Helo: d28dlp03.in.ibm.com X-IBM-MailFrom: xinhui.pan@linux.vnet.ibm.com X-IBM-RcptTo: linux-kernel@vger.kernel.org Date: Tue, 28 Jun 2016 13:38:19 +0800 From: xinhui User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0 MIME-Version: 1.0 To: Boqun Feng CC: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, paulmck@linux.vnet.ibm.com, peterz@infradead.org, mingo@redhat.com, mpe@ellerman.id.au, paulus@samba.org, benh@kernel.crashing.org, Waiman.Long@hpe.com, will.deacon@arm.com, dave@stgolabs.net Subject: Re: [PATCH 2/3] powerpc/spinlock: support vcpu preempted check References: <1467049290-32359-1-git-send-email-xinhui.pan@linux.vnet.ibm.com> <1467049290-32359-3-git-send-email-xinhui.pan@linux.vnet.ibm.com> <20160627145832.GB19108@insomnia> <5771F166.5060604@linux.vnet.ibm.com> <20160628050356.GA25008@insomnia> In-Reply-To: <20160628050356.GA25008@insomnia> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16062805-0052-0000-0000-00000288E51D X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16062805-0053-0000-0000-00000D1A40C1 Message-Id: <57720D4B.8090406@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-06-28_03:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1606280051 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2016年06月28日 13:03, Boqun Feng wrote: > On Tue, Jun 28, 2016 at 11:39:18AM +0800, xinhui wrote: > [snip] >>>> +{ >>>> + struct lppaca *lp = &lppaca_of(cpu); >>>> + >>>> + if (unlikely(!(lppaca_shared_proc(lp) || >>>> + lppaca_dedicated_proc(lp)))) >>> >>> Do you want to detect whether we are running in a guest(ie. pseries >>> kernel) here? Then I wonder whether "machine_is(pseries)" works here. >>> >> I tried as you said yesterday. but .h file has dependencies. >> As you said, if we add #ifdef PPC_PSERIES, this is not a big problem. only powernv will be affected as they are built into same kernel img. >> > > I never said this it not a big problem ;-) > > The problem here is that we only need to detect the vcpu preemption in > a guest, and there could be several ways we can detect whether the > kernel is running in a guest. It's worthwhile to try find the best one > for this. Besides, it's really better that you can make sure we are > runing out of options before you introduce something like > lppaca_dedicated_proc(). > > I have a feeling that yield_count is non-zero only if we are running in > a guest, if so, we can use this and save several loads. But surely we > need the confirmation from ppc maintainers. > yes, on powernv, print the lppaca.yield_count and it is always zero. looks like only hypervisor and os can touch/modify it. > Regards, > Boqun >