lkml.org 
[lkml]   [2019]   [Nov]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH resend] staging: vc04_services: replace g_free_fragments_mutex with spinlock
    From
    Date
    Hi Davidlohr,

    Am 01.11.19 um 19:29 schrieb Davidlohr Bueso:
    > There is no need to be using a semaphore, or a sleeping lock
    > in the first place: critical region is extremely short, does not
    > call into any blocking calls and furthermore lock and unlocking
    > operations occur in the same context.
    >
    > Get rid of another semaphore user by replacing it with a spinlock.
    >
    > Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
    > ---
    > This is in an effort to further reduce semaphore users in the kernel.
    >
    > This is a resend, which just seems simpler given the confusions.
    >
    > .../staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | 10 +++++-----
    > 1 file changed, 5 insertions(+), 5 deletions(-)
    >
    > diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
    > index 8dc730cfe7a6..710d21654128 100644
    > --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
    > +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
    > @@ -63,7 +63,7 @@ static char *g_free_fragments;
    > static struct semaphore g_free_fragments_sema;
    > static struct device *g_dev;
    >
    > -static DEFINE_SEMAPHORE(g_free_fragments_mutex);
    > +static DEFINE_SPINLOCK(g_free_fragments_lock);
    >
    > static irqreturn_t
    > vchiq_doorbell_irq(int irq, void *dev_id);
    > @@ -528,11 +528,11 @@ create_pagelist(char __user *buf, size_t count, unsigned short type)
    >
    > WARN_ON(g_free_fragments == NULL);
    >
    > - down(&g_free_fragments_mutex);
    > + spin_lock(&g_free_fragments_lock);
    > fragments = g_free_fragments;
    > WARN_ON(fragments == NULL);
    > g_free_fragments = *(char **) g_free_fragments;
    > - up(&g_free_fragments_mutex);
    > + spin_unlock(&g_free_fragments_lock);
    >

    the reason why Greg cannot apply this patch is that you are using an old
    or the wrong git tree.

    Please make sure you use the following one (or a mirror):

    https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git

    and operate on the branch staging-next

    Please fix this up and send a new version.

    Regards
    Stefan


    \
     
     \ /
      Last update: 2019-11-02 11:34    [W:7.432 / U:0.020 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site