public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Daniel Axtens <dja@axtens•net>
To: Jordan Niethe <jniethe5@gmail•com>,
	linuxppc-dev@lists•ozlabs.org, christophe.leroy@csgroup•eu
Cc: Jordan Niethe <jniethe5@gmail•com>,
	npiggin@gmail•com, aneesh.kumar@linux•ibm.com
Subject: Re: [PATCH 2/4] powerpc/64s: Remove unneeded #ifdef CONFIG_DEBUG_PAGEALLOC in hash_utils
Date: Fri, 18 Jun 2021 17:49:04 +1000	[thread overview]
Message-ID: <87eeczsjdb.fsf@dja-thinkpad.axtens.net> (raw)
In-Reply-To: <20210517061658.194708-3-jniethe5@gmail.com>

Hi Jordan and Christophe,

> --- a/arch/powerpc/mm/book3s64/hash_utils.c
> +++ b/arch/powerpc/mm/book3s64/hash_utils.c
> @@ -126,11 +126,8 @@ EXPORT_SYMBOL_GPL(mmu_slb_size);
>  #ifdef CONFIG_PPC_64K_PAGES
>  int mmu_ci_restrictions;
>  #endif
> -#ifdef CONFIG_DEBUG_PAGEALLOC
>  static u8 *linear_map_hash_slots;
>  static unsigned long linear_map_hash_count;
> -static DEFINE_SPINLOCK(linear_map_hash_lock);
> -#endif /* CONFIG_DEBUG_PAGEALLOC */
>  struct mmu_hash_ops mmu_hash_ops;
>  EXPORT_SYMBOL(mmu_hash_ops);
>  

> @@ -1944,6 +1937,8 @@ long hpte_insert_repeating(unsigned long hash, unsigned long vpn,
>  }
>  
>  #ifdef CONFIG_DEBUG_PAGEALLOC
> +static DEFINE_SPINLOCK(linear_map_hash_lock);
> +

I had some trouble figuring out why the spinlock has to be in the
ifdef. A bit of investigation suggests that it's only used in functions
that are only defined under CONFIG_DEBUG_PAGEALLOC - unlike the other
variables. So that makes sense.

While I was poking around, I noticed that linear_map_hash_slots is
manipulated under linear_map_hash_lock in kernel_(un)map_linear_page but
is manipulated outside the lock in htab_bolt_mapping(). Is that OK? (I
don't know when htab_bolt_mapping is called, it's possible it's only
called at times where nothing else could be happing to that array.)

Kind regards,
Daniel

>  static void kernel_map_linear_page(unsigned long vaddr, unsigned long lmi)
>  {
>  	unsigned long hash;
> -- 
> 2.25.1

  reply	other threads:[~2021-06-18  7:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-17  6:16 [PATCH 0/4] powerpc/64s: Enable KFENCE Jordan Niethe
2021-05-17  6:16 ` [PATCH 1/4] powerpc/64s: Add DEBUG_PAGEALLOC for radix Jordan Niethe
2021-06-18  7:28   ` Daniel Axtens
2021-05-17  6:16 ` [PATCH 2/4] powerpc/64s: Remove unneeded #ifdef CONFIG_DEBUG_PAGEALLOC in hash_utils Jordan Niethe
2021-06-18  7:49   ` Daniel Axtens [this message]
2021-05-17  6:16 ` [PATCH 3/4] powerpc/64s: Allow double call of kernel_[un]map_linear_page() Jordan Niethe
2021-05-17  6:16 ` [PATCH 4/4] powerpc: Enable KFENCE on BOOK3S/64 Jordan Niethe
2021-06-18  8:00   ` Daniel Axtens
2021-06-18  8:02     ` Daniel Axtens
2021-06-22  8:57   ` Michael Ellerman
  -- strict thread matches above, loose matches on Subject: below --
2022-09-19  1:44 [PATCH 1/4] powerpc/64s: Add DEBUG_PAGEALLOC for radix Nicholas Miehlbradt
2022-09-19  1:44 ` [PATCH 2/4] powerpc/64s: Remove unneeded #ifdef CONFIG_DEBUG_PAGEALLOC in hash_utils Nicholas Miehlbradt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87eeczsjdb.fsf@dja-thinkpad.axtens.net \
    --to=dja@axtens$(echo .)net \
    --cc=aneesh.kumar@linux$(echo .)ibm.com \
    --cc=christophe.leroy@csgroup$(echo .)eu \
    --cc=jniethe5@gmail$(echo .)com \
    --cc=linuxppc-dev@lists$(echo .)ozlabs.org \
    --cc=npiggin@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox