From patchwork Sun May 13 04:21:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 912509 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40k9mQ17tRz9s02 for ; Sun, 13 May 2018 14:27:50 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="R5S/t57f"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40k9mP5pYWzF2yV for ; Sun, 13 May 2018 14:27:49 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="R5S/t57f"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:400e:c00::243; helo=mail-pf0-x243.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="R5S/t57f"; dkim-atps=neutral Received: from mail-pf0-x243.google.com (mail-pf0-x243.google.com [IPv6:2607:f8b0:400e:c00::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40k9d24n9yzF3Rl for ; Sun, 13 May 2018 14:21:26 +1000 (AEST) Received: by mail-pf0-x243.google.com with SMTP id a14-v6so4471640pfi.1 for ; Sat, 12 May 2018 21:21:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Uuo33FYsYbe/VukXbl8lmAjIOqixwwMWHR+BiTKoYOE=; b=R5S/t57fa1VN5jPFX4l/aYUkfIURCrLqJ+i/x/BZmsVJZvsVAXhz5XEcmgW3vE4qeJ js1aa/6k8EBiCKGDzx8pmjnKwLmqvZrjpvsQ9qUqeHeCXMLSwBWwRkup5DzlfYiCMoY0 DlHcl6fg6MHeAuSTMa1X3uHcbaO9PxHrNcEZzn4qz54yI4scW+FXYha/cVyGkIUk3gLW LbtQ0JpVjq37DZrsuMs8Z0FEzY2M53+UHhxMdHG6/9r5Ic7iQ7tz5Ox35LhsEGs4GP/f QpuU9K6xfKAqTpcHZ9hq2wqzQjco9uiRrY199bPHO2tw6jWKrYRJgUABgh7LrQD+acpa EGCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Uuo33FYsYbe/VukXbl8lmAjIOqixwwMWHR+BiTKoYOE=; b=ONRV933zIkIMZiBCoEQUlwycjbSoRp3B3q5ADCHSOtkMckeRGiEiR4v4UlxygMcImh fjZrjTzTmCW5wSb0rnQHo1ZZM+n8XyOHTJujy6I9mLc3nMPVnNNIWEdH0+R21jzwOH0y SlM+K0xwPFMbJ2CUycq/zqoJZFfb4k40im71QtVOMY+VcdGt31JAwuxZll5wO5zFN1jQ cxSIEoRG29AYAD7NzCFwouNoVJ9ejGxRuQQom4qW4aWyUtPgb5WXg8x0EDYN3wLhSJ/1 N2rgc+6flVI5557PfNrLDLqDPeJ9xn+PQqYB3Sh6euDQxjIf2t+gdwrnJ7/aQ+s+fz0k lRXQ== X-Gm-Message-State: ALKqPwdsJasieJuBvp7vI3Zhj1OqMD8WpQFkX0MrDqH5TxaImp9Gax+q ZhmqNY1V49IqMlzk+snC6lKH2g== X-Google-Smtp-Source: AB8JxZoXSXTH7VR6M/bhrzZNa09L/vaZeTcV8tZdETAYMJlBZayefbYJC63rPrzZSFEpAVKVnu74GA== X-Received: by 2002:a62:91b:: with SMTP id e27-v6mr5235351pfd.93.1526185284075; Sat, 12 May 2018 21:21:24 -0700 (PDT) Received: from roar.au.ibm.com (59-102-70-78.tpgi.com.au. [59.102.70.78]) by smtp.gmail.com with ESMTPSA id i186-v6sm10740058pge.40.2018.05.12.21.21.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 12 May 2018 21:21:23 -0700 (PDT) From: Nicholas Piggin To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH 2/3] powerpc/64s/radix: avoid ptesync after set_pte and ptep_set_access_flags Date: Sun, 13 May 2018 14:21:05 +1000 Message-Id: <20180513042106.15470-3-npiggin@gmail.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180513042106.15470-1-npiggin@gmail.com> References: <20180513042106.15470-1-npiggin@gmail.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nicholas Piggin Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" The ISA suggests ptesync after setting a pte, to prevent a table walk initiated by a subsequent access from causing a spurious fault, which may be an allowance implementation to have page table walk loads incoherent with store queues. However there is no correctness problem in spurious faults -- the kernel copes with these at any time, and the architecture requires the pte to be re-loaded, which would eventually find the updated pte. On POWER9 there does not appear to be a large window where this is a problem, so as an optimisation, remove the costly ptesync from pte updates. If implementations benefit from ptesync, it would likely be better to go in update_mmu_cache, rather than set_pte etc which is called for things like fork and mprotect. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/book3s/64/radix.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/powerpc/include/asm/book3s/64/radix.h b/arch/powerpc/include/asm/book3s/64/radix.h index fcd92f9b6ec0..45bf1e1b1d33 100644 --- a/arch/powerpc/include/asm/book3s/64/radix.h +++ b/arch/powerpc/include/asm/book3s/64/radix.h @@ -209,7 +209,6 @@ static inline void radix__ptep_set_access_flags(struct mm_struct *mm, __radix_pte_update(ptep, 0, new_pte); } else __radix_pte_update(ptep, 0, set); - asm volatile("ptesync" : : : "memory"); } static inline int radix__pte_same(pte_t pte_a, pte_t pte_b) @@ -226,7 +225,6 @@ static inline void radix__set_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte, int percpu) { *ptep = pte; - asm volatile("ptesync" : : : "memory"); } static inline int radix__pmd_bad(pmd_t pmd)