From: "Fabio M. De Francesco" <fmdefrancesco@gmail.com>
To: Stefano Garzarella <sgarzare@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>,
virtualization@lists.linux-foundation.org,
Andrey Zhadchenko <andrey.zhadchenko@virtuozzo.com>,
eperezma@redhat.com, netdev@vger.kernel.org, stefanha@redhat.com,
linux-kernel@vger.kernel.org,
"Michael S. Tsirkin" <mst@redhat.com>,
kvm@vger.kernel.org
Subject: Re: [PATCH v2 3/8] vringh: replace kmap_atomic() with kmap_local_page()
Date: Thu, 16 Mar 2023 10:25:12 +0100 [thread overview]
Message-ID: <2155970.irdbgypaU6@suse> (raw)
In-Reply-To: <CAGxU2F4k-UHxHxpLcsvKvJdvcXfb3WpV+wU=8ZpnJwMNkx0rdA@mail.gmail.com>
On giovedì 16 marzo 2023 09:09:29 CET Stefano Garzarella wrote:
> On Wed, Mar 15, 2023 at 10:12 PM Fabio M. De Francesco
>
> <fmdefrancesco@gmail.com> wrote:
> > On martedì 14 marzo 2023 04:56:08 CET Jason Wang wrote:
> > > On Thu, Mar 2, 2023 at 7:34 PM Stefano Garzarella <sgarzare@redhat.com>
> >
> > wrote:
> > > > kmap_atomic() is deprecated in favor of kmap_local_page().
> > >
> > > It's better to mention the commit or code that introduces this.
> > >
> > > > With kmap_local_page() the mappings are per thread, CPU local, can
take
> > > > page-faults, and can be called from any context (including
interrupts).
> > > > Furthermore, the tasks can be preempted and, when they are scheduled
to
> > > > run again, the kernel virtual addresses are restored and still valid.
> > > >
> > > > kmap_atomic() is implemented like a kmap_local_page() which also
> > > > disables
> > > > page-faults and preemption (the latter only for !PREEMPT_RT kernels,
> > > > otherwise it only disables migration).
> > > >
> > > > The code within the mappings/un-mappings in getu16_iotlb() and
> > > > putu16_iotlb() don't depend on the above-mentioned side effects of
> > > > kmap_atomic(),
> > >
> > > Note we used to use spinlock to protect simulators (at least until
> > > patch 7, so we probably need to re-order the patches at least) so I
> > > think this is only valid when:
> > >
> > > The vringh IOTLB helpers are not used in atomic context (e.g spinlock,
> > > interrupts).
> >
> > I'm probably missing some context but it looks that you are saying that
> > kmap_local_page() is not suited for any use in atomic context (you are
> > mentioning spinlocks).
> >
> > The commit message (that I know pretty well since it's the exact copy,
word
> > by word, of my boiler plate commits)
>
> I hope it's not a problem for you, should I mention it somehow?
Sorry, I had missed your last message when I wrote a another message few
minutes ago in this thread.
Obviously, I'm happy that my commit message it's being reused. As I said in
the other message I would appreciate some kind of crediting me as the author.
I proposed a means you can use, but feel free to ignore my suggestion and do
differently if you prefer to.
Again thanks,
Fabio
> I searched for the last commits that made a similar change and found
> yours that explained it perfectly ;-)
>
> Do I need to rephrase?
>
> > explains that kmap_local_page() is perfectly
> > usable in atomic context (including interrupts).
> >
> > I don't know this code, however I am not able to see why these vringh
IOTLB
> > helpers cannot work if used under spinlocks. Can you please elaborate a
> > little more?
> >
> > > If yes, should we document this? (Or should we introduce a boolean to
> > > say whether an IOTLB variant can be used in an atomic context)?
> >
> > Again, you'll have no problems from the use of kmap_local_page() and so
you
> > don't need any boolean to tell whether or not the code is running in
atomic
> > context.
> >
> > Please take a look at the Highmem documentation which has been recently
> > reworked and extended by me: https://docs.kernel.org/mm/highmem.html
> >
> > Anyway, I have been ATK 12 or 13 hours in a row. So I'm probably missing
the
> > whole picture.
>
> Thanks for your useful info!
> Stefano
next prev parent reply other threads:[~2023-03-16 9:25 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-02 11:34 [PATCH v2 0/8] vdpa_sim: add support for user VA Stefano Garzarella
2023-03-02 11:34 ` [PATCH v2 1/8] vdpa: add bind_mm/unbind_mm callbacks Stefano Garzarella
2023-03-14 3:39 ` Jason Wang
2023-03-16 8:17 ` Stefano Garzarella
2023-03-02 11:34 ` [PATCH v2 2/8] vhost-vdpa: use bind_mm/unbind_mm device callbacks Stefano Garzarella
2023-03-14 3:48 ` Jason Wang
2023-03-16 8:31 ` Stefano Garzarella
2023-03-16 10:11 ` Stefano Garzarella
2023-03-02 11:34 ` [PATCH v2 3/8] vringh: replace kmap_atomic() with kmap_local_page() Stefano Garzarella
2023-03-14 3:56 ` Jason Wang
2023-03-15 21:12 ` Fabio M. De Francesco
2023-03-16 2:53 ` Jason Wang
2023-03-16 8:09 ` Stefano Garzarella
2023-03-16 9:25 ` Fabio M. De Francesco [this message]
2023-03-16 9:13 ` Fabio M. De Francesco
2023-03-16 9:17 ` Stefano Garzarella
2023-03-02 11:34 ` [PATCH v2 4/8] vringh: support VA with iotlb Stefano Garzarella
2023-03-03 14:38 ` Eugenio Perez Martin
2023-03-07 9:31 ` Stefano Garzarella
2023-03-16 16:07 ` Stefano Garzarella
2023-03-17 2:53 ` Jason Wang
2023-03-17 9:49 ` Eugenio Perez Martin
2023-03-17 11:25 ` Stefano Garzarella
2023-03-14 4:53 ` Jason Wang
2023-03-16 8:38 ` Stefano Garzarella
2023-03-02 11:34 ` [PATCH v2 5/8] vdpa_sim: make devices agnostic for work management Stefano Garzarella
2023-03-03 14:40 ` Eugenio Perez Martin
2023-03-14 5:27 ` Jason Wang
2023-03-02 11:34 ` [PATCH v2 6/8] vdpa_sim: use kthread worker Stefano Garzarella
2023-03-02 15:30 ` Simon Horman
2023-03-02 15:48 ` Stefano Garzarella
2023-03-05 11:21 ` kernel test robot
2023-03-14 5:31 ` Jason Wang
2023-03-02 11:34 ` [PATCH v2 7/8] vdpa_sim: replace the spinlock with a mutex to protect the state Stefano Garzarella
2023-03-14 5:29 ` Jason Wang
2023-03-14 5:31 ` Jason Wang
2023-03-16 8:42 ` Stefano Garzarella
2023-03-02 11:34 ` [PATCH v2 8/8] vdpa_sim: add support for user VA Stefano Garzarella
2023-03-14 5:36 ` Jason Wang
2023-03-16 9:11 ` Stefano Garzarella
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=2155970.irdbgypaU6@suse \
--to=fmdefrancesco@gmail.com \
--cc=andrey.zhadchenko@virtuozzo.com \
--cc=eperezma@redhat.com \
--cc=jasowang@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=sgarzare@redhat.com \
--cc=stefanha@redhat.com \
--cc=virtualization@lists.linux-foundation.org \
/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