Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3881185imw; Mon, 11 Jul 2022 18:39:37 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s1YKlKMFudLW4647fU3wKrzFNvDJPdJWhaNNBZgVs0j8vKVyeIKHtJ7a487HIqDbTvkoAS X-Received: by 2002:a17:907:2722:b0:72b:735a:d3b4 with SMTP id d2-20020a170907272200b0072b735ad3b4mr2998726ejl.363.1657589977127; Mon, 11 Jul 2022 18:39:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657589977; cv=none; d=google.com; s=arc-20160816; b=YsgqD6f65/tOSXUZaHjG8800ZWGaq6fExdOECD3yKxC4fGZC1b4FbhD/h5z40erJ+E O78sUHWgQnAb1PWQ3TOF7UZ0Mg+DSX7JaPJC83piqPAKfZfL4IcHVcMaHD8vR3LtAMfe EhYuhs/SJkKwU7AVkKyZdOTc8J3e3Trz3FDT4CBXOi9XnsGk/gWPUCcuNGf164cfrBRU baZWW2zSaIiaBj1+hOpemV8Ok8Pnh8GGo8cOwl1WrTvfVtKsOUqPLiGuZc5eUqu7TDzy ZGAtCyN1/89c8nlBFMnj4qYr15vtRCGA6kTMzAiZi75UjhudmwnPXF9NYxSYIZRF+5yA aqsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:message-id :mime-version:in-reply-to:references:cc:to:subject:from:date :dkim-signature; bh=A7qUftFMsHtAgHz7tg5ybnJxuA39QPif4EqnUQa2+ls=; b=AqF9c2/bkiCo7+ndm8x09TUgaiP9F+vUaKeTfYutWXJPhNBvFnOWNYAkV8a9a0Qith 0gL1BP+eBSlh2+3TFx30i2tGjDubtjnizsdSHgpjSYL8meRpAn0bttQRMs1HYzDVHIy6 f2zu+dKyaW+3U/Q4vq3I68/RqSb5iHwWM7LE/yPd/Vq59nDYvPrYdU85bYuoBQj6KCcN F7CJoiatMvO3faZVhlumo70AiPOawLC+Tpd+2bYge+APnj6XGVSn8loqCX6cBoScDkKY wTMXyucjerqnQJNNXp5cvmYRYvcDzDhrGjnPSnR9DbhSySGewvno36orH29Ku7bP/ja2 n/sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ilWwUWRB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sh16-20020a1709076e9000b0072b81296609si366595ejc.64.2022.07.11.18.39.12; Mon, 11 Jul 2022 18:39:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ilWwUWRB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231989AbiGLBdV (ORCPT + 99 others); Mon, 11 Jul 2022 21:33:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229796AbiGLBdQ (ORCPT ); Mon, 11 Jul 2022 21:33:16 -0400 Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 156238E1E2; Mon, 11 Jul 2022 18:33:14 -0700 (PDT) Received: by mail-pl1-x633.google.com with SMTP id v21so3441845plo.0; Mon, 11 Jul 2022 18:33:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:subject:to:cc:references:in-reply-to:mime-version :message-id:content-transfer-encoding; bh=A7qUftFMsHtAgHz7tg5ybnJxuA39QPif4EqnUQa2+ls=; b=ilWwUWRBr2jcKjIgdGL97r01HtkS3jZpsabezxx1tUPUQ7nwzkvbBQbHRnZjyQHG4a MTQaJauz2iosj/AQx2pFgDEGzCjs6RZtqEpfF4gFACV0PkzxpUgLKQV0r7SkoOS8p+M6 dkt68QM01GF7GmRIGvuVT1L4E6RCx066fAv8uES+/UuTbIGmK31aN4iXmUm6tF5eQPB7 5cr+316tp2G1/YM/tLLU7xm2kSvI7d4CRF8fGbsy8L1SfQhezD8s3MKooY5XZQOW0peI yfloIeERrassAa9MWw/8ENoGPGt/oQ0X2g97fHelcTTOEjUWFON4xU58FfyK6IAAdjiL f9WA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:subject:to:cc:references:in-reply-to :mime-version:message-id:content-transfer-encoding; bh=A7qUftFMsHtAgHz7tg5ybnJxuA39QPif4EqnUQa2+ls=; b=72Nna69Q1F9i9Y+pLDgwAgiBigMG/O9ZX/rMwDjwftA5LlmWdfG4wtrmivOCHlJoYr hPGJdj857P0yc3GbaAf/t2+TiX3q+YK3VlslBr80PsSnZljK5Wbz7WNcFM6wpv9iFcKH 6eYlLq9ibcsNHc1dKK2AUbhuF/wVn7BaQM4GgB+A8u6kzEJXSWCiwyAObe6kEX7vGba/ 50M5uEX9l2rxOHFQWPzJlQkwBauRFLASEYIDARSuG6xTfymauM9ufpcuBLB/KNJ9kw1c 91CY6HM3LXh2Quy4UC5a+GDw3CCZMASgAnNPA8pQfQdCNaBhR9s7cSlCERpwadZjLPWc YbnQ== X-Gm-Message-State: AJIora8xUXzFpHxD3GUhKlduPltZopHqa6QdVf5hppuZeoVesBugSOuD eco87cROGZGRStT/lAabfdo= X-Received: by 2002:a17:902:ea09:b0:16c:3f7a:adf7 with SMTP id s9-20020a170902ea0900b0016c3f7aadf7mr11199465plg.103.1657589593546; Mon, 11 Jul 2022 18:33:13 -0700 (PDT) Received: from localhost (193-116-203-247.tpgi.com.au. [193.116.203.247]) by smtp.gmail.com with ESMTPSA id f8-20020a17090ab94800b001ef42b3c5besm5450818pjw.23.2022.07.11.18.33.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 18:33:12 -0700 (PDT) Date: Tue, 12 Jul 2022 11:33:07 +1000 From: Nicholas Piggin Subject: Re: [PATCH v3 1/4] powerpc/mobility: wait for memory transfer to complete To: benh@kernel.crashing.org, haren@linux.vnet.ibm.com, Laurent Dufour , linux@roeck-us.net, mpe@ellerman.id.au, nathanl@linux.ibm.com, paulus@samba.org, wim@linux-watchdog.org Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-watchdog@vger.kernel.org References: <20220627135347.32624-1-ldufour@linux.ibm.com> <20220627135347.32624-2-ldufour@linux.ibm.com> In-Reply-To: <20220627135347.32624-2-ldufour@linux.ibm.com> MIME-Version: 1.0 Message-Id: <1657588908.mis26ebam4.astroid@bobo.none> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Excerpts from Laurent Dufour's message of June 27, 2022 11:53 pm: > In pseries_migration_partition(), loop until the memory transfer is > complete. This way the calling drmgr process will not exit earlier, > allowing callbacks to be run only once the migration is fully completed. >=20 > If reading the VASI state is done after the hypervisor has completed the > migration, the HCALL is returning H_PARAMETER. We can safely assume that > the memory transfer is achieved if this happens. >=20 > This will also allow to manage the NMI watchdog state in the next commits= . >=20 > Reviewed-by: Nathan Lynch > Signed-off-by: Laurent Dufour > --- > arch/powerpc/platforms/pseries/mobility.c | 42 +++++++++++++++++++++-- > 1 file changed, 40 insertions(+), 2 deletions(-) >=20 > diff --git a/arch/powerpc/platforms/pseries/mobility.c b/arch/powerpc/pla= tforms/pseries/mobility.c > index 78f3f74c7056..907a779074d6 100644 > --- a/arch/powerpc/platforms/pseries/mobility.c > +++ b/arch/powerpc/platforms/pseries/mobility.c > @@ -427,6 +427,43 @@ static int wait_for_vasi_session_suspending(u64 hand= le) > return ret; > } > =20 > +static void wait_for_vasi_session_completed(u64 handle) > +{ > + unsigned long state =3D 0; > + int ret; > + > + pr_info("waiting for memory transfert to complete...\n"); ^ extra t (also below) > + > + /* > + * Wait for transition from H_VASI_RESUMED to H_VASI_COMPLETED. > + */ > + while (true) { > + ret =3D poll_vasi_state(handle, &state); > + > + /* > + * If the memory transfer is already complete and the migration > + * has been cleaned up by the hypervisor, H_PARAMETER is return, > + * which is translate in EINVAL by poll_vasi_state(). > + */ > + if (ret =3D=3D -EINVAL || (!ret && state =3D=3D H_VASI_COMPLETED)) { > + pr_info("memory transfert completed.\n"); > + break; > + } > + > + if (ret) { > + pr_err("H_VASI_STATE return error (%d)\n", ret); > + break; > + } > + > + if (state !=3D H_VASI_RESUMED) { > + pr_err("unexpected H_VASI_STATE result %lu\n", state); > + break; > + } > + > + msleep(500); Is 500 specified anywhere? Another caller uses 1000, and the other one=20 uses some backoff interval starting at 1ms... > + } > +} > + > static void prod_single(unsigned int target_cpu) > { > long hvrc; > @@ -673,9 +710,10 @@ static int pseries_migrate_partition(u64 handle) > vas_migration_handler(VAS_SUSPEND); > =20 > ret =3D pseries_suspend(handle); > - if (ret =3D=3D 0) > + if (ret =3D=3D 0) { > post_mobility_fixup(); > - else > + wait_for_vasi_session_completed(handle); If this wasn't required until later patches, maybe a comment about why=20 it's here? Could call it wait_for_migration() or similar too. Looks okay though from my basic reading of PAPR. Reviewed-by: Nicholas Piggin > + } else > pseries_cancel_migration(handle, ret); > =20 > vas_migration_handler(VAS_RESUME); > --=20 > 2.36.1 >=20 >=20