From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from e33.co.us.ibm.com (e33.co.us.ibm.com [32.97.110.151]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 90EE91A026F for ; Wed, 4 Mar 2015 07:17:24 +1100 (AEDT) Received: from /spool/local by e33.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 3 Mar 2015 13:17:22 -0700 Received: from b03cxnp07028.gho.boulder.ibm.com (b03cxnp07028.gho.boulder.ibm.com [9.17.130.15]) by d03dlp01.boulder.ibm.com (Postfix) with ESMTP id 820241FF0023 for ; Tue, 3 Mar 2015 13:08:30 -0700 (MST) Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by b03cxnp07028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t23KFhea27525286 for ; Tue, 3 Mar 2015 13:15:43 -0700 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t23KGrCS009030 for ; Tue, 3 Mar 2015 13:16:53 -0700 Message-ID: <54F616A3.9030807@linux.vnet.ibm.com> Date: Tue, 03 Mar 2015 12:16:35 -0800 From: Tyrel Datwyler MIME-Version: 1.0 To: 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> In-Reply-To: <1425363332.20929.1.camel@ellerman.id.au> Content-Type: text/plain; charset=utf-8 Cc: linuxppc-dev@lists.ozlabs.org, Cyril Bur , nfont@linux.vnet.ibm.com List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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. :) -Tyrel > > cheers > >