From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CAA69C48BDF for ; Thu, 24 Jun 2021 11:17:19 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 95D38611CE for ; Thu, 24 Jun 2021 11:17:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 95D38611CE Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=xen.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.146713.270116 (Exim 4.92) (envelope-from ) id 1lwNM8-0001tO-Bi; Thu, 24 Jun 2021 11:17:12 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 146713.270116; Thu, 24 Jun 2021 11:17:12 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lwNM8-0001tE-81; Thu, 24 Jun 2021 11:17:12 +0000 Received: by outflank-mailman (input) for mailman id 146713; Thu, 24 Jun 2021 11:17:10 +0000 Received: from mail.xenproject.org ([104.130.215.37]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lwNM6-0001rV-Mw for xen-devel@lists.xenproject.org; Thu, 24 Jun 2021 11:17:10 +0000 Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lwNM5-00075S-2s; Thu, 24 Jun 2021 11:17:09 +0000 Received: from [54.239.6.182] (helo=a483e7b01a66.ant.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lwNM4-0003HI-Q8; Thu, 24 Jun 2021 11:17:09 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=Content-Transfer-Encoding:Content-Type:In-Reply-To: MIME-Version:Date:Message-ID:From:References:Cc:To:Subject; bh=3x+4zeqoHksbHH2jN8EeTR+Jc1uTXMhfyzCmeIaTJ5g=; b=EUhaXjZX/NS0bWmNTXhAH3ElOg 0Vy8/aYj6dqD7QGrv0RxmWGdywMJ+XFBYMLhz6zjitNoUHPZ0ouReuOXTnicBe4A6PayY3AJpadXj VI66PO2vHGq4967Q1pAbv/SmLfNbSs53DtAU611oDq4I6/x5qPnUDH9Yu4Zzn7qxl+4c=; Subject: Re: [PATCH 09/10] tools/xenstored: Dump delayed requests To: Juergen Gross , xen-devel@lists.xenproject.org Cc: raphning@amazon.co.uk, doebel@amazon.de, Julien Grall , Ian Jackson , Wei Liu References: <20210616144324.31652-1-julien@xen.org> <20210616144324.31652-10-julien@xen.org> <5b6455f3-9b44-2cf3-e53d-1f235977a4e2@suse.com> <6e17cbd5-a819-2ed6-6f73-784cda2b9a5c@suse.com> <96cb7350-4f59-a359-5ba4-fee586e73370@xen.org> <0745889a-0142-3139-891a-4fb7a43fec18@suse.com> From: Julien Grall Message-ID: <6130d1f5-f48d-53a7-fe12-de1c358bad32@xen.org> Date: Thu, 24 Jun 2021 13:17:06 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <0745889a-0142-3139-891a-4fb7a43fec18@suse.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 8bit On 24/06/2021 13:02, Juergen Gross wrote: > On 24.06.21 12:46, Julien Grall wrote: >> Hi Juergen, >> >> On 24/06/2021 12:45, Juergen Gross wrote: >>> On 24.06.21 12:28, Julien Grall wrote: >>>> Hi Juergen, >>>> >>>> On 24/06/2021 10:41, Juergen Gross wrote: >>>>> On 16.06.21 16:43, Julien Grall wrote: >>>>>> From: Julien Grall >>>>>> >>>>>> Currently, only Live-Update request can be delayed. In a follow-up, >>>>>> we will want to delay more requests (e.g. transaction start). >>>>>> Therefore we want to preserve delayed requests across Live-Update. >>>>>> >>>>>> Delayed requests are just complete "in" buffer. So the code is >>>>>> refactored to allow sharing the code to dump "in" buffer. >>>>>> >>>>>> Signed-off-by: Julien Grall >>>>>> --- >>>>>>   tools/xenstore/xenstored_core.c | 42 >>>>>> +++++++++++++++++++++++++-------- >>>>>>   1 file changed, 32 insertions(+), 10 deletions(-) >>>>>> >>>>>> diff --git a/tools/xenstore/xenstored_core.c >>>>>> b/tools/xenstore/xenstored_core.c >>>>>> index 5b7ab7f74013..9eca58682b51 100644 >>>>>> --- a/tools/xenstore/xenstored_core.c >>>>>> +++ b/tools/xenstore/xenstored_core.c >>>>>> @@ -2403,25 +2403,47 @@ const char *dump_state_global(FILE *fp) >>>>>>       return NULL; >>>>>>   } >>>>>> +static const char *dump_input_buffered_data(FILE *fp, >>>>>> +                        conststruct buffered_data *in, >>>>>> +                        unsigned int *total_len) >>>>>> +{ >>>>>> +    unsigned int hlen = in->inhdr ? in->used : sizeof(in->hdr); >>>>>> + >>>>>> +    *total_len += hlen; >>>>>> +    if (fp && fwrite(&in->hdr, hlen, 1, fp) != 1) >>>>>> +        return "Dump read data error"; >>>>>> +    if (!in->inhdr && in->used) { >>>>>> +        *total_len += in->used; >>>>>> +        if (fp && fwrite(in->buffer,in->used, 1, fp) != 1) >>>>>> + > return "Dump read data error"; >>>>>> +    } >>>>>> + >>>>>> +    return NULL; >>>>>> +} >>>>>> + >>>>>>   /* Called twice: first with fp == NULL to get length, then >>> for >>>>>> writing data. */ >>>>>>   const char *dump_state_buffered_data(FILE *fp, const struct >>>>>> connection *c, >>>>>>                        struct xs_state_connection *sc) >>>>>>   { >>>>>>       unsigned int len = 0, used; >>>>>> -    struct buffered_data *out, *in = c->in; >>>>>> +    struct buffered_data *out; >>>>>>       bool partial = true; >>>>>> +    struct delayed_request *req; >>>>>> +    const char *ret; >>>>>> -    if (in) { >>>>>> -        len = in->inhdr ? in->used: sizeof(in->hdr); >>>>>> -        if (fp && fwrite(&in->hdr,len, 1, fp) != 1) >>>>>> - > return "Dump read data error"; >>>>>> -        if (!in->inhdr && in->used) { >>>>>> - > len += in->used; >>>>>> - > if(fp && fwrite(in->buffer, in->used, 1, fp) != 1) >>>>>> -                return "Dump read data error"; >>>>>> -        } >>>>>> +    /* Dump any command that was delayed */ >>>>>> +    list_for_each_entry(req, &c->delayed, list) { >>>>> >>>>> Please add a comment here that the following if() serves especially to >>>>> avoid dumping the data for do_lu_start(). >>>> >>>> Would you be happy to give your acked-by/reviewed-by if I add the >>>> following on commit? >>>> >>>> " >>>> We only want to preserve commands that wasn't processed at all. All the >>> >>> >>> s/wasn't/weren't/ >> >> I will do. >> >>> >>>> other delayed requests (such as do_lu_start()) must be processed before >>> >>>> Live-Update. >>>> " >>> >>> With that change I'm fine. >> >> Can I translate that to an acked-by? :) > > Make it a "Reviewed-by:" :-) Thanks! I have committed it. Cheers, -- Julien Grall