From: "Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
"Roger Pau Monné" <roger.pau@citrix.com>,
xen-devel@lists.xenproject.org
Subject: Re: [PATCH v5 2/3] x86/mm: add API for marking only part of a MMIO page read only
Date: Mon, 22 Jul 2024 15:38:25 +0200 [thread overview]
Message-ID: <Zp5g0hflalnM1bfa@mail-itl> (raw)
In-Reply-To: <767482e3-3132-4a7f-81ba-6ce0ebea675e@suse.com>
[-- Attachment #1: Type: text/plain, Size: 1487 bytes --]
On Mon, Jul 22, 2024 at 03:01:45PM +0200, Jan Beulich wrote:
> On 22.07.2024 14:36, Marek Marczykowski-Górecki wrote:
> > On Mon, Jul 22, 2024 at 02:09:15PM +0200, Jan Beulich wrote:
> >> On 19.07.2024 04:33, Marek Marczykowski-Górecki wrote:
> >>> +int __init subpage_mmio_ro_add(
> >>> + paddr_t start,
> >>> + size_t size)
> >>> +{
> >>> + mfn_t mfn_start = maddr_to_mfn(start);
> >>> + paddr_t end = start + size - 1;
> >>> + mfn_t mfn_end = maddr_to_mfn(end);
> >>> + unsigned int offset_end = 0;
> >>> + int rc;
> >>> + bool subpage_start, subpage_end;
> >>> +
> >>> + ASSERT(IS_ALIGNED(start, MMIO_RO_SUBPAGE_GRAN));
> >>> + ASSERT(IS_ALIGNED(size, MMIO_RO_SUBPAGE_GRAN));
> >>> + if ( !IS_ALIGNED(size, MMIO_RO_SUBPAGE_GRAN) )
> >>> + return -EINVAL;
> >>
> >> I think I had asked before: Why is misaligned size something that wants a
> >> release build fallback to the assertion, but not misaligned start?
> >
> > Misaligned start will lead to protecting larger area, not smaller, so it
> > is not unsafe thing to do. But I can also make it return an error, it
> > shouldn't happen after all.
>
> Well, I wouldn't mind if you kept what you have, just with a (brief) comment
> making clear why there is a difference in treatment. After all you could
> treat mis-aligned size similarly, making the protected area larger, too.
Ok.
--
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2024-07-22 13:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-19 2:33 [PATCH v5 0/3] Add API for making parts of a MMIO page R/O and use it in XHCI console Marek Marczykowski-Górecki
2024-07-19 2:33 ` [PATCH v5 1/3] xen/list: add LIST_HEAD_RO_AFTER_INIT Marek Marczykowski-Górecki
2024-07-22 11:03 ` Jan Beulich
2024-07-19 2:33 ` [PATCH v5 2/3] x86/mm: add API for marking only part of a MMIO page read only Marek Marczykowski-Górecki
2024-07-22 12:09 ` Jan Beulich
2024-07-22 12:36 ` Marek Marczykowski-Górecki
2024-07-22 13:01 ` Jan Beulich
2024-07-22 13:38 ` Marek Marczykowski-Górecki [this message]
2024-07-19 2:33 ` [PATCH v5 3/3] drivers/char: Use sub-page ro API to make just xhci dbc cap RO Marek Marczykowski-Górecki
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=Zp5g0hflalnM1bfa@mail-itl \
--to=marmarek@invisiblethingslab.com \
--cc=andrew.cooper3@citrix.com \
--cc=jbeulich@suse.com \
--cc=roger.pau@citrix.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.