Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2661453yba; Mon, 6 May 2019 09:33:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqw2GgKe0c9plT7rcTb88+2Zawr381Y/YT74hh7b7Tvt2p+/5jhGoNLZG3tqXTvwP8PpDP0j X-Received: by 2002:a62:3501:: with SMTP id c1mr35229291pfa.184.1557160399546; Mon, 06 May 2019 09:33:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557160399; cv=none; d=google.com; s=arc-20160816; b=NKly60zOnxTBWfaFCLAmcKlOX6qOX+rEXmO99BbanduKr3tVznflfPOoCytrrtR0S9 4B1aGhij81BC46Lo4vMLlWCxlEktPIIPWoeqk62bW1FgK6cmsvMNWebEFfs4s7pCLR2s yTtJ7zDxMxj0fnWk39qrSl8GqqnW4RtsHxBYKZU8xN5PHdlndiY3YzTlkUxuPFMMN4QL hEOXe92HcEiGanGpHoSWS1g9ERxwx3wyIPkRBc1G1S/oUR2O+oKEOfCVTNyoNXTolF/n qPPxIWacnVwdO8leYXXnWHknxz/alyhzBAHmwu/muqh7u3n//I3+UUHk2nJflHtrDxhb tZ6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=yRinLegSyNuQk1RUEKDqwhCd8nwbiVxqrPc16LJu4GU=; b=FLaHQAtIB2fQjgAYjGVArD5szd5HXYxerx0ygSkTlhc7tK7PHesBJjLN02Ak+RNKOJ 9fUNX/wDYOQA5RE6fXr+ja76pUlDuziSSVQepBPniXwFPLj/Ri9GkK8edfOFNXAHA6OI zQme0BcScOXTgifeHHPwGoFg8plT8monYXkFI0ympTkbKY6wkImqhSegag+OClow2sXu iTw0vGvp1y5zL4setNHUQQhJo5PRFLYmF74V2PaqA0WZiuvMI/YyR/NAswjVCETFPJZK OOtXvLY6ea8auVsYfNaiu6AzVhhpgCMpZ/8CyNrhknWD+uuD/OQy55ItEmPVE+yRKKgm 2g1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=P5+DJ7Wb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l4si16616085plb.305.2019.05.06.09.33.04; Mon, 06 May 2019 09:33:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=P5+DJ7Wb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727253AbfEFQbq (ORCPT + 99 others); Mon, 6 May 2019 12:31:46 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:42457 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727177AbfEFQbo (ORCPT ); Mon, 6 May 2019 12:31:44 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 44yStK1Tgsz9v0K7; Mon, 6 May 2019 18:31:37 +0200 (CEST) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=P5+DJ7Wb; dkim-adsp=pass; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id CpNBf7_aZXGe; Mon, 6 May 2019 18:31:37 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 44yStK0FMgz9v0K6; Mon, 6 May 2019 18:31:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1557160297; bh=yRinLegSyNuQk1RUEKDqwhCd8nwbiVxqrPc16LJu4GU=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=P5+DJ7WbCCG+/X0uMpSJWcr0mfyFEW5HxVlaji0QqDgeSWmgAwSXBwr6QvPxcUmo+ WfMLuJ2l4oWXBtaoH0Oman/cVy25hsthMVccUN+MJRH8DpX/32HySF9MgUN35bIhoZ 0SLSQMphHjygVMgYin2hepj2y/t4AWCMa0/wao5g= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 46BF28B8E9; Mon, 6 May 2019 18:31:42 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id hGgPJhHpLTle; Mon, 6 May 2019 18:31:42 +0200 (CEST) Received: from localhost.localdomain (po15451.idsi0.si.c-s.fr [172.25.231.6]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 168478B8E7; Mon, 6 May 2019 18:31:42 +0200 (CEST) Subject: Re: [PATCH] powerpc/32: Remove memory clobber asm constraint on dcbX() functions To: Segher Boessenkool Cc: linux-kernel@vger.kernel.org, Scott Wood , Paul Mackerras , linuxppc-dev@lists.ozlabs.org References: <20180109065759.4E54B6C73D@localhost.localdomain> <20190503181508.GQ8599@gate.crashing.org> From: Christophe Leroy Message-ID: Date: Mon, 6 May 2019 16:31:38 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20190503181508.GQ8599@gate.crashing.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Segher, On 05/03/2019 06:15 PM, Segher Boessenkool wrote: > Hi Christophe, > > On Fri, May 03, 2019 at 04:14:13PM +0200, Christophe Leroy wrote: >> A while ago I proposed the following patch, and didn't get any comment >> back on it. > > I didn't see it. Maybe because of holiday :-) Thanks for this answer, I guess I'll drop it for the time being. However, I've tried your suggestion below and get unnexpected result. [...] > > > [ Btw. Instead of > > __asm__ __volatile__ ("dcbf 0, %0" : : "r"(addr) : "memory"); > > you can do > > __asm__ __volatile__ ("dcbf %0" : : "Z"(addr) : "memory"); > > to save some insns here and there. ] Tried that change on dcbz() and checked function clear_page() static inline void clear_page(void *addr) { unsigned int i; for (i = 0; i < PAGE_SIZE / L1_CACHE_BYTES; i++, addr += L1_CACHE_BYTES) dcbz(addr); } void clear_user_page(void *page, unsigned long vaddr, struct page *pg) { clear_page(page); /* * We shouldn't have to do this, but some versions of glibc * require it (ld.so assumes zero filled pages are icache clean) * - Anton */ flush_dcache_page(pg); } EXPORT_SYMBOL(clear_user_page); Before the change, clear_user_page: mflr 0 stw 0,4(1) bl _mcount stwu 1,-16(1) li 9,128 mflr 0 mtctr 9 stw 0,20(1) .L46: #APP # 88 "./arch/powerpc/include/asm/cache.h" 1 dcbz 0, 3 # 0 "" 2 #NO_APP addi 3,3,32 bdnz .L46 lwz 0,20(1) mr 3,5 mtlr 0 addi 1,1,16 b flush_dcache_page After the change clear_user_page: mflr 0 stw 0,4(1) bl _mcount stwu 1,-32(1) li 9,128 mflr 0 mtctr 9 stw 0,36(1) .L46: stw 3,8(1) addi 9,1,8 #APP # 88 "./arch/powerpc/include/asm/cache.h" 1 dcbz 0(9) # 0 "" 2 #NO_APP addi 3,3,32 bdnz .L46 mr 3,5 bl flush_dcache_page lwz 0,36(1) addi 1,1,32 mtlr 0 blr So first of all it uses an unexisting form of dcbz : "dcbz 0(9)" And in addition, it stores r3 somewhere and I guess expects to read it with dcbz ??? Looks like 'Z' is not the right constraint to use. Christophe