Skip to contentSkip to conversation

__vmap multiple times same mfn

DISCUSSION Oleksandr Andrushchenko 3 participants 5 messages Feb 28, 2017 – Mar 1, 2017

lore
Share & tools
lore
#0 lore raw

Hi, all!

I have a use-case when I may need to call __vmap for kernel provided IPAs (read MFNs)

which may not be PAGE_SIZE aligned etc.

The question is if it is safe to call __vmap multiple times for different IPAs

sharing the same page (mfn), e.g. map something like 6ca00 0080 and 6ca00 00a0?

Thank you,

Oleksandr

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#1 lore raw
Quoted 5 lines · Oleksandr Andrushchenko

Hi, all!

I have a use-case when I may need to call __vmap for kernel provided IPAs (read MFNs)

Quoted 7 lines

which may not be PAGE_SIZE aligned etc.

The question is if it is safe to call __vmap multiple times for different IPAs

sharing the same page (mfn), e.g. map something like 6ca00 0080 and 6ca00 00a0?

What are you trying to do?

You specifically can use vmap to make non-contiguous MFNs end up contiguous in virtual address space.

The mappings themselves are of course on page boundaries, so you can't make a non-page-aligned thing appear aligned.

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#2 lore raw
Quoted 6 lines · Andrew Cooper
Quoted 5 lines · Oleksandr Andrushchenko

Hi, all!

I have a use-case when I may need to call __vmap for kernel provided IPAs (read MFNs)

Quoted 8 lines
Quoted 7 lines

which may not be PAGE_SIZE aligned etc.

The question is if it is safe to call __vmap multiple times for different IPAs

sharing the same page (mfn), e.g. map something like 6ca00 0080 and 6ca00 00a0?

What are you trying to do?

Well, the use-case is as follows: say, there are 2 structures I want to access (S1 and S2), S1 occupying pages A'-B-C' and S2 in pages C'-D'
(I mark with apostrophe here partially occupied pages, e.g. page A is partially occupied and B is fully used by S1)
No guarantee how pages A:D are located in memory
So, for that reason I want to __vmap A-B-C to access S1 and C-D to access S2

Quoted 2 lines

You specifically can use vmap to make non-contiguous MFNs end up contiguous in virtual address space.

this is what I want - see above

Quoted 1 line

The mappings themselves are of course on page boundaries,

Of course I have no intention to *map* on non page boundary, but I want to *access* non page aligned data

Quoted 2 lines

so you can't
make a non-page-aligned thing appear aligned.

I am not trying to align, I use void* from __vmap and add offset to S1/S2 start in the example above, e.g. S1 = __vmap(A,B,C) + offset_in_page(S1)

Quoted 1 line

~Andrew

So, the question remains: if I can __vmap page C for S1 and also __vmap it for S2

Thank you,
Oleksandr

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#3 lore raw
Quoted 13 lines
Quoted 1 line
Quoted 1 line · On 01.03.17 at 06:39, <[email protected]> wrote:
Quoted 11 lines · Andrew Cooper
Quoted 10 lines · Oleksandr Andrushchenko

I have a use-case when I may need to call __vmap for kernel provided IPAs (read MFNs)

which may not be PAGE_SIZE aligned etc.

The question is if it is safe to call __vmap multiple times for different IPAs

sharing the same page (mfn), e.g. map something like 6ca00 0080 and 6ca00 00a0?

Quoted 8 lines
Quoted 1 line

What are you trying to do?

Well, the use-case is as follows: say, there are 2 structures I want to access
(S1 and S2), S1 occupying pages A'-B-C' and S2 in pages C'-D'
(I mark with apostrophe here partially occupied pages, e.g. page A is partially occupied and B is fully used by S1)
No guarantee how pages A:D are located in memory
So, for that reason I want to __vmap A-B-C to access S1 and C-D to access S2

I see no reason why two respective vmap() calls would collide (provided the cacheability attributes of both mappings don't conflict). Is there any particular reason why you suspect there to be a restriction?

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#4 lore raw
Quoted 21 lines · Jan Beulich
Quoted 13 lines
Quoted 1 line
Quoted 1 line · On 01.03.17 at 06:39, <[email protected]> wrote:
Quoted 11 lines · Andrew Cooper
Quoted 10 lines · Oleksandr Andrushchenko

I have a use-case when I may need to call __vmap for kernel provided IPAs (read MFNs)

which may not be PAGE_SIZE aligned etc.

The question is if it is safe to call __vmap multiple times for different IPAs

sharing the same page (mfn), e.g. map something like 6ca00 0080 and 6ca00 00a0?

Quoted 8 lines
Quoted 1 line

What are you trying to do?

Well, the use-case is as follows: say, there are 2 structures I want to access
(S1 and S2), S1 occupying pages A'-B-C' and S2 in pages C'-D'
(I mark with apostrophe here partially occupied pages, e.g. page A is partially occupied and B is fully used by S1)
No guarantee how pages A:D are located in memory
So, for that reason I want to __vmap A-B-C to access S1 and C-D to access S2

Quoted 3 lines

I see no reason why two respective vmap() calls would collide (provided the cacheability attributes of both mappings don't conflict).

For all the mappings I use "PAGE_HYPERVISOR_NOCACHE, VMAP_DEFAULT", so no problem here

Quoted 2 lines

Is there any particular reason why you suspect there to be a restriction?

No, I have it working on ARM64, just want to be sure it is also applicable for ARM32/x86

Quoted 2 lines

Jan

Thank you

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel