Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2406107imm; Sat, 9 Jun 2018 14:42:57 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJZtRarGMQ8Am5HNlN8SSNhXB7oJfNzFCBEcPehyK3wL8wURmD7byVt79PUySrlNfXwi3rt X-Received: by 2002:a65:4c87:: with SMTP id m7-v6mr9989144pgt.364.1528580577890; Sat, 09 Jun 2018 14:42:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528580577; cv=none; d=google.com; s=arc-20160816; b=j6sd/VaEDxDpki7gAXM0HHqdXHcqsa92kojC0rfm4uGvR4PWqyfUR/G4yfyJLYzBFl TVvzrpBg/xLFdDe+PGyCe6UsP2KlTptwkBm1VxjZlSIZyqAEm8GuZFGsgJ5rd6M957U9 smDSUqFAgdKUlB/+8GmKPU63Rb/3UONYLAcWvB6/UGgyvYVffQ3UGg5vLEpxA6xrarBf FpGf4APUq8JPMIiekwML/LomC7Icp3aBjT7MTkN/n9bfr9vORaZKIjzTpoByvoz9b9cM q97nJOl8kf4OHM3sW5J3INTNKFKj4qZxyRolMaW6yr40+68DcvI9dJk8JRcHJcnqoZ3O G8uA== 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=mdbMqDfyEVKYLBpsU48VuzIRvNwxI4c+vkos9lY9dns=; b=Yhu/cDTrahweRQ0Oohr2GCQOlAt209G22v7AJhVKOXL8UiXWoVFtFY8EujzvyP5gld yk3m7z9P5WR6Uurmt0xTBn7kwXZnzNrBOWwBLR9X9P0sRID9eDhX9D29TV820iMNgVlD 5InPwJvHpfL6ijknYBazF7A4aIhjZNRxwx9haHjPj+T7R6rXgZ8mxbH4rG8aHJMLnjI3 SJezxEhXmdC+qvQVGLirzQQNGiYZ4EybQRghzcj/iIIwA9QMlu5+02Erjy8cL6Qu08mw PyO6EKEBK9zw5IJ0UPS0yaNd4WZ+2wo+hnfSUtC8gdX6O6hulcyq7Bt+W7PZDwc9WCww BXpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Oahs4CYO; 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 x33-v6si59006039plb.512.2018.06.09.14.42.41; Sat, 09 Jun 2018 14:42:57 -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=Oahs4CYO; 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 S1753399AbeFIVmQ (ORCPT + 99 others); Sat, 9 Jun 2018 17:42:16 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:35397 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753265AbeFIVmP (ORCPT ); Sat, 9 Jun 2018 17:42:15 -0400 Received: by mail-wm0-f65.google.com with SMTP id j15-v6so9749324wme.0 for ; Sat, 09 Jun 2018 14:42:15 -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=mdbMqDfyEVKYLBpsU48VuzIRvNwxI4c+vkos9lY9dns=; b=Oahs4CYOyBjcE+gUNusu/WWfNI8zcOeigH4gcPnOqjqKX+ztgTUjkyR5dB+X8GZpLJ wQRDrJsYe0S12RsvhyqgSlS+5GMy919MiGlj5Cb6HRriAcqyjYuU0efQDAWnBUMZzM3N 9zE8mkM1pCDFQ8Wm/OHlltPoNrGf2fC52oTkkIQjOMheGg6plWQk8CyS8DK8BUOei30K P+Tt3p4iLwTBEx4RvlqK9m8Ni8HU8G1526nLgqY8R23dpl5vIYouEfpKISGLZzk+FIJs sy/4tOGai5S8VFgm4udjainCxumxMIao4NU67dsUZAfeyqm9ScTZwK8UhoX0+BQkeFUF IMaA== 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=mdbMqDfyEVKYLBpsU48VuzIRvNwxI4c+vkos9lY9dns=; b=rPmPiUotINbqlm1EEBqMIqfr1kI45GfaEiYSdu7Kw01snSKH77U/GcKQvIhLYU5gqX q/8K0zVp943YUfW2WAthszthNj6cZpEpao/3yekEV7ge66MDlaYLuDlKRGlF4VRCvm2T WMU+wbz/O3k59ylo9oKWXbKkPq9GWiE40VSAZNNIXw6eUBnOfEIbl7K8Fg/DC8ATgoY4 kyqnp53ioL49K+awN38H0aweAYIQr2aCWrPfe9DmPUgXB30DwwRWyIEbvMcHet4OUHGG Pr3JQY9jElbTD5ehTsN9riAL1MqQViguwauN0nY5v+Z/kCjoxLAnhX8uINX8bmMKVjQ8 iNFA== X-Gm-Message-State: APt69E236vlHV5m9dFQjyZWBXGt278VCsmZggK8HHEJxfiuGkuUepURj 6/h9yHBBe5f5CPYm+SIPfEykhg5D X-Received: by 2002:a50:864b:: with SMTP id 11-v6mr12256719edt.229.1528580534514; Sat, 09 Jun 2018 14:42:14 -0700 (PDT) Received: from ltop.local ([2a02:a03f:4108:7200:a90a:9fe:dec5:615]) by smtp.gmail.com with ESMTPSA id m10-v6sm10243613edp.57.2018.06.09.14.42.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 09 Jun 2018 14:42:13 -0700 (PDT) Date: Sat, 9 Jun 2018 23:42:12 +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: <20180609214211.u42vfrddl75ow7bb@ltop.local> References: <20180609001310.jxzcqtdacu4uiz6b@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 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. > Either way it looks innocuous WRT the patch. Indeed. With this, the RISC-V arch should be sparse clean. I'll recheck after -rc1. Cheers, -- Luc