From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by sourceware.org (Postfix) with ESMTPS id 99DEC385B50A for ; Thu, 18 Apr 2024 20:36:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 99DEC385B50A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rivosinc.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 99DEC385B50A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::52e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713472599; cv=none; b=ozQneR5SWgqTcbD1QNbulfzKCOrvr8YTIywo+9QTV6tLPow0PAkDF98LdvA24JeXS2uRfwz8TKcruNu7AQmD3gP5AQu3UrlhUws4IjaBATqBuBCwaLRFa34Py26OgxLlinIZFY9qd1TGqtZ5VlsFvzMJAOzwneYHdAPunLjM7g4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713472599; c=relaxed/simple; bh=TdHiT/Iq5EVq81QwnFUUKFImBNj1akcor9p68j28BmE=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=uMAz7C9Vt+AiT7vscVr0m2/zOyCIijVm9PBOO0ZXyIAs5PXnlMhdO15LcJMIJWHNyjxu4nBu7wtvBk/1W1bv7lUMzpY/wssOj77ZH6iubBT6Sx59PzUgAnQ22nBrz1tmSwI0fjiUlTZDIcM3MjhZQUF/467QIhCnFZxW7ym4muc= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pg1-x52e.google.com with SMTP id 41be03b00d2f7-5cedfc32250so871777a12.0 for ; Thu, 18 Apr 2024 13:36:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1713472596; x=1714077396; darn=sourceware.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=1RZRr2eJca6nqwUFvDjPlVhiGw5EgOcsC84vy9UjxJk=; b=hpiI8PPhMdFeTOn8V8RTNfai4gh0F/tFIOK8VmPgwR+yzUUABuz2uzkHK/62y/6zMH VuzYYivIU4zKoY/sUkpqIq+j3m1M9D5M6TQA9imdPKGUS0+igaM834ldAiPAdf8reM+r 6JCn6I1T4843ZYtfDx3DvJNj3NcpjGnVN5+SzcdK9siUxunmzB1rW1Kk9HW7FUp0Iof0 uwbVHC0T7f0iQxaowX1qXinSOKzIwt3o4cXwF0lQsJfkH7WqfiqnhhN4aM2xE8GCcPuA Wwski2oDX2GKQf/+5ZYsAIY5GsBEh5CrzYnBH44UaPnsrEvtG9FPiJeHFwKluTzzMdEH 2EpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713472596; x=1714077396; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=1RZRr2eJca6nqwUFvDjPlVhiGw5EgOcsC84vy9UjxJk=; b=bEFr2oPkMEVNagbxhoX5LmqVoKp2iXjpfdTkDuix55gCwIJQyFuv+NPvIcUyrr4Oj/ nKf6wV3vDZqrIRLNTUBrK6ssPYm7Alpvk7gzPK5/8c1sWGcHPZ72VUtis+rIwMCcMQPJ NLspNd9+T+ag6f7Km8cb5KGAFKnyNRHU82LCsPcr8IPJVgomTEocyRipUYE9x5EfwF93 JXDvHWRK0b6TghCpfGmbyFIRKsxfvIZTGMuwkLP2LPIrWLI41B8/FgBCmhzv6lHSwGgR eaNJ2sTZzLIXrJqESUdzxYwVJ3clZuheqdNvpj7BuyKYZ5jhoBQHPhv6aPS92E0gb8Tm 2e1g== X-Gm-Message-State: AOJu0YwRAtRjdnkkCmQdtveI1e0iHx3nUThkfeLb8pcRm+9j1SYbMpjq GNPEZIW3XYpOJMjLlH+984zajqdO3qt4ibyTHFb9mqpTt6xhl9hFYFly2Dl2N3wezaSwanXyfDe 4DzY= X-Google-Smtp-Source: AGHT+IFoaEIq9gayKvvg5m+8czmM3uUKQvD0E6MoUyQBrHJSp2bGLSf54Zu04Ec0g12V7u+jblQRCQ== X-Received: by 2002:a05:6a21:4988:b0:1a9:da1f:1679 with SMTP id ax8-20020a056a21498800b001a9da1f1679mr379594pzc.34.1713472596627; Thu, 18 Apr 2024 13:36:36 -0700 (PDT) Received: from [10.0.16.165] ([50.145.13.30]) by smtp.gmail.com with ESMTPSA id im22-20020a170902bb1600b001e2b9c31b5dsm1984485plb.146.2024.04.18.13.36.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 18 Apr 2024 13:36:35 -0700 (PDT) Message-ID: <46e0cfcc-db0f-46fd-8e3f-707fbf656531@rivosinc.com> Date: Thu, 18 Apr 2024 13:36:32 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH 3/3] RISC-V: Implement CPU yielding for busy loops with Zihintpause/Zawrs To: =?UTF-8?Q?Christoph_M=C3=BCllner?= , Palmer Dabbelt Cc: libc-alpha@sourceware.org, adhemerval.zanella@linaro.org, Darius Rad , Andrew Waterman , philipp.tomsich@vrull.eu, Evan Green , kito.cheng@sifive.com, jeffreyalaw@gmail.com References: <20240418094635.3502009-4-christoph.muellner@vrull.eu> Content-Language: en-US From: Vineet Gupta In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 4/18/24 13:19, Christoph Müllner wrote: >> This has the same forward progress/eventual success violation as the >> code you sent for GCC and Linux does. It doesn't really matter if the >> user of the reservation is in a builtin, an asm block, or a function. >> The compiler just doesn't know about those reservation rules and isn't >> going to generate code that follows them. > I see. The main issue is that we don't have a valid reservation when > calling WRS, > so the whole use of Zawrs instructions is pointless. > So the only way to move Zawrs forward would be to adjust the locking routines > (introducing new primitives that have to be implemented for all architectures). Not explicitly anyways - the generic fallback will take care of every arch, except SPARC/x86 which implement atomic_spin_nop wth pause like semantics, but even they don't need to change at all if we implement new API atomic_load_and_spin_if_cond_whatever ()  in terms of existing atomic_spin_nop () -Vineet