From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752060AbcF1DQ1 (ORCPT ); Mon, 27 Jun 2016 23:16:27 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:25915 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751740AbcF1DQ0 (ORCPT ); Mon, 27 Jun 2016 23:16:26 -0400 X-IBM-Helo: d23dlp01.au.ibm.com X-IBM-MailFrom: xinhui.pan@linux.vnet.ibm.com X-IBM-RcptTo: linux-kernel@vger.kernel.org Date: Tue, 28 Jun 2016 11:15:51 +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 1/3] kernel/sched: introduce vcpu preempted check interface References: <1467049290-32359-1-git-send-email-xinhui.pan@linux.vnet.ibm.com> <1467049290-32359-2-git-send-email-xinhui.pan@linux.vnet.ibm.com> <20160627140540.GA19108@insomnia> In-Reply-To: <20160627140540.GA19108@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: 16062803-0040-0000-0000-000001BA358C X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16062803-0041-0000-0000-000009F79341 Message-Id: <5771EBE7.3060201@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-06-28_02:,, 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-1606280029 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2016年06月27日 22:05, Boqun Feng wrote: > On Mon, Jun 27, 2016 at 01:41:28PM -0400, Pan Xinhui wrote: >> this supports to fix lock holder preempted issue which run as a guest >> >> for kernel users, we could use bool vcpu_is_preempted(int cpu) to detech >> if one vcpu is preempted or not. >> >> The default implementation is a macrodefined by false. So compiler can >> wrap it out if arch dose not support such vcpu pteempted check. >> >> archs can implement it by define arch_vcpu_is_preempted(). >> >> Signed-off-by: Pan Xinhui >> --- >> include/linux/sched.h | 9 +++++++++ >> 1 file changed, 9 insertions(+) >> >> diff --git a/include/linux/sched.h b/include/linux/sched.h >> index 6e42ada..dc0a9c3 100644 >> --- a/include/linux/sched.h >> +++ b/include/linux/sched.h >> @@ -3293,6 +3293,15 @@ static inline void set_task_cpu(struct task_struct *p, unsigned int cpu) >> >> #endif /* CONFIG_SMP */ >> >> +#ifdef arch_vcpu_is_preempted >> +static inline bool vcpu_is_preempted(int cpu) >> +{ >> + return arch_vcpu_is_preempted(cpu); >> +} >> +#else >> +#define vcpu_is_preempted(cpu) false >> +#endif >> + > > I think you are missing Peter's comment here. We can > > #ifndef vcpu_is_preempted > #define vcpu_is_preempted(cpu) fasle > #endif > > And different archs implement their own versions of vcpu_is_preempted(), > IOW, no need for an arch_vcpu_is_preempted(). > yes, right. just vcpu_is_preempted, no arch_vcpu_is_preempted.. thanks > Regards, > Boqun > >> extern long sched_setaffinity(pid_t pid, const struct cpumask *new_mask); >> extern long sched_getaffinity(pid_t pid, struct cpumask *mask); >> >> -- >> 2.4.11 >>