Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4808928imm; Mon, 11 Jun 2018 20:07:30 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIu5acUBmrH3NaV+rIfpnzSeD4IZiRc9X5sPabhowOWZ2QVRFOrILPQbFJAjncKl8aQ1R99 X-Received: by 2002:a17:902:246a:: with SMTP id m39-v6mr1942314plg.141.1528772850576; Mon, 11 Jun 2018 20:07:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528772850; cv=none; d=google.com; s=arc-20160816; b=VCAMlszojJXGsOTlrizNyxSqRwSrUQcm6QFbcH3puv9B1owYJIkGiIeW4Ixv+IxwXl QKx+eZuK9KJvUDNeIc7ncOmgSX3bz1808ySJgpPH/tWXfvl4Auffjp70ImJ4p1xM/AJ1 vxbNJJgYjXsnhnAyLyHvA1mz6nYt+kZwBrXQ6OpIwtFVN7fFgd8GOVZCzbVovvw5qtWV 58XFWb5mFczSQzLy1ltVKDXj43F2YY5fyRzKlOo6nBAw5MQa47ixUut/QzIwcjPzUx4O lT9AQEZpdkh3FgQBuBGcvwb2nKPmQ57bZrYKV5u+bIQhnmWNsx5l8pKyh9RMczFxmSB9 +dGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=B6RG5MLssEBwvKEoQdT4tAhZTmJh1AzsJc4KXAlHCbQ=; b=VLD8ip9GX7bDffXQNyJQvXKR65Fruv4sFs/Hj6AAE384RJS/+22yTwEIY9rIUae6UZ L+/5xC0t7DQ/0QwHtCQ4T+1zSW0V5yHj9bO+0pGzq674ihNH+hDuKXmQ4QjWsjkmE/3G a2ZjFIeZe1ythiC8qBxMJJ5w+UoU6GLJscsIR3avx79mELHXvvbttI4MYMryP7E1nKdI N4VFpO7mVkXqI0TABwcSq9u9/StSw8q85vDINu7umLYCGpOCre1ajyxSLe347OT/bLE6 eEqL79Tc/y54EJocrAUdieEinpYyq1hzUUtYWNOm6ZbRKjmi5zO5GbRLrR7s4fqoHtvd KREw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qHuw7Oi/; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c13-v6si30769255pgq.316.2018.06.11.20.07.14; Mon, 11 Jun 2018 20:07:30 -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=@gmail.com header.s=20161025 header.b=qHuw7Oi/; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935233AbeFLDAN (ORCPT + 99 others); Mon, 11 Jun 2018 23:00:13 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:55104 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935168AbeFLDAL (ORCPT ); Mon, 11 Jun 2018 23:00:11 -0400 Received: by mail-wm0-f65.google.com with SMTP id o13-v6so17877778wmf.4 for ; Mon, 11 Jun 2018 20:00:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=B6RG5MLssEBwvKEoQdT4tAhZTmJh1AzsJc4KXAlHCbQ=; b=qHuw7Oi/mlP3SV+oRVVwHGLa6FRKvpoUYI8RW9hMJpmbc1JDK5Ie6NfNzdfOrYgj5y uTHXsosgQw4J1dYFgqErz6uzJM8bNHl6OJWMEThdggZuFySgz+a7a4VWJDyi0lswbgBN X6Uk9EUjyuGGrkEP5qAzIdqgc5UNz1sKYnIwEFRWu48SAyMClCnw2d/f8F80o02lsIvD U2kTAYqr0LL4G71kbajhBT8ZnKHrS1322hf6HcWO7MdOHMh6BjunwS0+tLIQM118GtGS X0rLd6wTzLMDOMtyvqDXNcJrnzyMzUu/D8cC/PSzk+IQWToqvaezLBfAD9OFLLCP1NdN IwoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=B6RG5MLssEBwvKEoQdT4tAhZTmJh1AzsJc4KXAlHCbQ=; b=SaqJx7rWM6177Stcb6StiZBVX54qvVRChwxh96D0mvHn6YNo4gGQiaORRTn4mrIwhh QeAGQL+xgI0lJ3a7toAenIIH+L2JWCNxkH9fpKvok1fWIrLmDYDDqR05Ff6Bw9uNmvGh 6op8bU/qZ9zhWxIbYU9A3iDX1F/hZJjNg51VhoqxdQ93BHHp9MbS7WqEH/dE5RTNFl6s eQws9uAMoOM0n3EI1TGFQXuD8OijOG0my6AduGpL5gIIXDgbhfnRZtNfiLGdY6nJl2hs HEVZuuwgR2+eqB5FfvKk/V3PMOlo4CaXFol/VYkJyQ3XfnbgOCWHzlnvuHbBm989iAYi xWqA== X-Gm-Message-State: APt69E1g7LxdFmw195oSF8T7lTO2zkB+rhG2yy0MvR9YTnZ02JBWuBSU aRqGDRY0qzMkNTkPwHdev14= X-Received: by 2002:aa7:c50f:: with SMTP id o15-v6mr1634192edq.21.1528772409925; Mon, 11 Jun 2018 20:00:09 -0700 (PDT) Received: from ltop.local ([2a02:a03f:40a0:8d00:a561:f7:a86d:7de9]) by smtp.gmail.com with ESMTPSA id c13-v6sm15570edr.78.2018.06.11.20.00.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Jun 2018 20:00:09 -0700 (PDT) Date: Tue, 12 Jun 2018 05:00:08 +0200 From: Luc Van Oostenryck To: Palmer Dabbelt Cc: atish.patra@wdc.com, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, albert@sifive.com Subject: Re: [PATCH 3/3] riscv: fix __user annotation for __copy_user() Message-ID: <20180612030006.h7a4mag76aqqifod@ltop.local> References: <20180609214211.u42vfrddl75ow7bb@ltop.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180512 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 11, 2018 at 12:01:37PM -0700, Palmer Dabbelt wrote: > On Sat, 09 Jun 2018 14:42:12 PDT (-0700), luc.vanoostenryck@gmail.com wrote: > > On Sat, Jun 09, 2018 at 01:00:08PM -0700, Palmer Dabbelt wrote: > > > On Fri, 08 Jun 2018 17:13:12 PDT (-0700), luc.vanoostenryck@gmail.com wrote: > > > > I tried it and ... the preprocessed asm is as expected: > > > > .globl __asm_copy_to_user ; .balign 4 ; __asm_copy_to_user: > > > > .globl __asm_copy_from_user ; .balign 4 ; __asm_copy_from_user: > > > > > > > > > > > > li t6, 0x00040000 > > > > csrs sstatus, t6 > > > > ... > > > > > > > > But the nm -S returns different sizes for them: > > > > 0000000000000004 000000000000006c T __asm_copy_from_user > > > > 0000000000000002 000000000000006e T __asm_copy_to_user > > > > > > > > and the object code is: > > > > 0000000000000000 <__asm_copy_to_user-0x2>: > > > > 0: 0001 nop > > > > > > > > 0000000000000002 <__asm_copy_to_user>: > > > > 2: 0001 nop > > > > > > > > 0000000000000004 <__asm_copy_from_user>: > > > > 4: 00040fb7 lui t6,0x40 > > > > 8: 100fa073 csrs sstatus,t6 > > > > ... > > > > > > > > Why these unnneded nops? > > > > Is this a known problem of my toolchain (I use a plain gcc 7.3 + > > > > binutils 2.29, both configured as riscv64-none-elf)? > > > > > > > > If I remove the two ENTRY() and use instead: > > > > .globl __asm_copy_to_user ; __asm_copy_to_user: > > > > .globl __asm_copy_from_user ; __asm_copy_from_user: > > > > (IOW, I drop the .balign) then I get the expected result. > > > > But well, this seems unrelated to the double ENTRY. > > > > > > > > I can't test it more for now because I've some link errors (which, > > > > I understand are probably solved in the riscv tree of binutils). > > > > > > > > I'll send you the patch anyway since, as far as I understand the changes > > > > specific to this copy_to/from_user is OK. > > > > > > I think it's probably a bug in binutils-2.29 that should be fixed by > > > 2.30 -- IIRC we had some bugs that looked like this and they got > > > fixed, though it might be just in master (so 2.31). > > > > I've tried binutils-2.30 and riscv-binutils-gdb, both still have > > the problem and master binutils-gdb doesn't compile for me. > > OTOH, everything is fine if I disabled CONFIG_RISCV_ISA_C. > > OK, I'll try and figure out what's going on. We've had a handful of > headaches trying to get things like '.align 2; .align 2' to actually produce > no NOPs for the second alignment directive, which is surprisingly > complicated due to the aggressive linker relaxation we do. OK. I imagine indeed but note that no linker is involved here so, if the problem is still present, it must already be in the assembler. > > With this, the RISC-V arch should be sparse clean. > > I'll recheck after -rc1. > > This will be part of the PR that I tag today, so I anticipate it'll be in. Cool! -- Luc