From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 73896 invoked by alias); 17 Nov 2018 14:00:56 -0000 Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org Received: (qmail 38450 invoked by uid 89); 17 Nov 2018 14:00:23 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: =?ISO-8859-1?Q?No, score=4.1 required=5.0 tests=BAYES_00,BODY_8BITS,FREEMAIL_FROM,GARBLED_BODY,LIKELY_SPAM_BODY,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=no version=3.3.2 spammy=H*r:sk:systemt, 17=e6, reply!, 2018=e5=b9=b411=e6?= X-HELO: mail-ua1-f45.google.com Received: from mail-ua1-f45.google.com (HELO mail-ua1-f45.google.com) (209.85.222.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 17 Nov 2018 14:00:21 +0000 Received: by mail-ua1-f45.google.com with SMTP id z24so9252308ual.8 for ; Sat, 17 Nov 2018 06:00:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=14rGHix1l347eROkYeF+X3t1xIL7v6+eKLe+7UiITbw=; b=JMCMIq9vEiFzDsWRhW9Gt6Gjxb0GKv37MuIAqbaXMHW9e0xIE2CT3JkNotb5xtIOS+ kiVGYy1PtSKxs+GXLilqjgb/qUlkTeBseHqQutNjt32kZXMNctoh2lALDx0UTp1zj26t FAC29Dag3Jzk8jcdI6/jtutcLJAydSABeqGkL4SeuCpdPWkDdZJGGOq25OAOECk5aFBI cF/iEhtzTAN0Xkpd2sduFeI/KjTNCBpiaKgENQ1MlABXDpvHS8wC5V9bITD/LeUqPS90 lIzd0PRapj8WG0KcSnVFKz56p5Q/VoLiqPKy4zQDAzPwPNmHBsWYHRpIx00t+YOBbY0v ys/w== MIME-Version: 1.0 References: <87zhu8hg0q.fsf@redhat.com> In-Reply-To: <87zhu8hg0q.fsf@redhat.com> From: Zexuan Luo Date: Sat, 17 Nov 2018 14:00:00 -0000 Message-ID: Subject: Re: [QUESTION] Is it safe to use lock in systemtap tapset? To: fche@redhat.com Cc: systemtap@sourceware.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2018-q4/txt/msg00107.txt.bz2 Thank you for your reply! Frank Ch. Eigler =E4=BA=8E2018=E5=B9=B411=E6=9C=8817=E6= =97=A5=E5=91=A8=E5=85=AD =E4=B8=8A=E5=8D=885:24=E5=86=99=E9=81=93=EF=BC=9A > > > spacewanderlzx wrote: > > > I am searching for some information about lock usage in the systemtap > > tapset. > > The general advice is to avoid explicit locking in embedded-C functions, > since they may in principle run in any context, including atomic. I am > not sure how explicitly we spell this out in [man stap] or > tapset/DEVGUIDE. > > > > Is it safe to use lock in systemtap tapset? > > Maybe the answer is different for tapset used in different context > > (timers, kernel.function, process.function, etc.)? > > Which kind of lock should I use in the tapset? > > It depends on the shared resource you are concerned about, in what > probe/context you want to access them, whether you want to read or > write, and whether you can tolerate corrupt data or not. > > Note: systemtap's own script-level global variables (and hidden runtime > state) are all already protected automatically. There's no need to > initialize or worry about locking them. (This is a unique feature in > systemtap, in contrast to almost every other tracing/probing system.) > > > - FChE