From owner-dev-commits-src-all@freebsd.org Tue Dec 29 15:11:59 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 823DB4C25CC for ; Tue, 29 Dec 2020 15:11:59 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) (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 4D4yZ733Xvz4hng for ; Tue, 29 Dec 2020 15:11:59 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wr1-f44.google.com with SMTP id i9so14927119wrc.4 for ; Tue, 29 Dec 2020 07:11:59 -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=9lKPZYnTOHd99mALxriWJ2Eh05/ip9YBseH1Gtql1FY=; b=ShDqpsRTbLr9pd0zw4+AepRBRmO+TWb/0dmi6NrHKNsg8pIylE0qA2WLAvRioHfX1C faB/QNgUtyqj3VicMsVxIW2dq98rW5eO5hq91vrMZr6hlCbPSEXRgjDpgS0fk0Axjyvo 0pmECNXavk67Z6c7N7dt0HT+jAV6HfN4woZMdlkS10+Pgru6p68NTmr7EV8YnHkdiQD6 ulLa+Nj7o0QVPwdGdFV/Wxa+hAT7lZBdZup6Pt+1KetyfkebYqosChstLZS7pNvs7Dwf zU4NOHrtzPmggwWOVUSb5LpG1Reh0f3EbqRu/9b4aAaEyNB+lpyEbW2jvC4NpucU7wF+ g/Vw== X-Gm-Message-State: AOAM531UYoh1mharH2rMGyUOQW1U2F2GIZQANupSgu/jiPdEMLxZMo9p xVNf+nwKUzYhle6Vb7jLs/cL9w== X-Google-Smtp-Source: ABdhPJzL2VJfALkQ2021CtQXfldYVA/UgBVKaL8wFDOvKXD8U/mrLIMKwsZ4bJYIWNf1NP4NfIWKmw== X-Received: by 2002:adf:97dd:: with SMTP id t29mr56190809wrb.357.1609254718101; Tue, 29 Dec 2020 07:11:58 -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 a62sm4184990wmh.40.2020.12.29.07.11.57 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Dec 2020 07:11:57 -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: <202012291500.0BTF0vGw034594@gitrepo.freebsd.org> Date: Tue, 29 Dec 2020 15:11:55 +0000 Cc: "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: Edward Tomasz Napierala X-Mailer: Apple Mail (2.3608.120.23.2.4) X-Rspamd-Queue-Id: 4D4yZ733Xvz4hng 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 15:11:59 -0000 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; That comment is no longer true. > /* 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; Ditto. 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. Jess