From: Alistair Popple <alistair@popple.id.au>
To: Balbir Singh <bsingharora@gmail.com>
Cc: Mark Hairgrove <mhairgrove@nvidia.com>,
mpe@ellerman.id.au, linuxppc-dev@lists.ozlabs.org,
Javier Cabezas <jcabezas@nvidia.com>
Subject: Re: [PATCH] powerpc/npu-dma.c: Fix deadlock in mmio_invalidate
Date: Mon, 19 Feb 2018 16:02:52 +1100 [thread overview]
Message-ID: <1563550.Ytkt8OtJkB@new-mexico> (raw)
In-Reply-To: <20180219135704.3bd0cfb9@balbir.ozlabs.ibm.com>
> > Shouldn't that be enforced with READ_ONCE() then?
Yep, I can add that.
> Good point, although I think the acquire_* function itself may be called
> from a higher layer with the mmap_sem always held. I wonder if we need
> barriers around get and put mmio_atsd_reg.
test_and_set_bit() should imply a memory barrier so I don't think we need one
there (and looking at the implementation there is one). clear_bit() might need
one though. For that I guess I could use clear_bit_unlock()? There is also a
matching test_and_set_bit_lock() so I will submit a v2 which uses those instead
given we are using these like a lock.
> > > I don't think we can as the invalidate_range() function is called under the ptl
> > > spin-lock and is not allowed to sleep (at least according to
> > > include/linux/mmu_notifier.h).
>
> I double checked, It's the reverse
>
> /*
> * If both of these callbacks cannot block, mmu_notifier_ops.flags
> * should have MMU_INVALIDATE_DOES_NOT_BLOCK set.
> */
Argh, that must have been merged during the current window. Thanks for pointing
out - I will submit a seperate patch to update the mmu_notifier_ops.flags to set
MMU_INVALIDATE_DOES_NOT_BLOCK.
- Alistair
> void (*invalidate_range_start)(struct mmu_notifier *mn,
> struct mm_struct *mm,
> unsigned long start, unsigned long end);
> void (*invalidate_range_end)(struct mmu_notifier *mn,
> struct mm_struct *mm,
> unsigned long start, unsigned long end);
> > >
> > > - Alistair
> > >
> > > > Balbir
> > > >
> > >
> > >
> > >
>
> I think it looks good to me otherwise,
>
> Balbir Singh.
>
next prev parent reply other threads:[~2018-02-19 5:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-13 3:17 [PATCH] powerpc/npu-dma.c: Fix deadlock in mmio_invalidate Alistair Popple
2018-02-13 6:06 ` Balbir Singh
2018-02-14 3:23 ` Alistair Popple
2018-02-16 3:11 ` Mark Hairgrove
2018-02-19 2:57 ` Balbir Singh
2018-02-19 5:02 ` Alistair Popple [this message]
2018-02-20 18:34 ` Mark Hairgrove
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=1563550.Ytkt8OtJkB@new-mexico \
--to=alistair@popple.id.au \
--cc=bsingharora@gmail.com \
--cc=jcabezas@nvidia.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mhairgrove@nvidia.com \
--cc=mpe@ellerman.id.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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