From owner-dev-commits-src-main@freebsd.org Tue Dec 29 17:39:35 2020 Return-Path: Delivered-To: dev-commits-src-main@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 DC5B04C5F63 for ; Tue, 29 Dec 2020 17:39:35 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (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 4D51rR5ZY9z4sMP for ; Tue, 29 Dec 2020 17:39:35 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wm1-f54.google.com with SMTP id 190so3100632wmz.0 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=p/EqhtVRBHsyS2chrCD/aMoLSnTBhTOsQ1R6fqGLYledUjuqLG3OE+825MQP9bJYQD jwKMZc9Y0tU53jDRF28ihU1OIkoocc37cu2hdVQdwVAPWzoAuJOS7G/fi4VQHrT6gaID ifFqu7NM0UekOX4ACg+NSJd8YnIWBOOkoh7YO8zYeixQzKqY+3AR4lWip2eoWlfFzCKQ fB1mekwbWtlPtuFTNK9qsPQ8LPb7WFo4Fm+E9oCGVgT6kACAT82+4X0st2mcsEHDwwdy VkduvwD9qQ25FYzyzFZN0aZdWoFsmKE3OzWzJrYq53CvxZ/iDukDgDYIfihv5EvvUSaF 4Lmg== X-Gm-Message-State: AOAM531/54I+S/hso1crk04r9DrF4AJCQD/iDT/XiuAuSHJ4u4F9h45q m+pRXrxPRbbvlvEKmFlSx4j6lQ== 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: 4D51rR5ZY9z4sMP 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "Commit messages for the main branch 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