Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1705387 > unrolled thread

[PATCH] tpm: improve tpm_tis send() performance by ignoring burstcount

Started byNayna Jain <nayna@linux.vnet.ibm.com>
First post2017-08-07 13:50 +0200
Last post2017-08-08 21:10 +0200
Articles 5 on this page of 25 — 9 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] tpm: improve tpm_tis send() performance by ignoring burstcount Nayna Jain <nayna@linux.vnet.ibm.com> - 2017-08-07 13:50 +0200
    Re: [PATCH] tpm: improve tpm_tis send() performance by ignoring burstcount Peter Huewe <peterhuewe@gmx.de> - 2017-08-07 14:00 +0200
      Re: [PATCH] tpm: improve tpm_tis send() performance by ignoring  burstcount Nayna <nayna@linux.vnet.ibm.com> - 2017-08-07 16:30 +0200
        Re: [PATCH] tpm: improve tpm_tis send() performance by ignoring  burstcount Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2017-08-09 00:00 +0200
      Re: [PATCH] tpm: improve tpm_tis send() performance by ignoring  burstcount Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2017-08-08 21:20 +0200
        Re: [tpmdd-devel] [PATCH] tpm: improve tpm_tis send() performance by  ignoring burstcount Ken Goldman <kgold@linux.vnet.ibm.com> - 2017-08-09 22:30 +0200
          Aw: Re: [tpmdd-devel] [PATCH] tpm: improve tpm_tis send()  performance by ignoring burstcount "Peter Huewe" <PeterHuewe@gmx.de> - 2017-08-09 22:50 +0200
            Re: Aw: Re: [tpmdd-devel] [PATCH] tpm: improve tpm_tis send()  performance by ignoring burstcount Ken Goldman <kgold@linux.vnet.ibm.com> - 2017-08-12 00:00 +0200
              Re: Aw: Re: [tpmdd-devel] [PATCH] tpm: improve tpm_tis send()  performance by ignoring burstcount Ken Goldman <kgold@linux.vnet.ibm.com> - 2017-08-16 22:00 +0200
        Re: [tpmdd-devel] [PATCH] tpm: improve tpm_tis send() performance by  ignoring burstcount Ken Goldman <kgold@linux.vnet.ibm.com> - 2017-08-09 22:30 +0200
          Aw: Re: [tpmdd-devel] [PATCH] tpm: improve tpm_tis send()  performance by ignoring burstcount "Peter Huewe" <PeterHuewe@gmx.de> - 2017-08-09 23:10 +0200
            Re: Re: [tpmdd-devel] [PATCH] tpm: improve tpm_tis send()  performance by ignoring burstcount Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2017-08-11 13:20 +0200
              Re: Re: [tpmdd-devel] [PATCH] tpm: improve tpm_tis send()  performance by ignoring burstcount Mimi Zohar <zohar@linux.vnet.ibm.com> - 2017-08-11 17:40 +0200
                Re: Re: [tpmdd-devel] [PATCH] tpm: improve tpm_tis send()  performance by ignoring burstcount Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2017-08-14 13:00 +0200
                  Re: Re: [tpmdd-devel] [PATCH] tpm: improve tpm_tis send()  performance by ignoring burstcount Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2017-08-14 13:00 +0200
                    Re: Re: [tpmdd-devel] [PATCH] tpm: improve tpm_tis send()  performance by ignoring burstcount Mimi Zohar <zohar@linux.vnet.ibm.com> - 2017-08-14 14:10 +0200
                      Re: Re: [tpmdd-devel] [PATCH] tpm: improve tpm_tis send()  performance by ignoring burstcount Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2017-08-15 08:10 +0200
                    Re: Re: [tpmdd-devel] [PATCH] tpm: improve tpm_tis send()  performance by ignoring burstcount Mimi Zohar <zohar@linux.vnet.ibm.com> - 2017-08-14 14:20 +0200
                      Re: Re: [tpmdd-devel] [PATCH] tpm: improve tpm_tis send()  performance by ignoring burstcount Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2017-08-15 08:10 +0200
            Re: Aw: Re: [tpmdd-devel] [PATCH] tpm: improve tpm_tis send()  performance by ignoring burstcount Ken Goldman <kgold@linux.vnet.ibm.com> - 2017-08-11 23:40 +0200
              Re: [tpmdd-devel] [PATCH] tpm: improve tpm_tis send() performance  by ignoring burstcount msuchanek <msuchanek@suse.de> - 2017-08-14 02:00 +0200
                Re: [tpmdd-devel] [PATCH] tpm: improve tpm_tis send() performance by  ignoring burstcount Ken Goldman <kgold@linux.vnet.ibm.com> - 2017-08-16 00:10 +0200
                  Re: [tpmdd-devel] [PATCH] tpm: improve tpm_tis send() performance  by ignoring burstcount Michal Suchánek <msuchanek@suse.de> - 2017-08-16 12:30 +0200
          Re: [Linux-ima-devel] [tpmdd-devel] [PATCH] tpm: improve tpm_tis  send() performance by ignoring burstcount Ken Goldman <kgold@linux.vnet.ibm.com> - 2017-08-11 23:50 +0200
    Re: [PATCH] tpm: improve tpm_tis send() performance by ignoring  burstcount Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2017-08-08 21:10 +0200

