tpmdd-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: "Hon Ching(Vicky) Lo" <honclo-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
To: Jarkko Sakkinen
	<jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Cc: Peter Huewe <PeterHuewe-Mmb7MZpHnFY@public.gmane.org>,
	tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Ashley Lai <ashley-fm2HMyfA2y6tG0bUXCXiUA@public.gmane.org>
Subject: Re: [PATCH] vTPM: fix missing error handling for suspend operation
Date: Tue, 08 Mar 2016 17:54:38 -0500	[thread overview]
Message-ID: <1457477678.800.7.camel@vtpm2014.ibm.com> (raw)
In-Reply-To: <1457469855.30806.14.camel-0wQ8x0XRVuT1ENwx4SLHqw@public.gmane.org>

> > > +		} else if (crq.msg == (u8) PARTNER_PARTITION_FAILED) {
> > > +			dev_err(ibmvtpm->dev,
> > > +				"vtpm has terminated fatally; reboot to reinstate a trusted state.\n");
> > > +		} else if (crq.msg == (u8) PARTNER_PARTITION_DEREG_CRQ) {
> > > +			/* The vtpm is in the process of being reloaded by
> > > +			 * firmware and has de-registered CRQ.  The client
> > > +			 * must wait for the CRQ INITIALIZATION message and
> > > +			 * respond and must resubmit suspend message.
> > > +			 */
> > > +			sig =
> > > +			    wait_event_interruptible(ibmvtpm->wq,
> > > +						     crq_initialized == 1);
> > > +			if (sig)
> > > +				return -EINTR;
> > > +
> > > +			if (suspend_again_count < 1) {
> > > +				suspend_again_count++;
> > > +				goto suspendagain;
> > > +			}
> > > +		} else
> > > +			;
> > > +	}
> > > +
> > >  	if (rc != H_SUCCESS)
> > > -		dev_err(ibmvtpm->dev,
> > > -			"tpm_ibmvtpm_suspend failed rc=%d\n", rc);
> > > +		dev_err(ibmvtpm->dev, "tpm_ibmvtpm_suspend failed rc=%d\n", rc);
> > >  
> > >  	return rc;
> > > +
> > > +suspendagain:
> > > +	rc = tpm_ibmvtpm_suspend(ibmvtpm->dev);
> > > +	suspend_again_count = 0;
> > > +
> > > +	if (rc != H_SUCCESS)
> > > +		dev_err(ibmvtpm->dev, "tpm_ibmvtpm_suspend failed rc=%d\n", rc);
> > > +
> > > +	return rc;
> > > +
> > 
> > Get rid of this horrible looking tail recursion thing.
> > 
> > What the heck is suspend_again_count and why it can be module scope
> > variable? You could use a local variable instead if you would iterate
> > with a loop.
> > 
> > /Jarkko
> > 
> 
> The reason for the 'goto' statement and the suspend_again_count was to
> prevent the suspend function recurse again.  In the case if vtpm is in
> the process of being reloaded by firmware, we want to wait for the CRQ
> INITIALIZATION and resubmit suspend message i.e. recurse only once.
> 
Never mind..  I don't really save any repetitive code by using recursion
now.  I'll rework and resubmit the patch.


Thanks,
Vicky



------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://makebettercode.com/inteldaal-eval

      parent reply	other threads:[~2016-03-08 22:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-02  6:23 [PATCH] vTPM: fix missing error handling for suspend operation Hon Ching(Vicky) Lo
2016-03-04 16:55 ` Jarkko Sakkinen
     [not found]   ` <20160304165537.GA13204-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-03-08 20:44     ` Hon Ching(Vicky) Lo
     [not found]       ` <1457469855.30806.14.camel-0wQ8x0XRVuT1ENwx4SLHqw@public.gmane.org>
2016-03-08 22:54         ` Hon Ching(Vicky) Lo [this message]

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=1457477678.800.7.camel@vtpm2014.ibm.com \
    --to=honclo-23vcf4htsmix0ybbhkvfkdbpr1lh4cv8@public.gmane.org \
    --cc=PeterHuewe-Mmb7MZpHnFY@public.gmane.org \
    --cc=ashley-fm2HMyfA2y6tG0bUXCXiUA@public.gmane.org \
    --cc=jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    /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).