OpenAFS Master Repository branch, master, updated. openafs-devel-1_9_0-20-ge1e5df9

Gerrit Code Review gerrit@openafs.org
Fri, 23 Oct 2020 12:30:09 -0400


The following commit has been merged in the master branch:
commit e1e5df918fee00d4d9152c31c24cc1e7f23b71a6
Author: Mark Vitale <mvitale@sinenomine.net>
Date:   Mon Sep 18 19:45:10 2017 -0400

    stats: incorrect clock square algorithm
    
    Since the original IBM code import, OpenAFS has an algorithm for
    squaring clock values, implemented identically in three different
    places.  This algorithm does not account correctly for microsecs
    overflow into seconds, resulting in incorrect "sum-of-squares" values
    for queue and execution time in several OpenAFS performance utilities.
    
    Specifically, this code:
    
            t1.tv_usec += (2 * t2.tv_sec * t2.tv_usec) % 1000000                   \
                          + (t2.tv_usec / 1000)*(t2.tv_usec / 1000)                \
                          + 2 * (t2.tv_usec / 1000) * (t2.tv_usec % 1000) / 1000   \
                          + (((t2.tv_usec % 1000) > 707) ? 1 : 0);                 \
    
    Can allow for the tv_usec field to be increased by a theoretical max
    of around:
    
            t1.tv_usec += 999998                                                   \
                          + 999*999                                                \
                          + 2 * 999 * 999 / 1000                                   \
                          + 1;                                                     \
    
    Or:
    
            t1.tv_usec += 1999996;                                                 \
    
    If t1.tv_usec is already 999999, after this calculation its value
    could be as high as 2999995. So just checking once if t1.tv_usec is
    over 1000000 is not sufficient, since the resulting value (1999995) is
    still over 1000000.
    
    Correct all implementations by repeatedly checking if tv_usec is over
    1000000 after the above calculation:
    
    macro                   affected utility
    =====================   ============================
    afs_stats_SquareAddTo   xstat_cm_test
    fs_stats_SquareAddTo    xstat_fs_test
    clock_AddSq             rxstat_get_process and _peer
    
    Change-Id: I3145d592ba6bc1556729eac657f43d476c99eede
    Reviewed-on: https://gerrit.openafs.org/14376
    Tested-by: BuildBot <buildbot@rampaginggeek.com>
    Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
    Reviewed-by: Andrew Deason <adeason@sinenomine.net>
    Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

 src/afs/afs_stats.h  |    2 +-
 src/rx/rx_clock.h    |    2 +-
 src/viced/fs_stats.h |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

-- 
OpenAFS Master Repository