lkml.org 
[lkml]   [2009]   [Apr]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[patch 07/13] GRU - support contexts with zero dsrs or cbrs
    From: Jack Steiner <steiner@sgi.com>

    Support alocation of GRU contexts that contain zero DSR or CBR
    resources. Some instructions do not require DSR resources.
    Contexts without CBR resources are useful for diagnostics.

    Signed-off-by: Jack Steiner <steiner@sgi.com>

    ---
    drivers/misc/sgi-gru/grufile.c | 6 ++----
    drivers/misc/sgi-gru/grumain.c | 4 ++--
    2 files changed, 4 insertions(+), 6 deletions(-)

    Index: linux/drivers/misc/sgi-gru/grufile.c
    ===================================================================
    --- linux.orig/drivers/misc/sgi-gru/grufile.c 2009-02-27 17:58:21.000000000 -0600
    +++ linux/drivers/misc/sgi-gru/grufile.c 2009-02-27 17:59:24.000000000 -0600
    @@ -135,11 +135,9 @@ static int gru_create_new_context(unsign
    if (copy_from_user(&req, (void __user *)arg, sizeof(req)))
    return -EFAULT;

    - if (req.data_segment_bytes == 0 ||
    - req.data_segment_bytes > max_user_dsr_bytes)
    + if (req.data_segment_bytes > max_user_dsr_bytes)
    return -EINVAL;
    - if (!req.control_blocks || !req.maximum_thread_count ||
    - req.control_blocks > max_user_cbrs)
    + if (req.control_blocks > max_user_cbrs || !req.maximum_thread_count)
    return -EINVAL;

    if (!(req.options & GRU_OPT_MISS_MASK))
    Index: linux/drivers/misc/sgi-gru/grumain.c
    ===================================================================
    --- linux.orig/drivers/misc/sgi-gru/grumain.c 2009-02-27 17:58:17.000000000 -0600
    +++ linux/drivers/misc/sgi-gru/grumain.c 2009-02-27 17:59:24.000000000 -0600
    @@ -150,7 +150,7 @@ static unsigned long reserve_resources(u
    unsigned long bits = 0;
    int i;

    - do {
    + while (n--) {
    i = find_first_bit(p, mmax);
    if (i == mmax)
    BUG();
    @@ -158,7 +158,7 @@ static unsigned long reserve_resources(u
    __set_bit(i, &bits);
    if (idx)
    *idx++ = i;
    - } while (--n);
    + }
    return bits;
    }



    \
     
     \ /
      Last update: 2009-04-06 18:15    [W:2.958 / U:0.024 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site