lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160627084250.GZ30154@twins.programming.kicks-ass.net>
Date:	Mon, 27 Jun 2016 10:42:50 +0200
From:	Peter Zijlstra <peterz@...radead.org>
To:	Pan Xinhui <xinhui.pan@...ux.vnet.ibm.com>
Cc:	linux-kernel@...r.kernel.org, mingo@...hat.com,
	boqun.feng@...il.com
Subject: Re: [PATCH 1/2] kernel/sched: introduce vcpu preempted interface

On Sun, Jun 26, 2016 at 06:41:54AM -0400, Pan Xinhui wrote:

> +#ifdef arch_vcpu_is_preempted
> +static inline bool vcpu_is_preempted(int cpu)
> +{
> +	return arch_vcpu_is_preempted(cpu);
> +}
> +#else
> +static inline bool vcpu_is_preempted(int cpu)
> +{
> +	return 0;
> +}
> +#endif
> +
> +#ifdef arch_vcpu_get_yield_count
> +static inline unsigned int vcpu_get_yield_count(int cpu)
> +{
> +	return arch_vcpu_get_yield_count(cpu);
> +}
> +#else
> +static inline unsigned int vcpu_get_yield_count(int cpu)
> +{
> +	return 0;
> +}
> +#endif


Please, just do something like:

#ifndef vcpu_is_preempted
static inline bool vcpu_is_preempted(int cpu)
{
	return false;
}
#endif

No point in making it more complicated.

> +static inline bool
> +need_yield_to(int vcpu, unsigned int old_yield_count)

namespace... this thing should be called: vcpu_something()

> +{
> +	/* if we find the vcpu is preempted,
> +	* then we may want to kick it, IOW, yield to it
> +	*/
> +	return vcpu_is_preempted(vcpu) ||
> +		(vcpu_get_yield_count(vcpu) != old_yield_count);
> +}

And can you make doubly sure (and mention in the Changelog) that the OSQ
code compiles all this away when using these definitions.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