public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nish Aravamudan <nish.aravamudan@gmail.com>
To: Kylene Hall <kjhall@us.ibm.com>
Cc: linux-kernel@vger.kernel.org, greg@kroah.com,
	sailer@watson.ibm.com, leendert@watson.ibm.com,
	emilyr@us.ibm.com, toml@us.ibm.com,
	tpmdd-devel@lists.sourceforge.net
Subject: Re: [PATCH 1/1] driver: Tpm hardware enablement --updated version
Date: Tue, 21 Dec 2004 08:51:49 -0800	[thread overview]
Message-ID: <29495f1d041221085144b08901@mail.gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.58.0412201146060.10943@jo.austin.ibm.com>

On Mon, 20 Dec 2004 11:50:00 -0600 (CST), Kylene Hall <kjhall@us.ibm.com> wrote:
> This patch is a device driver to enable new hardware.  The new hardware is
> the TPM chip as described by specifications at 
> <http://www.trustedcomputinggroup.org>.  The TPM chip will enable you to
> use hardware to securely store and protect your keys and personal data.
> To use the chip according to the specification, you will need the Trusted
> Software Stack (TSS) of which an implementation for Linux is available at:
> <http://sourceforge.net/projects/trousers>.
> 
> > > Updates include: splitting out the vendor specific code into separated
> > > drivers from the base TPM functionality, fixed busy waiting loops,
> > > concerns about timer handling and rmmod, buffer name.
> 
> > Updates include a consolodated buffer mutex, numerous naming improvements,
> > better placement of pci_driver and file_operations structure
> > initializations, change to use of EXPORT_SYMBOL_GPL, improvement of
> > Kconfig help texts and creation of a tpm directory
> 
> Updates include moving the pci_ids table into the individual vendor
> specific .c files and including a tpm description file in the
> Documentation directory.
> 
> Thanks,
> Kylene
> 
> Signed-off-by: Leendert van Doorn <leendert@watson.ibm.com>
> Signed-off-by: Reiner Sailer <sailer@watson.ibm.com>
> Signed-off-by: Dave Safford <safford@watson.ibm.com>
> Signed-off-by: Kylene Hall <kjhall@us.ibm.com>

<snip>