Page 2 of 2 — ← Prev page 1 [2]


#1710591 — Re: [tpmdd-devel] [PATCH] tpm: improve tpm_tis send() performance by ignoring burstcount

Frommsuchanek <msuchanek@suse.de>
Date2017-08-14 02:00 +0200
SubjectRe: [tpmdd-devel] [PATCH] tpm: improve tpm_tis send() performance by ignoring burstcount
Message-ID<ueaXv-5an-1@gated-at.bofh.it>
In reply to#1709983
Hello,

On Fri, 11 Aug 2017 17:32:12 -0400
Ken Goldman <kgold@linux.vnet.ibm.com> wrote:

> On 8/9/2017 5:00 PM, Peter Huewe wrote:
> > 
> > Since we are the linux kernel, we do have to care for legacy
> > devices. And a system with LPC, PS2Mouse on SuperIO and a TPM are
> > not that uncommon.
> > 
> > And heck, we even have support for 1.1b TPM devices....  
> 
> Understood.  However, remember that SuperIO is a 1980's device that
> predates the TPM.  Since the TPM requires special LPC bus cycles, it's
> even less likely that an old chipset has an attached TPM.

Where are the PS/2 ports attached today? 

About 500 out of 700 mainboards sold today has a PS/2 port which is
probably due to prevalence of legacy devices and usbhid limitations.

Similarily many boards have serial and parallel hardware ports.

In all diagrams detailed enough to show these ports I have seen them
attached to the LPC bus.

Thanks

Michal

[toc] | [prev] | [next] | [standalone]


#1712495 — Re: [tpmdd-devel] [PATCH] tpm: improve tpm_tis send() performance by ignoring burstcount

FromKen Goldman <kgold@linux.vnet.ibm.com>
Date2017-08-16 00:10 +0200
SubjectRe: [tpmdd-devel] [PATCH] tpm: improve tpm_tis send() performance by ignoring burstcount
Message-ID<ueSca-76K-25@gated-at.bofh.it>
In reply to#1710591
On 8/13/2017 7:53 PM, msuchanek wrote:
> About 500 out of 700 mainboards sold today has a PS/2 port which is
> probably due to prevalence of legacy devices and usbhid limitations.
> 
> Similarily many boards have serial and parallel hardware ports.
> 
> In all diagrams detailed enough to show these ports I have seen them
> attached to the LPC bus.

Do these boards have a TPM?  Remember that the TPM requires special LPC 
bus cycles.

