Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1191173ybl; Fri, 30 Aug 2019 13:23:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqwGuO5HpcsOWEv7WQfMSp/8FPBt3N9+NoaNSStoUEb0vD9XTJ+XJRUhDraJkrimEN39JDlL X-Received: by 2002:a65:504c:: with SMTP id k12mr14618047pgo.252.1567196598476; Fri, 30 Aug 2019 13:23:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567196598; cv=none; d=google.com; s=arc-20160816; b=Ff4YBA9YT2GLZQPFmviX6o/HQC+yl28NLC/6ZRF/t05JgTz6X7FkOE/c9aokJcJjoU xXRelRQ0SZWvfy1xZQpndgVSP2HJZabPTIX7Rqje55zh3QZl/zTTA7niuvKXye31h++M 4vxCCVdMYZiJNPf0qU19PmV4qct7eaCDHlzVl/5S/PQuQKx2RMi72CzVh36an/tFNzi/ +UELAGb+aofGMmL2fy3nWLG0Cf+zCLpEhntVXS7qzAgnsa1/L25qSfzAqwrpOGu3FJ/v BTuhyWKDyBcp7waEiwYs2X7TyQOUVD72+z6dJml6CcbllcrHPfDgboH0xN4KFvsjSp66 TPrw== 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=yamZ/uoZZ/8N8l60SIEdp4gAbxpE6C6fN89lCQF9GyA=; b=AQiO58VwwT6mS1GfM9DPIesyQMaVJLUWDA08II9oNXJpZeveR82fdWQHtFIfuWj3kY f4JnDyT8X/4QdAlEqYYKUhw92DhWatkRZkMCuOF8OcCwuVVTNG02lBc+zcDAm1+b857N cvssueyK8MpUo+jJuzv2cZ1EKnA09O6yhh28DujjK0XUjc8miWMjPv0mldpOq3GKrHbK yb1yhnoTuMg+sFLJoTdBPQX8BLhAghldScwwIKp7c6m1vSSvZx+nDhbSGW0orntxrayJ ayEDxjaQkImJOiMNBRiCi6O1Ai6USx/N2ebs/TI4VYeB32cdRY17Z+DSAfmwzjUNqw70 d3+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=V6Ps4YjA; 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 w15si5420596ply.218.2019.08.30.13.23.03; Fri, 30 Aug 2019 13:23:18 -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=V6Ps4YjA; 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 S1728166AbfH3UVj (ORCPT + 99 others); Fri, 30 Aug 2019 16:21:39 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:56113 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727888AbfH3UVj (ORCPT ); Fri, 30 Aug 2019 16:21:39 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 46KrV86Md0z9v7DV; Fri, 30 Aug 2019 22:21:36 +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=V6Ps4YjA; 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 IyCuknZygVPR; Fri, 30 Aug 2019 22:21:36 +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 46KrV859B7z9v7DT; Fri, 30 Aug 2019 22:21:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1567196496; bh=yamZ/uoZZ/8N8l60SIEdp4gAbxpE6C6fN89lCQF9GyA=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=V6Ps4YjAJcG1xn8iVemR4dWplz6+YHrm5TUEci82McqyDzka3geO/zdxuYz+YUj9r 9VwyYzFddQcrFACr222SVJeo/rJBTkQgVIs3P/FVMQpxbo0UEOjoYDYdft7I3Ptt+1 KMmpXoX5CVDXCUjkyaB6f9AgBm8kQe8UIKD17Kms= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 060658B911; Fri, 30 Aug 2019 22:21:37 +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 3ST1DPzSo99M; Fri, 30 Aug 2019 22:21:36 +0200 (CEST) Received: from [192.168.4.90] (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id BC7028B90B; Fri, 30 Aug 2019 22:21:35 +0200 (CEST) Subject: Re: [PATCH v6 3/6] powerpc/perf: consolidate read_user_stack_32 To: Michal Suchanek , linuxppc-dev@lists.ozlabs.org Cc: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Nicholas Piggin , Hari Bathini , Joel Stanley , Andrew Donnellan , Firoz Khan , Breno Leitao , Russell Currey , Nicolai Stange , Michael Neuling , "Eric W. Biederman" , Thomas Gleixner , Arnd Bergmann , Geert Uytterhoeven , Heiko Carstens , Christian Brauner , David Howells , Greg Kroah-Hartman , Allison Randal , David Hildenbrand , linux-kernel@vger.kernel.org References: <630c0889c1fb841bcd2054d90205e61d175b965b.1567188299.git.msuchanek@suse.de> From: Christophe Leroy Message-ID: <688e9db0-f00f-7629-5162-f711c3627708@c-s.fr> Date: Fri, 30 Aug 2019 22:21:35 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <630c0889c1fb841bcd2054d90205e61d175b965b.1567188299.git.msuchanek@suse.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 30/08/2019 à 20:57, Michal Suchanek a écrit : > There are two almost identical copies for 32bit and 64bit. > > The function is used only in 32bit code which will be split out in next > patch so consolidate to one function. > > Signed-off-by: Michal Suchanek Reviewed-by: Christophe.Leroy@c-s.fr > --- > new patch in v6 > --- > arch/powerpc/perf/callchain.c | 25 +++++++++---------------- > 1 file changed, 9 insertions(+), 16 deletions(-) > > diff --git a/arch/powerpc/perf/callchain.c b/arch/powerpc/perf/callchain.c > index c84bbd4298a0..b7cdcce20280 100644 > --- a/arch/powerpc/perf/callchain.c > +++ b/arch/powerpc/perf/callchain.c > @@ -165,22 +165,6 @@ static int read_user_stack_64(unsigned long __user *ptr, unsigned long *ret) > return read_user_stack_slow(ptr, ret, 8); > } > > -static int read_user_stack_32(unsigned int __user *ptr, unsigned int *ret) > -{ > - if ((unsigned long)ptr > TASK_SIZE - sizeof(unsigned int) || > - ((unsigned long)ptr & 3)) > - return -EFAULT; > - > - pagefault_disable(); > - if (!__get_user_inatomic(*ret, ptr)) { > - pagefault_enable(); > - return 0; > - } > - pagefault_enable(); > - > - return read_user_stack_slow(ptr, ret, 4); > -} > - > static inline int valid_user_sp(unsigned long sp, int is_64) > { > if (!sp || (sp & 7) || sp > (is_64 ? TASK_SIZE : 0x100000000UL) - 32) > @@ -295,6 +279,12 @@ static inline int current_is_64bit(void) > } > > #else /* CONFIG_PPC64 */ > +static int read_user_stack_slow(void __user *ptr, void *buf, int nb) > +{ > + return 0; > +} > +#endif /* CONFIG_PPC64 */ > + > /* > * On 32-bit we just access the address and let hash_page create a > * HPTE if necessary, so there is no need to fall back to reading > @@ -313,9 +303,12 @@ static int read_user_stack_32(unsigned int __user *ptr, unsigned int *ret) > rc = __get_user_inatomic(*ret, ptr); > pagefault_enable(); > > + if (IS_ENABLED(CONFIG_PPC64) && rc) > + return read_user_stack_slow(ptr, ret, 4); > return rc; > } > > +#ifndef CONFIG_PPC64 > static inline void perf_callchain_user_64(struct perf_callchain_entry_ctx *entry, > struct pt_regs *regs) > { >