qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Steven Sistare <steven.sistare@oracle.com>
To: Peter Xu <peterx@redhat.com>
Cc: qemu-devel@nongnu.org,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
	"Juan Quintela" <quintela@redhat.com>
Subject: Re: [PATCH V2] migration: simplify blockers
Date: Tue, 7 Feb 2023 16:17:34 -0500	[thread overview]
Message-ID: <0a757102-0378-db4e-d889-9872f3a2d529@oracle.com> (raw)
In-Reply-To: <Y+Ku/zQOoFogmx0j@x1n>

On 2/7/2023 3:05 PM, Peter Xu wrote:
> On Tue, Feb 07, 2023 at 11:03:13AM -0800, Steve Sistare wrote:
>> Modify migrate_add_blocker and migrate_del_blocker to take an Error **
>> reason.  This allows migration to own the Error object, so that if
>> an error occurs, migration code can free the Error and clear the client
>> handle, simplifying client code.  This is a pre-requisite for a future
>> patch that will allow one Error blocker to be registered for multiple
>> migration modes.
>>
>> No functional change.
>>
>> Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
> 
> Acked-by: Peter Xu <peterx@redhat.com>
> 
> One trivial comment below.
> 
> [...]
> 
>> diff --git a/include/migration/blocker.h b/include/migration/blocker.h
>> index 9cebe2b..7c8d326 100644
>> --- a/include/migration/blocker.h
>> +++ b/include/migration/blocker.h
>> @@ -17,19 +17,22 @@
>>  /**
>>   * @migrate_add_blocker - prevent migration from proceeding
>>   *
>> - * @reason - an error to be returned whenever migration is attempted
>> + * @reasonp - address of an error to be returned whenever migration is attempted
>>   *
>>   * @errp - [out] The reason (if any) we cannot block migration right now.
>>   *
>>   * @returns - 0 on success, -EBUSY/-EACCES on failure, with errp set.
>> + *
>> + * *@reasonp is freed and set to NULL if failure is returned.
>> + * On success, the caller no longer owns *@reasonp and must not free it.
> 
> This statement reads weird.  IMHO the caller still owns @reasonp, but if it
> succeeded it should only free it with a migrate_del_blocker() later.

How about:
  On success, the caller must not free @reasonp, except by calling migrate_del_blocker.

Same below.

- Steve

>>   */
>> -int migrate_add_blocker(Error *reason, Error **errp);
>> +int migrate_add_blocker(Error **reasonp, Error **errp);
>>  
>>  /**
>>   * @migrate_add_blocker_internal - prevent migration from proceeding without
>>   *                                 only-migrate implications
>>   *
>> - * @reason - an error to be returned whenever migration is attempted
>> + * @reasonp - address of an error to be returned whenever migration is attempted
>>   *
>>   * @errp - [out] The reason (if any) we cannot block migration right now.
>>   *
>> @@ -38,14 +41,19 @@ int migrate_add_blocker(Error *reason, Error **errp);
>>   * Some of the migration blockers can be temporary (e.g., for a few seconds),
>>   * so it shouldn't need to conflict with "-only-migratable".  For those cases,
>>   * we can call this function rather than @migrate_add_blocker().
>> + *
>> + * *@reasonp is freed and set to NULL if failure is returned.
>> + * On success, the caller no longer owns *@reasonp and must not free it.
> 
> Same here?
> 
>>   */
> 


  reply	other threads:[~2023-02-07 21:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-07 19:03 [PATCH V2] migration: simplify blockers Steve Sistare
2023-02-07 20:05 ` Peter Xu
2023-02-07 21:17   ` Steven Sistare [this message]
2023-02-07 21:29     ` Peter Xu
2023-06-07 14:13       ` Steven Sistare

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=0a757102-0378-db4e-d889-9872f3a2d529@oracle.com \
    --to=steven.sistare@oracle.com \
    --cc=dgilbert@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /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;
as well as URLs for NNTP newsgroup(s).