<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
Am 04.12.24 um 12:09 schrieb Thomas Hellström:<br>
<blockquote type="cite" cite="mid:9e2d75c95a9ed06912490937b1163f2a54d0196a.camel@linux.intel.com">[SNIP]<span style="white-space: pre-wrap">
</span></blockquote>
<br>
<blockquote type="cite" cite="mid:9e2d75c95a9ed06912490937b1163f2a54d0196a.camel@linux.intel.com"><span style="white-space: pre-wrap">
</span>
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">BTW I really dislike that tt->restore is allocated dynamically.
That
is
just another allocation which can cause problems.
We should probably have all the state necessary for the operation
in
the
TT object.
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">Initially it was done this way. But that meant a pre-allocated
struct
page-pointer array the of 1 << MAX_PAGE_ORDER size (2MiB) for each
ttm_tt. That lead to a patch to reduce the MAX_PAGE_ORDER to PMD
size
order, but as you might remember, that needed to be ripped out
because
the PMD size macros aren't constant across all architectures. IIRC
it
was ARM causing compilation failures, and Linus wasn't happy.
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">
Yeah, I do remember that. But I don't fully get why you need this
page-pointer array in the first place?
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">
So the TTM page-pointer array holds the backup handles when backed up.
During recovery, We allocate a (potentially huge) page and populate the
TTM page-pointer array with pointers into that. Meanwhile we need to
keep the backup handles for the recover phase in the restore structure,
and in the middle of the recover phase you might hit an -EINTR.</pre>
</blockquote>
<br>
I still don't see the problem to be honest.<br>
<br>
What you basically do on recovery is the following:<br>
1. Allocate a bunch of contiguous memory of order X.<br>
2. Take the first entry from the page_array, convert that to your
backup handle and copy the data back into the just allocated
contiguous memory.<br>
3. Replace the first entry in the page array with the struct page
pointer of the allocated contiguous memory.<br>
4. Take the next entry from the page_array, convert that to your
backup handle and copy the data back into the just allocated
contiguous memory.<br>
5. Replace the next entry in the page_array with the struct page
pointer + 1 of the allocated contiguous memory.<br>
6. Repeat until the contiguous memory is fully recovered and we jump
to 1 again.<br>
<br>
What exactly do you need this pre-allocated struct page-pointer
array of 1 << MAX_PAGE_ORDER for?<br>
<br>
Sorry, I must really be missing something here.<br>
<br>
Regards,<br>
Christian.<br>
<br>
<blockquote type="cite" cite="mid:9e2d75c95a9ed06912490937b1163f2a54d0196a.camel@linux.intel.com">
<pre class="moz-quote-pre" wrap="">
Thanks,
Thomas
</pre>
</blockquote>
</body>
</html>