lkml.org 
[lkml]   [2009]   [Sep]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patches in this message
    /
    Date
    From
    Subject[PATCH] intel_txt: fix the buggy timeout warning logic in tboot
    This patch based on an original version by H. Peter Anvin fixed the buggy 
    timeout warning logic in tboot.

    ---
    arch/x86/kernel/tboot.c | 9 +++++----
    1 file changed, 5 insertions(+), 4 deletions(-)


    Signed-off-by: Shane Wang <shane.wang@intel.com>

    diff -r 0edd117ada44 arch/x86/kernel/tboot.c
    --- a/arch/x86/kernel/tboot.c Wed Sep 23 10:06:56 2009 -0700
    +++ b/arch/x86/kernel/tboot.c Mon Sep 28 07:42:18 2009 -0700
    @@ -301,16 +301,17 @@ static int tboot_wait_for_aps(int num_ap
    unsigned long timeout;

    timeout = AP_WAIT_TIMEOUT*HZ;
    - while (atomic_read((atomic_t *)&tboot->num_in_wfs) != num_aps &&
    - timeout) {
    + while (timeout) {
    + if (atomic_read((atomic_t *)&tboot->num_in_wfs) == num_aps)
    + break;
    mdelay(1);
    timeout--;
    }

    - if (timeout)
    + if (!timeout)
    pr_warning("tboot wait for APs timeout\n");

    - return !(atomic_read((atomic_t *)&tboot->num_in_wfs) == num_aps);
    + return !timeout;
    }

    static int __cpuinit tboot_cpu_callback(struct notifier_block *nfb,This patch based on an original version by H. Peter Anvin fixed the buggy timeout warning logic in tboot.

    Signed-off-by: Shane Wang <shane.wang@intel.com>

    diff -r 0edd117ada44 arch/x86/kernel/tboot.c
    --- a/arch/x86/kernel/tboot.c Wed Sep 23 10:06:56 2009 -0700
    +++ b/arch/x86/kernel/tboot.c Mon Sep 28 07:42:18 2009 -0700
    @@ -301,16 +301,17 @@ static int tboot_wait_for_aps(int num_ap
    unsigned long timeout;

    timeout = AP_WAIT_TIMEOUT*HZ;
    - while (atomic_read((atomic_t *)&tboot->num_in_wfs) != num_aps &&
    - timeout) {
    + while (timeout) {
    + if (atomic_read((atomic_t *)&tboot->num_in_wfs) == num_aps)
    + break;
    mdelay(1);
    timeout--;
    }

    - if (timeout)
    + if (!timeout)
    pr_warning("tboot wait for APs timeout\n");

    - return !(atomic_read((atomic_t *)&tboot->num_in_wfs) == num_aps);
    + return !timeout;
    }

    static int __cpuinit tboot_cpu_callback(struct notifier_block *nfb,
    \
     
     \ /
      Last update: 2009-09-29 04:29    [W:0.042 / U:242.652 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site