From: "Fabio M. De Francesco" <fmdefrancesco@gmail.com>
To: linux-kernel@vger.kernel.org, linux-sgx@vger.kernel.org,
Jarkko Sakkinen <jarkko@kernel.org>,
Dave Hansen <dave.hansen@linux.intel.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
Kristen Carlson Accardi <kristen@linux.intel.com>,
Dave Hansen <dave.hansen@intel.com>,
ira.weiny@intel.com
Subject: Re: [PATCH] x86/sgx: Replace kmap/kunmap_atomic calls
Date: Fri, 07 Oct 2022 00:02:42 +0200 [thread overview]
Message-ID: <8124835.T7Z3S40VBb@mypc> (raw)
In-Reply-To: <d64e6e9f-27b9-9bbb-aaf8-fca1681eada5@intel.com>
On Thursday, October 6, 2022 10:45:56 PM CEST Dave Hansen wrote:
> On 10/6/22 13:37, Fabio M. De Francesco wrote:
> > kmap() were not suited in those cases because it might sleep. If the
intents
> > of the author are simply map a page while in atomic, so to avoid sleeping
in
> > atomic bugs, your conversions looks good.
> >
> > For the reasons above, can you please say something more about why this
code
> > needed a kmap_atomic() instead of calling kmap()?
>
> This question is backwards. kmap_atomic() is the default that folks
> use.
Sorry, I can't understand why kmap_atomic() is the default. What advantage we
get from disabling pagefaults and probably also preemption (it depends on !
PREEMPT_RT also when we don't need that the kernel runs in atomic?
Do you mean that the more code run in atomic, the less pagefaults we allow,
the less preemption we allow, and so on, the better we get from Linux?
Do you remember that what I say above happens both on 64 bits systems as well
as in 32 bits?
I'm a newcomer so I may be wrong, however I think that in 64 bits systems we
gain from simply returning page_address() and from finer granularity
(less atomic, less critical sections, instead more preemption and / or
migration).
Why shouldn't be kmap() the default choice in a preemptible kernel if sections
don't need that disabling of pagefaults, along with preemption (which get
disabled many more times that only migration)?
Am I still missing anything fundamental?
> You use kmap_atomic() *always* unless you _need_ to sleep or one
> of the other kmap()-only things.
What would happen if you rely on switching in atomic as a side effect of
kmap_atomic() and then you convert to kmap_local_page() without explicitly
disabling, for example, preemption since who converts don't care to know if
the code is in atomic before calling kmap_atomic() before or after the call
(as I said there may be cases where non atomic execution must disable
preemption for some reasons only between the mapping and the unmapping?
If I were a maintainer I wouldn't trust changes that let me think that the
developer can't tell if we need to disable something while converting to
kmap_local_page().
I hope this time I've been to convey more clearly my thoughts. I'm sorry for
my scarce knowledge of English.
Thanks,
Fabio
>
> Folks don't and shouldn't have to explain why this was using kmap_atomic().
>
next prev parent reply other threads:[~2022-10-06 22:02 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-29 16:06 [PATCH] x86/sgx: Replace kmap/kunmap_atomic calls Kristen Carlson Accardi
2022-09-30 21:55 ` Jarkko Sakkinen
2022-10-06 20:37 ` Fabio M. De Francesco
2022-10-06 20:45 ` Dave Hansen
2022-10-06 21:26 ` Ira Weiny
2022-10-06 22:02 ` Fabio M. De Francesco [this message]
2022-10-06 22:29 ` Dave Hansen
2022-10-06 23:17 ` Ira Weiny
2022-10-07 15:23 ` Ira Weiny
2022-10-12 7:15 ` Jarkko Sakkinen
2022-10-12 7:26 ` Jarkko Sakkinen
2022-10-12 14:13 ` Dave Hansen
2022-10-12 14:50 ` Jarkko Sakkinen
2022-10-12 15:50 ` Jarkko Sakkinen
2022-10-13 16:03 ` Kristen Carlson Accardi
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=8124835.T7Z3S40VBb@mypc \
--to=fmdefrancesco@gmail.com \
--cc=bp@alien8.de \
--cc=dave.hansen@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=ira.weiny@intel.com \
--cc=jarkko@kernel.org \
--cc=kristen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sgx@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.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;
as well as URLs for NNTP newsgroup(s).