From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) by sourceware.org (Postfix) with ESMTPS id 9ABE1385801D for ; Fri, 2 Apr 2021 18:42:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 9ABE1385801D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rtems.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=joel.sherrill@gmail.com Received: by mail-lf1-f47.google.com with SMTP id o126so8778253lfa.0 for ; Fri, 02 Apr 2021 11:42:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=mMT0c6ibTF2SlIT8BmLV3Oju1z09CsOvYyoeJ376eCA=; b=dfPFaebnXLqVXP5Cd8cjmuv/b7WiQQZ2HFMEzvg0Ny0yi8wQNaUysayjxWUNemMPKD 7whtlEwwoTZYbkikktgfNtGz84YbPZFFudWJDYrJmiD/6ucPTILIZPvkqRja2aalT90C xMPLLFvrcYwa3zRUIRRJUQihWk+fyj3gm4jukQo0Gn9E8H0lLYTImE6Xe32SH3p2uRZw i2dwZnIqq7wvy9ZnimM+62zGRAVDdFy7Wd4Kz76e9oBiA8jZoNMODVmLe8U8a2oiZf/8 8d9wta1XiC3O2S2pMR3lu7OhNLkTyQrEwfby9zd+0HEcX4P4kVudIan0PAJ0DQc2e7+G HxAQ== X-Gm-Message-State: AOAM532XcNIcBP5u65dSe59gFKH+DFSb1ryiYdmQz/holfR6ZRMKgDFG i9hWrwXJ+4ulSJ6nriwOCFyxxsUCuME= X-Google-Smtp-Source: ABdhPJwT6LD2AYI0MxO89unzyuzCFcmig7EtRVzmMjwkwhjcb+FTDbu0pM3sy2P+wUoaHJu8Nxlzig== X-Received: by 2002:a19:4c08:: with SMTP id z8mr9191629lfa.157.1617388970934; Fri, 02 Apr 2021 11:42:50 -0700 (PDT) Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com. [209.85.167.48]) by smtp.gmail.com with ESMTPSA id a18sm961134ljj.106.2021.04.02.11.42.50 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 02 Apr 2021 11:42:50 -0700 (PDT) Received: by mail-lf1-f48.google.com with SMTP id d12so8685541lfv.11 for ; Fri, 02 Apr 2021 11:42:50 -0700 (PDT) X-Received: by 2002:a05:6512:108b:: with SMTP id j11mr9297746lfg.289.1617388969900; Fri, 02 Apr 2021 11:42:49 -0700 (PDT) MIME-Version: 1.0 References: <05ad18dabb56d23d26f1d9c493bcce0c@nicolachel.net> <15c0dc57-264d-18b8-5589-87e50288f39f@nadler.com> <9d80da2e-002d-dc4e-7608-f70211291f47@nadler.com> In-Reply-To: <9d80da2e-002d-dc4e-7608-f70211291f47@nadler.com> Reply-To: joel@rtems.org From: Joel Sherrill Date: Fri, 2 Apr 2021 13:42:38 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Fw: Some questions on reentrancy, __DYNAMIC_REENT__ and _impure_ptr To: Dave Nadler Cc: Craig Howland , Newlib X-Spam-Status: No, score=-3031.9 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, HTML_MESSAGE, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Apr 2021 18:42:54 -0000 On Fri, Apr 2, 2021 at 1:35 PM Dave Nadler wrote: > Sorry if I was not clear: If you use one memory location for _impure_ptr, > and you have two processors running two threads, this does not work. > Instead an alternate mechanism (ie thread-local storage for this ptr) is > needed, > to support each concurrent thread with a separate reentrancy structure. > Hope I was clear this time! > I understood it before but RTEMS has SMP support and we dealt with this issue a few years ago so I had background. You want to make sure the _impure_ptr is "thread local" whatever that means in the OS adaptation. And you should be careful to implement the locking support used in some parts of newlib. --joel > Thanks, > Best Regards, Dve > > On 4/2/2021 12:51 PM, C Howland via Newlib wrote: > >> ------------------------------ > >> *From:* Newlib on behalf of Dave > Nadler < > >> drn@nadler.com> > >> *Sent:* Friday, April 2, 2021 7:34 AM > >> *To:* Nick > >> *Cc:* newlib@sourceware.org > >> *Subject:* Re: Some questions on reentrancy, __DYNAMIC_REENT__ and > >> _impure_ptr > >> > >> > >> Thanks Jeff also for answering the mutex question I missed. > >> One other issue I should have mentioned that becomes more important > daily: > >> If there are multiple processors the simple _impure_ptr mechanism won't > >> work... > >> > > Well, if you ignore the fact you have multiple processors and do nothing > > about it, then, sure, you'll have problems. But if you manage it (e.g. > > treating each processor as its own thread, or as independent of each > other, > > etc.), then multiple processors can work fine. (I have such systems > > working.) > > Craig > > > -- > Dave Nadler, USA East Coast voice (978) 263-0097, drn@nadler.com, Skype > Dave.Nadler1 > >