From owner-dev-commits-src-all@freebsd.org Tue Dec 29 17:39:35 2020 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DC39F4C62E7 for ; Tue, 29 Dec 2020 17:39:35 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4D51rR5T0Nz4sGS for ; Tue, 29 Dec 2020 17:39:35 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wm1-f45.google.com with SMTP id v14so3096345wml.1 for ; Tue, 29 Dec 2020 09:39:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=qPjf58qEwfir+v6FB4mZQ5EygngGGuSCAMjRmthgywU=; b=ji/blma5uOyDANmnfP1X7bQ1vYh8/Hyeyh5212ge8+6OdE1H7buazhvDf4dyg0WBaR jZHY0Wh+CxfhVcJGAV0Cho7xBojJpE3iYJyi+RF6rJ3zSvLm3/ihplD7obsMJsfPZXtX xkejDsqZeoUcAEGfl/uktVOExOAeUjpMdbONROWUNlgryfWPf7mPRs59ePZ8vHTIl4+x d91gGAKz7tdcBlTYKpUtZE4H+CSRdZxmPI71Rphfsl66x2zal/t8dlcHnkDRoh2swcTN 5yzOLlTqaExF3WwP0H4yIh11Abd7TPtnb/IbvlNkqVp6YUTT5ePjsNmi1i9cQxbBc38/ wHPA== X-Gm-Message-State: AOAM532GKjhmyx4tfhAJk5w/FkAC77XPo/kCzfdw6LreORswYaT3lauz Xyq4wNFPnzBzkkDnLcf2jYuWKg== X-Google-Smtp-Source: ABdhPJx8T8Cg98yTGEBQHFTYuNDXbeaHB/MrLkOx5Xyu7QSf7t1KErnpMosSOrwAYP9/i/rYf1xQRg== X-Received: by 2002:a1c:4d12:: with SMTP id o18mr4438746wmh.114.1609263574412; Tue, 29 Dec 2020 09:39:34 -0800 (PST) Received: from [192.168.149.251] (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id u10sm3911102wmd.43.2020.12.29.09.39.33 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Dec 2020 09:39:33 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Subject: Re: git: 89e3d5671ba1 - main - bsnmpclient(3): make it thread-safe From: Jessica Clarke In-Reply-To: Date: Tue, 29 Dec 2020 17:39:32 +0000 Cc: Edward Tomasz Napierala , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: References: <202012291500.0BTF0vGw034594@gitrepo.freebsd.org> To: Konstantin Belousov X-Mailer: Apple Mail (2.3608.120.23.2.4) X-Rspamd-Queue-Id: 4D51rR5T0Nz4sGS X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "Commit messages for all branches of the src repository." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Dec 2020 17:39:35 -0000 On 29 Dec 2020, at 17:38, Konstantin Belousov = wrote: > On Tue, Dec 29, 2020 at 03:11:55PM +0000, Jessica Clarke wrote: >> On 29 Dec 2020, at 15:00, Edward Tomasz Napierala = wrote: >>> diff --git a/contrib/bsnmp/lib/snmpclient.c = b/contrib/bsnmp/lib/snmpclient.c >>> index c22d8e125a14..e49105918416 100644 >>> --- a/contrib/bsnmp/lib/snmpclient.c >>> +++ b/contrib/bsnmp/lib/snmpclient.c >>> @@ -71,7 +71,7 @@ >>> #define DEBUG_PARSE 0 >>>=20 >>> /* global context */ >>> -struct snmp_client snmp_client; >>> +__thread struct snmp_client snmp_client; >>=20 >> That comment is no longer true. >>=20 >>> /* List of all outstanding requests */ >>> struct sent_pdu { >>> @@ -86,7 +86,7 @@ struct sent_pdu { >>> }; >>> LIST_HEAD(sent_pdu_list, sent_pdu); >>>=20 >>> -static struct sent_pdu_list sent_pdus; >>> +__thread static struct sent_pdu_list sent_pdus; >>>=20 >>> /* >>> * Prototype table entry. All C-structure produced by the table = function must >>> diff --git a/contrib/bsnmp/lib/snmpclient.h = b/contrib/bsnmp/lib/snmpclient.h >>> index a19bdb2ea653..1bc3780de038 100644 >>> --- a/contrib/bsnmp/lib/snmpclient.h >>> +++ b/contrib/bsnmp/lib/snmpclient.h >>> @@ -114,7 +114,7 @@ struct snmp_client { >>> }; >>>=20 >>> /* the global context */ >>> -extern struct snmp_client snmp_client; >>> +extern __thread struct snmp_client snmp_client; >>=20 >> Ditto. >>=20 >> Is there really a documented requirement for everything to be called >> from the same thread? I can see consumers of the library that already >> use proper locking breaking because of this. >=20 > So this variable is supposed to be used by consumers ? > The change requires the library version bump, at least. > I suppose libsnmpclient does not use symbol versioning ? The exported functions implicitly use them to track state. Jess