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]
Date:   Wed, 8 Sep 2021 10:47:16 -0400
From:   Boris Ostrovsky <boris.ostrovsky@...cle.com>
To:     Juergen Gross <jgross@...e.com>, xen-devel@...ts.xenproject.org,
        linux-kernel@...r.kernel.org
Cc:     Stefano Stabellini <sstabellini@...nel.org>,
        Jan Beulich <jbeulich@...e.com>
Subject: Re: [PATCH] xen/balloon: use a kernel thread instead a workqueue


On 8/27/21 8:32 AM, Juergen Gross wrote:
> +static bool balloon_thread_cond(enum bp_state state, long credit)
> +{
> +	if (state != BP_EAGAIN)
> +		credit = 0;
> +
> +	return current_credit() != credit || kthread_should_stop();
> +}
> +
> +/*
> + * As this is a kthread it is guaranteed to run as a single instance only.
>   * We may of course race updates of the target counts (which are protected
>   * by the balloon lock), or with changes to the Xen hard limit, but we will
>   * recover from these in time.
>   */
> -static void balloon_process(struct work_struct *work)
> +static int balloon_thread(void *unused)
>  {
>  	enum bp_state state = BP_DONE;
>  	long credit;
> +	unsigned long timeout;
> +
> +	set_freezable();
> +	for (;;) {
> +		if (state == BP_EAGAIN)
> +			timeout = balloon_stats.schedule_delay * HZ;
> +		else
> +			timeout = 3600 * HZ;
> +		credit = current_credit();
>  
> +		wait_event_interruptible_timeout(balloon_thread_wq,
> +				 balloon_thread_cond(state, credit), timeout);


Given that wait_event_interruptible_timeout() is a bunch of nested macros do we need to worry here about overly aggressive compiler optimizing out 'credit = current_credit()'?


-boris


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