From: Juergen Gross <jgross@suse.com>
To: Oleksandr Tyshchenko <Oleksandr_Tyshchenko@epam.com>,
Xenia Ragiadakou <burzalodowa@gmail.com>,
"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: Stefano Stabellini <sstabellini@kernel.org>,
Oleksandr Tyshchenko <olekstysh@gmail.com>
Subject: Re: [PATCH] xen/virtio: Convert PAGE_SIZE/PAGE_SHIFT/PFN_UP to Xen counterparts
Date: Fri, 7 Oct 2022 06:46:29 +0200 [thread overview]
Message-ID: <8c65d2dc-9901-5863-62a4-054f6fb7c1f3@suse.com> (raw)
In-Reply-To: <b3b8047e-b4a5-1e75-2a55-a7beecf8ca7d@epam.com>
[-- Attachment #1.1.1: Type: text/plain, Size: 1492 bytes --]
On 06.10.22 23:13, Oleksandr Tyshchenko wrote:
>
> On 06.10.22 20:59, Xenia Ragiadakou wrote:
>
> Hello Xenia
>
>>
>> On 10/6/22 15:09, Oleksandr Tyshchenko wrote:
>>> From: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
>>>
>>> Although XEN_PAGE_SIZE is equal to PAGE_SIZE (4KB) for now, it would
>>> be more correct to use Xen specific #define-s as XEN_PAGE_SIZE can
>>> be changed at some point in the future.
>>>
>>> Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
...
>> So, the calculated number of grants may differ.
>
> Good point, I think you are right, so we need to additionally use
> xen_offset_in_page() macro in xen_grant_dma_map_page(),
>
> something like that to be squashed with current patch:
>
>
> diff --git a/drivers/xen/grant-dma-ops.c b/drivers/xen/grant-dma-ops.c
> index 9d5eca6d638a..bb984dc05deb 100644
> --- a/drivers/xen/grant-dma-ops.c
> +++ b/drivers/xen/grant-dma-ops.c
> @@ -169,7 +169,7 @@ static dma_addr_t xen_grant_dma_map_page(struct
> device *dev, struct page *page,
> unsigned long attrs)
> {
> struct xen_grant_dma_data *data;
> - unsigned int i, n_pages = XEN_PFN_UP(offset + size);
> + unsigned int i, n_pages = XEN_PFN_UP(xen_offset_in_page(offset)
> + size);
I'd rather introduce another local variable "xen_offset", as it is used
twice.
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3149 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]
next prev parent reply other threads:[~2022-10-07 4:46 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-06 12:09 Oleksandr Tyshchenko
2022-10-06 13:28 ` Juergen Gross
2022-10-06 17:59 ` Xenia Ragiadakou
2022-10-06 21:13 ` Oleksandr Tyshchenko
2022-10-07 4:46 ` Juergen Gross [this message]
2022-10-07 7:15 ` Xenia Ragiadakou
2022-10-07 13:43 ` Oleksandr Tyshchenko
2022-10-07 15:50 ` Xenia Ragiadakou
2022-10-07 16:16 ` Oleksandr Tyshchenko
2022-10-07 17:35 ` Oleksandr Tyshchenko
2022-10-07 20:08 ` Xenia Ragiadakou
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=8c65d2dc-9901-5863-62a4-054f6fb7c1f3@suse.com \
--to=jgross@suse.com \
--cc=Oleksandr_Tyshchenko@epam.com \
--cc=burzalodowa@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=olekstysh@gmail.com \
--cc=sstabellini@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®