> diff -uprN linux-2.6.9/drivers/char/tpm/tpm.c linux-2.6.9-tpm/drivers/char/tpm/tpm.c
> --- linux-2.6.9/drivers/char/tpm/tpm.c  1969-12-31 18:00:00.000000000 -0600
> +++ linux-2.6.9-tpm/drivers/char/tpm/tpm.c      2004-12-17 17:40:21.000000000 -0600
> @@ -0,0 +1,508 @@
> +/*
> + * Copyright (C) 2004 IBM Corporation
> + *
> + * Authors:
> + * Leendert van Doorn <leendert@watson.ibm.com>
> + * Reiner Sailer <sailer@watson.ibm.com>
> + * Dave Safford <safford@watson.ibm.com>
> + * Kylene Hall <kjhall@us.ibm.com>
> + *
> + * Maintained by: <tpmdd_devel@lists.sourceforge.net>
> + *
> + * Device driver for TCG/TCPA TPM (trusted platform module).
> + * Specifications at www.trustedcomputinggroup.org
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License as
> + * published by the Free Software Foundation, version 2 of the
> + * License.
> + *
> + * Note, the TPM chip is not interrupt driven (only polling)
> + * and can have very long timeouts (minutes!). Hence the unusual
> + * calls to schedule_timeout.

<snip>

> +       do {
> +               u8 status = inb(chip->vendor->base + 1);
> +               if ((status & chip->vendor->req_complete_mask) ==
> +                   chip->vendor->req_complete_val) {
> +                       down(&chip->timer_manipulation_mutex);
> +                       del_singleshot_timer_sync(&chip->device_timer);
> +                       up(&chip->timer_manipulation_mutex);
> +                       goto out_recv;
> +               }
> +               schedule_timeout(TPM_TIMEOUT);
> +               rmb();
> +       } while (!chip->time_expired);

All of these calls to schedule_timeout() are broken. You must set the
state appropriately before calling schedule_timeout() or it will
return immediately. For your reference here is the difference between
the two states with respects to calling schedule_timeout() directly:

TASK_INTERRUPTIBLE: sleep, waking up early on both signals and waitqueue events
TASK_UNINTERRUPTIBLE: sleep, waking up early on watiqueue events

Keep in mind that if TASK_INTERRUPTIBLE is used, you *must* be
prepared to handle signals (check return value, indicating an early
return, and signals_pending(current), indicating whether the cause of
early return is either a signal or waitqueue event).

Also, as a final consideration, because of the way the loadavg is
calculated, a TASK_UNINTERRUPTIBLE sleep will factor in as a 1 to the
load.

-Nish

  reply	other threads:[~2004-12-21 16:52 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-09 15:25 [PATCH 1/1] driver: Tpm hardware enablement Kylene Hall
2004-12-09 15:48 ` Arjan van de Ven
2004-12-09 17:06   ` Kylie Hall
2004-12-11  8:31     ` Nish Aravamudan
2004-12-10 20:45   ` Alan Cox
2004-12-10 10:56 ` Ian Campbell
2004-12-10 15:28   ` Kylene Hall
2004-12-10 15:41     ` Ian Campbell
2004-12-10 18:39       ` [tpmdd-devel] " Kylene Hall
2004-12-14  9:59         ` Ian Campbell
2004-12-16 22:37 ` [PATCH 1/1] driver: Tpm hardware enablement --updated version Kylene Hall
2004-12-16 22:48   ` Greg KH
2004-12-17 22:47     ` [tpmdd-devel] " Kylene Hall
2004-12-17  0:53   ` Chris Wright
2004-12-17 22:47     ` [tpmdd-devel] " Kylene Hall
2004-12-17 22:47   ` Kylene Hall
2004-12-17 22:59     ` Greg KH
2004-12-20 17:50     ` Kylene Hall
2004-12-21 16:51       ` Nish Aravamudan [this message]
2004-12-21 18:19         ` Kylene Hall
2005-01-12 18:45           ` Kylene Hall
2005-01-12 23:28             ` Greg KH
2005-01-18 22:29             ` [PATCH 1/1] tpm: fix cause of SMP stack traces Kylene Hall
2005-01-18 22:37               ` Chris Wright
2005-01-18 22:44                 ` Kylene Hall
2005-01-18 22:47                   ` Chris Wright
2005-01-18 22:47               ` Greg KH
2005-01-18 23:07                 ` Kylene Hall
2005-01-18 23:39               ` [PATCH 1/1] tpm: fix cause of SMP stack traces -- updated version Kylene Hall
2005-01-28 21:45                 ` [PATCH 1/1] tpm: insert missing up mutex in an error path Kylene Hall
2005-01-31 19:27                   ` [PATCH 1/1] tpm: insert missing up mutex in an error path, typo build fix -- updated version Kylene Hall
2005-02-03 16:40                     ` [PATCH 1/1] tpm: remove pci specific stuff from the underlying generic driver Kylene Hall
2005-02-04 20:12                       ` [PATCH 1/1] tpm: implement use of sysfs classes Kylene Hall
2005-02-04 20:52                         ` Greg KH
2005-02-04 21:37                           ` Kylene Hall
2005-02-04 21:51                             ` Greg KH
2005-02-09 18:05                               ` [PATCH 1/1] tpm: update tpm sysfs file ownership Kylene Hall
2005-02-09 18:17                                 ` Greg KH
2005-02-09 20:35                                   ` [tpmdd-devel] Re: [PATCH 1/1] tpm: update tpm sysfs file ownership - updated version Kylene Hall
2005-02-09 22:04                                     ` Chris Wright
2005-02-10 15:40                                       ` Kylene Hall
2005-02-01  8:28                 ` [PATCH 1/1] tpm: fix cause of SMP stack traces -- " Greg KH
2004-12-19 19:48   ` [PATCH 1/1] driver: Tpm hardware enablement --updated version Pavel Machek

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=29495f1d041221085144b08901@mail.gmail.com \
    --to=nish.aravamudan@gmail.com \
    --cc=emilyr@us.ibm.com \
    --cc=greg@kroah.com \
    --cc=kjhall@us.ibm.com \
    --cc=leendert@watson.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sailer@watson.ibm.com \
    --cc=toml@us.ibm.com \
    --cc=tpmdd-devel@lists.sourceforge.net \
    /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