From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from e39.co.us.ibm.com (e39.co.us.ibm.com [32.97.110.160]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id D97FF1A0140 for ; Thu, 5 Mar 2015 02:58:56 +1100 (AEDT) Received: from /spool/local by e39.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 4 Mar 2015 08:58:54 -0700 Received: from b01cxnp22035.gho.pok.ibm.com (b01cxnp22035.gho.pok.ibm.com [9.57.198.25]) by d01dlp01.pok.ibm.com (Postfix) with ESMTP id A508038C8052 for ; Wed, 4 Mar 2015 10:58:51 -0500 (EST) Received: from d01av04.pok.ibm.com (d01av04.pok.ibm.com [9.56.224.64]) by b01cxnp22035.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t24FwpXL24117302 for ; Wed, 4 Mar 2015 15:58:51 GMT Received: from d01av04.pok.ibm.com (localhost [127.0.0.1]) by d01av04.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t24FwnbV018287 for ; Wed, 4 Mar 2015 10:58:51 -0500 Message-ID: <54F72BB8.2080001@linux.vnet.ibm.com> Date: Wed, 04 Mar 2015 09:58:48 -0600 From: Nathan Fontenot MIME-Version: 1.0 To: Tyrel Datwyler , Michael Ellerman Subject: Re: [PATCH 1/3] powerpc/pseries: Simplify check for suspendability during suspend/migration References: <1425090283-27694-1-git-send-email-tyreld@linux.vnet.ibm.com> <1425090283-27694-2-git-send-email-tyreld@linux.vnet.ibm.com> <1425269985.2919.29.camel@cyril> <54F4D65B.5080603@linux.vnet.ibm.com> <1425363332.20929.1.camel@ellerman.id.au> <54F616A3.9030807@linux.vnet.ibm.com> In-Reply-To: <54F616A3.9030807@linux.vnet.ibm.com> Content-Type: text/plain; charset=utf-8 Cc: linuxppc-dev@lists.ozlabs.org, Cyril Bur List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On 03/03/2015 02:16 PM, Tyrel Datwyler wrote: > On 03/02/2015 10:15 PM, Michael Ellerman wrote: >> On Mon, 2015-03-02 at 13:30 -0800, Tyrel Datwyler wrote: >>> On 03/01/2015 08:19 PM, Cyril Bur wrote: >>>> On Fri, 2015-02-27 at 18:24 -0800, Tyrel Datwyler wrote: >>>>> During suspend/migration operation we must wait for the VASI state reported >>>>> by the hypervisor to become Suspending prior to making the ibm,suspend-me >>>>> RTAS call. Calling routines to rtas_ibm_supend_me() pass a vasi_state variable >>>>> that exposes the VASI state to the caller. This is unnecessary as the caller >>>>> only really cares about the following three conditions; if there is an error >>>>> we should bailout, success indicating we have suspended and woken back up so >>>>> proceed to device tree updated, or we are not suspendable yet so try calling >>>>> rtas_ibm_suspend_me again shortly. >>>>> >>>>> This patch removes the extraneous vasi_state variable and simply uses the >>>>> return code to communicate how to proceed. We either succeed, fail, or get >>>>> -EAGAIN in which case we sleep for a second before trying to call >>>>> rtas_ibm_suspend_me again. >>>>> >>>>> u64 handle = ((u64)be32_to_cpu(args.args[0]) << 32) >>>>> | be32_to_cpu(args.args[1]); >>>>> - rc = rtas_ibm_suspend_me(handle, &vasi_rc); >>>>> - args.rets[0] = cpu_to_be32(vasi_rc); >>>>> - if (rc) >>>>> + rc = rtas_ibm_suspend_me(handle); >>>>> + if (rc == -EAGAIN) >>>>> + args.rets[0] = cpu_to_be32(RTAS_NOT_SUSPENDABLE); >>>> >>>> (continuing on...) so perhaps here have >>>> rc = 0; >>>> else if (rc == -EIO) >>>> args.rets[0] = cpu_to_be32(-1); >>>> rc = 0; >>>> Which should keep the original behaviour, the last thing we want to do >>>> is break BE. >>> >>> The biggest problem here is we are making what basically equates to a >>> fake rtas call from drmgr which we intercept in ppc_rtas(). From there >>> we make this special call to rtas_ibm_suspend_me() to check VASI state >>> and do a bunch of other specialized work that needs to be setup prior to >>> making the actual ibm,suspend-me rtas call. Since, we are cheating PAPR >>> here I guess we can really handle it however we want. I chose to simply >>> fail the rtas call in the case where rtas_ibm_suspend_me() fails with >>> something other than -EAGAIN. In user space librtas will log errno for >>> the failure and return RTAS_IO_ASSERT to drmgr which in turn will log >>> that error and fail. >> >> We don't want to change the return values of the syscall unless we absolutely >> have to. And I don't think that's the case here. > > I'd like to argue that the one case I changed makes sense, but its just > as easy to keep the original behavior. > >> >> Sure we think drmgr is the only thing that uses this crap, but we don't know >> for sure. > > I can't imagine how anybody else could possibly use this hack without a > streamid from the hmc/hypervisor, but I've been wrong in the past more > times than I can count. :) Correct, this will fail if called with a random streamid. The streamid has to match what is handed to us from the HMC when a migration request is initiated. -Nathan > > -Tyrel > >> >> cheers >> >> >