Even if so, the TPM LPC bus wait states are less than a usec.  My 
thought is that  it's unlikely that any device (serial port, mouse, 
keyboard, printer) will be adversely affected.

[toc] | [prev] | [next] | [standalone]


#1712825 — Re: [tpmdd-devel] [PATCH] tpm: improve tpm_tis send() performance by ignoring burstcount

FromMichal Suchánek <msuchanek@suse.de>
Date2017-08-16 12:30 +0200
SubjectRe: [tpmdd-devel] [PATCH] tpm: improve tpm_tis send() performance by ignoring burstcount
Message-ID<uf3Kh-5PQ-5@gated-at.bofh.it>
In reply to#1712495
On Tue, 15 Aug 2017 18:02:57 -0400
Ken Goldman <kgold@linux.vnet.ibm.com> wrote:

> On 8/13/2017 7:53 PM, msuchanek wrote:
> > About 500 out of 700 mainboards sold today has a PS/2 port which is
> > probably due to prevalence of legacy devices and usbhid limitations.
> > 
> > Similarily many boards have serial and parallel hardware ports.
> > 
> > In all diagrams detailed enough to show these ports I have seen them
> > attached to the LPC bus.  
> 
> Do these boards have a TPM?  Remember that the TPM requires special
> LPC bus cycles.

Out of nearly 700 boards over 500 have PS/2 connector and over 400
have TPM slot (which is subset of the PS/2 enabled boards). Some more
possibly have on-board TPM chip.

> 
> Even if so, the TPM LPC bus wait states are less than a usec.  My 
> thought is that  it's unlikely that any device (serial port, mouse, 
> keyboard, printer) will be adversely affected.

Yes, in theory this is negligible. So unless there is a possibility
these wait states chain or the device otherwise takes over the bus for
extended period of time this should be fine.

Thanks

Michal

[toc] | [prev] | [next] | [standalone]


#1709985 — Re: [Linux-ima-devel] [tpmdd-devel] [PATCH] tpm: improve tpm_tis send() performance by ignoring burstcount

FromKen Goldman <kgold@linux.vnet.ibm.com>
Date2017-08-11 23:50 +0200
SubjectRe: [Linux-ima-devel] [tpmdd-devel] [PATCH] tpm: improve tpm_tis send() performance by ignoring burstcount
Message-ID<udpYB-i2-5@gated-at.bofh.it>
In reply to#1707847
Following up on this thread based on this week's TCG call ...

1 - burstCount can safely be ignored on writes.  This is explicit in
most places in the TCG spec.  In places where it is not explicit, it was 
simply an editorial omission.  We are going through the spec and adding 
"without incurring wait states."

TCG is willing to publish an errata if that makes developers more 
comfortable.

2 - These are multi-mhz buses.  The TPM vendors conformed that wait 
states, even if incurred, will be sub-usec.  I.e., less that a microsecond.

Essentially, the DD is loading the FIFO, and the TPM is unloading the 
FIFO at processor speeds.

Thus, even if one were worried about an odd system new enough to have a 
TPM, but old enough to have an LPC attached printer, keyboard, mouse or 
floppy, the delay in printing or typing will be insignificant.

3 - I asked several platform vendors with long TCG experience, and they 
said that they know of no motherboards that share the LPC bus with a TPM 
plus another device.

[toc] | [prev] | [next] | [standalone]


#1706831 — Re: [PATCH] tpm: improve tpm_tis send() performance by ignoring burstcount

FromJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Date2017-08-08 21:10 +0200
SubjectRe: [PATCH] tpm: improve tpm_tis send() performance by ignoring burstcount
Message-ID<uci37-4cO-13@gated-at.bofh.it>
In reply to#1705387
On Mon, Aug 07, 2017 at 07:46:32AM -0400, Nayna Jain wrote:
> The TPM burstcount status indicates the number of bytes that can
> be sent to the TPM without causing bus wait states.  Effectively,
> it is the number of empty bytes in the command FIFO. Further,
> some TPMs have a static burstcount, when the value remains zero
> until the entire FIFO is empty.
> 
> This patch ignores burstcount, permitting wait states, and thus
> writes the command as fast as the TPM can accept the bytes.
> The performance of a 34 byte extend on a TPM 1.2 improved from
> 52 msec to 11 msec.
> 
> Suggested-by: Ken Goldman <kgold@linux.vnet.ibm.com> in
> conjunction with the TPM Device Driver work group.
> Signed-off-by: Nayna Jain <nayna@linux.vnet.ibm.com>
> Acked-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
> ---
>  drivers/char/tpm/tpm_tis_core.c | 45 ++---------------------------------------
>  1 file changed, 2 insertions(+), 43 deletions(-)
> 
> diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
> index b617b2eeb080..478cbc0f61c3 100644
> --- a/drivers/char/tpm/tpm_tis_core.c
> +++ b/drivers/char/tpm/tpm_tis_core.c
> @@ -255,9 +255,7 @@ static int tpm_tis_recv(struct tpm_chip *chip, u8 *buf, size_t count)
>  static int tpm_tis_send_data(struct tpm_chip *chip, u8 *buf, size_t len)
>  {
>  	struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev);
> -	int rc, status, burstcnt;
> -	size_t count = 0;
> -	bool itpm = priv->flags & TPM_TIS_ITPM_WORKAROUND;
> +	int rc, status;

As you anyway edit that line you could turn this as:

int rc;
int status;

>  	status = tpm_tis_status(chip);
>  	if ((status & TPM_STS_COMMAND_READY) == 0) {
> @@ -270,49 +268,10 @@ static int tpm_tis_send_data(struct tpm_chip *chip, u8 *buf, size_t len)
>  		}
>  	}
>  
> -	while (count < len - 1) {
> -		burstcnt = get_burstcount(chip);
> -		if (burstcnt < 0) {
> -			dev_err(&chip->dev, "Unable to read burstcount\n");
> -			rc = burstcnt;
> -			goto out_err;
> -		}
> -		burstcnt = min_t(int, burstcnt, len - count - 1);
> -		rc = tpm_tis_write_bytes(priv, TPM_DATA_FIFO(priv->locality),
> -					 burstcnt, buf + count);
> -		if (rc < 0)
> -			goto out_err;
> -
> -		count += burstcnt;
> -
> -		if (wait_for_tpm_stat(chip, TPM_STS_VALID, chip->timeout_c,
> -					&priv->int_queue, false) < 0) {
> -			rc = -ETIME;
> -			goto out_err;
> -		}
> -		status = tpm_tis_status(chip);
> -		if (!itpm && (status & TPM_STS_DATA_EXPECT) == 0) {
> -			rc = -EIO;
> -			goto out_err;
> -		}
> -	}
> -
> -	/* write last byte */
> -	rc = tpm_tis_write8(priv, TPM_DATA_FIFO(priv->locality), buf[count]);
> +	rc = tpm_tis_write_bytes(priv, TPM_DATA_FIFO(priv->locality), len, buf);
>  	if (rc < 0)
>  		goto out_err;
>  
> -	if (wait_for_tpm_stat(chip, TPM_STS_VALID, chip->timeout_c,
> -				&priv->int_queue, false) < 0) {
> -		rc = -ETIME;
> -		goto out_err;
> -	}
> -	status = tpm_tis_status(chip);
> -	if (!itpm && (status & TPM_STS_DATA_EXPECT) != 0) {
> -		rc = -EIO;
> -		goto out_err;
> -	}
> -
>  	return 0;
>  
>  out_err:
> -- 
> 2.13.3

Here's an open question that I do not know the answer: can ignoring
burst count cause hardware issues in the field? The commit message
does not sort it out so I don't really feel safe merging this commit.

/Jarkko

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | linux.kernel


csiph-web