From patchwork Mon May 11 10:12:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 38949 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DB8B0388F04B; Mon, 11 May 2020 10:12:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DB8B0388F04B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1589191979; bh=B+1/WCeUyj98lQb9NLruIvj/MdXXeeQNoC51ZudQGzY=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=svLjaKA9pY24VXEKqI5BN6ZQFsoZDi9S78aa7SpA4GlK4d8QTRLHGEherd5CcXG6e Jaflmjm4Cg6GYzkrvIFjNu13xTOgznJeTKFPbC7UCfNacBKB3qnyZiG2m7pn1xdhqo voCE1uJN9cHt01+X6P7nmOmqlw78QlGiNZx6Zc/Q= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by sourceware.org (Postfix) with ESMTP id 36292388F049 for ; Mon, 11 May 2020 10:12:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 36292388F049 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-270-GFvcZfHmOyuUCXnEwyQesQ-1; Mon, 11 May 2020 06:12:44 -0400 X-MC-Unique: GFvcZfHmOyuUCXnEwyQesQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9092080BE32 for ; Mon, 11 May 2020 10:12:43 +0000 (UTC) Received: from oldenburg2.str.redhat.com (ovpn-114-54.ams2.redhat.com [10.36.114.54]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 11D2C77F2F for ; Mon, 11 May 2020 10:12:42 +0000 (UTC) To: libc-alpha@sourceware.org Subject: [PATCH] POWER: Add context-synchronizing instructions to pkey_write [BZ #25954] Date: Mon, 11 May 2020 12:12:41 +0200 Message-ID: <878shyg4py.fsf@oldenburg2.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-14.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Florian Weimer via Libc-alpha From: Florian Weimer Reply-To: Florian Weimer Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" Sandipan Das reported that, "The Power ISA mandates that all writes to the Authority Mask Register (AMR) must always be preceded as well as succeeded by a context-synchronizing instruction. This applies to both the privileged and unprivileged variants of the Move To AMR instruction. This [requirement] is from Table 6 of Chapter 11 in page 1134 of Power ISA 3.0B. The document can be found here: " See this kernel patch submission: Tested on powerpc64le-linux-gnu on a POWER9 system with disable_radix and a compatible kernel (kernel-4.18.0-193.el8.ppc64le). ----- sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-pkey.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-pkey.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-pkey.h index 623b073d5a..25d080c9a6 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-pkey.h +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-pkey.h @@ -37,7 +37,7 @@ pkey_read (void) static inline void pkey_write (unsigned long int value) { - __asm__ volatile ("mtspr 13, %0" : : "r" (value)); + __asm__ volatile ("isync; mtspr 13, %0; isync" : : "r" (value)); } /* Number of the largest supported key. This depends on the width of