<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>This is elaborate description of the issue which is bypassed by
      this patch.</p>
    <div class="moz-cite-prefix">On 16/08/19 4:43 PM, Abhishek Dubey
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAODppzGmasP9pEHnL3i8TepLvm+5UfYYsCKDD8MKWY=9asYZjA@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="auto">
        <div dir="ltr">Hi,
          <div><br>
          </div>
          <div>I have a few observation regarding this issue:</div>
          <div><br>
          </div>
          <div>If a ppb (page-pipe-buffer) requires corresponding pipe
            size &lt; 512 pages, it faces no issue.</div>
          <div>But, all the test-cases which require pipe size to be 512
            pages fails. In such cases, vmsplice</div>
          <div>while splicing from user-buffer, don't return any error,
            but splices few bytes less than 512 pages.</div>
          <div>So 512th page is incompletely spliced from user-buffer to
            pipe.</div>
          <div><br>
          </div>
          <div>This hack bypasses this issue: </div>
          <div>While expanding pipe, let it expand till 512 pages, but
            the stored pipe size will be 1 less than</div>
          <div>actual size. So, ppb-&gt;pipe_size will store 511 instead
            of 512. Each ppb can point to 511 pages.</div>
          <div><br>
          </div>
          <div>By doing so, vmsplice splices 511 pages completely,
            without issue for all test cases. The 512th</div>
          <div>page become part of next ppb.</div>
          <div><br>
          </div>
          <div>I wrote a toy code to find the actual issue(vmsplice
            failing with pipe of 512 page size), but pipe was not
            expanding beyond 256 pages. </div>
          <div dir="auto"><br>
          </div>
          <div dir="auto">Have you faced this problem before?</div>
          <div dir="auto"><br>
          </div>
        </div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Fri, Aug 2, 2019 at 11:44
          AM abhishek dubey &lt;<a
            href="mailto:dubeyabhishek777@gmail.com" target="_blank"
            rel="noreferrer" moz-do-not-send="true">dubeyabhishek777@gmail.com</a>&gt;
          wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px
          0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
          On 30/07/19 6:11 PM, Pavel Emelianov wrote:<br>
          &gt; On 7/25/19 4:14 AM, Abhishek Dubey wrote:<br>
          &gt;&gt; hack to handle failing vmsplice from user-buffer to<br>
          &gt;&gt; pipe: need to resolve<br>
          &gt; Please, write more descriptive comment to this patch,
          these off-by-one-s<br>
          &gt; are not clear.<br>
          <br>
          This is temporary change. I need to debug this code and
          eliminate it.<br>
          <br>
          If this will be required in final code, I will add proper
          description.<br>
          <br>
          &gt;<br>
          &gt;&gt; Signed-off-by: Abhishek Dubey &lt;<a
            href="mailto:dubeyabhishek777@gmail.com" target="_blank"
            rel="noreferrer" moz-do-not-send="true">dubeyabhishek777@gmail.com</a>&gt;<br>
          &gt;&gt; ---<br>
          &gt;&gt;   criu/page-pipe.c | 4 ++--<br>
          &gt;&gt;   1 file changed, 2 insertions(+), 2 deletions(-)<br>
          &gt;&gt;<br>
          &gt;&gt; diff --git a/criu/page-pipe.c b/criu/page-pipe.c<br>
          &gt;&gt; index a821696..d73f223 100644<br>
          &gt;&gt; --- a/criu/page-pipe.c<br>
          &gt;&gt; +++ b/criu/page-pipe.c<br>
          &gt;&gt; @@ -33,7 +33,7 @@ static int __ppb_resize_pipe(struct
          page_pipe_buf *ppb, unsigned long new_size)<br>
          &gt;&gt;   {<br>
          &gt;&gt;      int ret;<br>
          &gt;&gt;   <br>
          &gt;&gt; -    ret = fcntl(ppb-&gt;p[0], F_SETPIPE_SZ, new_size
          * PAGE_SIZE);<br>
          &gt;&gt; +    ret = fcntl(ppb-&gt;p[0], F_SETPIPE_SZ, new_size
          * PAGE_SIZE + 1);<br>
          &gt;&gt;      if (ret &lt; 0)<br>
          &gt;&gt;              return -1;<br>
          &gt;&gt;   <br>
          &gt;&gt; @@ -41,7 +41,7 @@ static int __ppb_resize_pipe(struct
          page_pipe_buf *ppb, unsigned long new_size)<br>
          &gt;&gt;      BUG_ON(ret &lt; ppb-&gt;pipe_size);<br>
          &gt;&gt;   <br>
          &gt;&gt;      pr_debug("Grow pipe %x -&gt; %x\n",
          ppb-&gt;pipe_size, ret);<br>
          &gt;&gt; -    ppb-&gt;pipe_size = ret;<br>
          &gt;&gt; +    ppb-&gt;pipe_size = ret -1;<br>
          &gt;&gt;   <br>
          &gt;&gt;      return 0;<br>
          &gt;&gt;   }<br>
          &gt;&gt;<br>
          -Abhishek<br>
        </blockquote>
      </div>
    </blockquote>
  </body>
</html>