Subject: Re: [RFCv2 7/9] pseries: Add support for hash table resizing

From: David Gibson <[email-masked]>
Date: Mon, 1 Feb 2016 22:04:11 +1100

On Mon, Feb 01, 2016 at 02:01:09PM +0530, Anshuman Khandual wrote:
> On 01/29/2016 10:54 AM, David Gibson wrote:
> 
> > +
> > +static int pseries_lpar_resize_hpt_commit(void *data)
> > +{
> > +	struct hpt_resize_state *state = data;
> > +
> > +	state->commit_rc = plpar_resize_hpt_commit(0, state->shift);
> > +	if (state->commit_rc != H_SUCCESS)
> > +		return -EIO;
> > +
> > +	/* Hypervisor has transitioned the HTAB, update our globals */
> > +	ppc64_pft_size = state->shift;
> > +	htab_size_bytes = 1UL << ppc64_pft_size;
> > +	htab_hash_mask = (htab_size_bytes >> 7) - 1;
> > +
> > +	return 0;
> > +}
> > +
> 
> snip
> 
> > +/* Must be called in user context */
> > +static int pseries_lpar_resize_hpt(unsigned long shift)
> > +{
> > +	struct hpt_resize_state state = {
> > +		.shift = shift,
> > +		.commit_rc = H_FUNCTION,
> 
> > +
> > +	rc = stop_machine(pseries_lpar_resize_hpt_commit, &state, NULL);
> 
> With my limited knowledge of stop_machine, wondering if the current
> or any future version of 'pseries_lpar_resize_hpt_commit' function
> can cause HPT change (page fault path) while stop is executing it.

It can, but the H_RESIZE_HPT_COMMIT hypercall is synchronous so the
cpu executing it can't make any HPT updates during it.  The
stop_machine() prevents any other cpus doing HPT updates.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson