From: Dave Hansen <dave.hansen@intel.com>
To: Maksym Planeta <maksym@exostellar.io>,
Juergen Gross <jgross@suse.com>,
Boris Ostrovsky <boris.ostrovsky@oracle.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>
Cc: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Grab mm lock before grabbing pt lock
Date: Thu, 5 Dec 2024 10:52:24 -0800 [thread overview]
Message-ID: <24b8d4a0-36c3-4404-98aa-7d8e2c67ac95@intel.com> (raw)
In-Reply-To: <20241204103516.3309112-1-maksym@exostellar.io>
On 12/4/24 02:35, Maksym Planeta wrote:
> Function xen_pin_page calls xen_pte_lock, which in turn grab page
> table lock (ptlock). When locking, xen_pte_lock expect mm->page_table_lock
> to be held before grabbing ptlock, but this does not happen when pinning
> is caused by xen_mm_pin_all.
In changelogs, please indicate functions with parenthesis like this:
func(). It makes it easier to tell what is a function versus a variable
or other text.
The use of init_mm here in the preexisting code is a _bit_ fishy because
these pgds *HAVE* an mm and yet xen_mm_pin_all() passes in '&init_mm'
for them. That's relevant here because locking 'init_mm' obviously
doesn't do any good for other mm's.
I have the _feeling_ it's just a big hack and this code throws caution
tot the wind because of:
> * Expected to be called in stop_machine() ("equivalent to taking
> * every spinlock in the system"), so the locking doesn't really
> * matter all that much.
So the patch here kinda doubles down on the hack and continues the theme
because "locking doesn't really matter all that much."
If so, it's not super satisfying, but it is consistent with the existing
code.
> This commit addresses lockdep warning below, which shows up when
> suspending a Xen VM.
If the comment I quote above is right, this is a _harmless_ warning
because nothing else can race here and the locking that gets added is
useless anyway, right? You seem to agree because there's no cc:stable@
or Fixes: tags.
Either way, I'm hesitant to add incorrect-in-any-other-context and
uncommented locking just to shut up lockdep. Is there no better way?
If not, can we comment it at least, please, so nobody else tries to
duplicate the locking?
next prev parent reply other threads:[~2024-12-05 18:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-04 10:35 Maksym Planeta
2024-12-05 18:52 ` Dave Hansen [this message]
2024-12-09 12:39 ` Maksym Planeta
2024-12-12 8:34 ` Juergen Gross
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=24b8d4a0-36c3-4404-98aa-7d8e2c67ac95@intel.com \
--to=dave.hansen@intel.com \
--cc=boris.ostrovsky@oracle.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=jgross@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maksym@exostellar.io \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
--cc=xen-devel@lists.xenproject.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
all inboxes | Powered by JetHome®