From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752015AbcF0OBl (ORCPT ); Mon, 27 Jun 2016 10:01:41 -0400 Received: from mail-io0-f193.google.com ([209.85.223.193]:33275 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751634AbcF0OBk (ORCPT ); Mon, 27 Jun 2016 10:01:40 -0400 Date: Mon, 27 Jun 2016 22:05:40 +0800 From: Boqun Feng To: Pan Xinhui 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 Message-ID: <20160627140540.GA19108@insomnia> 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> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="AhhlLboLdkugWU4S" Content-Disposition: inline In-Reply-To: <1467049290-32359-2-git-send-email-xinhui.pan@linux.vnet.ibm.com> User-Agent: Mutt/1.6.1 (2016-04-27) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --AhhlLboLdkugWU4S Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 >=20 > for kernel users, we could use bool vcpu_is_preempted(int cpu) to detech > if one vcpu is preempted or not. >=20 > The default implementation is a macrodefined by false. So compiler can > wrap it out if arch dose not support such vcpu pteempted check. >=20 > archs can implement it by define arch_vcpu_is_preempted(). >=20 > Signed-off-by: Pan Xinhui > --- > include/linux/sched.h | 9 +++++++++ > 1 file changed, 9 insertions(+) >=20 > 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) > =20 > #endif /* CONFIG_SMP */ > =20 > +#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(). Regards, Boqun > extern long sched_setaffinity(pid_t pid, const struct cpumask *new_mask); > extern long sched_getaffinity(pid_t pid, struct cpumask *mask); > =20 > --=20 > 2.4.11 >=20 --AhhlLboLdkugWU4S Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAABCAAGBQJXcTKeAAoJEEl56MO1B/q4tVcIAKHcKyQ2OQl4rQNL9SRTjkBX 08ZNF9oytmzS4VkgaSPuuM5YJg80pQ6ikFfWODjRj1oqD1Fgh1f1x9QfujCLMWFw zW64t9FHqajLjKMp/GtwMvTffsYxLj6wN9khrQuOY5ZaeVaEpRHhuqEUQdUZunkM SrELOSlW1A5hBhDKqWkIiGuwMYO1KKqzCkAgrjy66oAoRjtaZ451R3y2bG188F7K FbBGGo6ZufD/2KE4lUZfDvpbIDJ52iU71LTcT/E5wCcCK8HzhakMx0gHod/+eUP6 6j5fWbSWAZhfLjRQr76nJgWE8gvO9fmF2a7FjXl6xP5o2GBEeK/QzhXZIM3Ox+4= =4hgI -----END PGP SIGNATURE----- --AhhlLboLdkugWU4S--