From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9FEBC388F7 for ; Thu, 22 Oct 2020 09:19:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6BFDC2415A for ; Thu, 22 Oct 2020 09:19:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="T54lhtRQ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2895810AbgJVJTa (ORCPT ); Thu, 22 Oct 2020 05:19:30 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:49858 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2509618AbgJVJTa (ORCPT ); Thu, 22 Oct 2020 05:19:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603358368; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GAx1sXwCwRg93ixXlQ7CLSdqwfjOuLlYgV9gYDuI6Ww=; b=T54lhtRQJCIAi/FFBbGVSRaY2WsiM+xT3zVD4H9bTm/rpIplPUItjapC8oqeqouC33Zrfe vtLMkS8M0ef2MEwehNnjWgdc7Fo9U3G1AZfYbofn+wUIf7nuJDJAqD/pxxNTGXjTopgvFp aErzOIFyScIY0EVnoxQBlLcuAdujsWU= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-509-YuC2ea8uNjCRXVsi9pVVtQ-1; Thu, 22 Oct 2020 05:19:26 -0400 X-MC-Unique: YuC2ea8uNjCRXVsi9pVVtQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 64F581006C9F; Thu, 22 Oct 2020 09:19:22 +0000 (UTC) Received: from [10.36.113.152] (ovpn-113-152.ams2.redhat.com [10.36.113.152]) by smtp.corp.redhat.com (Postfix) with ESMTP id C826360BFA; Thu, 22 Oct 2020 09:19:16 +0000 (UTC) Subject: Re: Buggy commit tracked to: "Re: [PATCH 2/9] iov_iter: move rw_copy_check_uvector() into lib/iov_iter.c" To: Greg KH Cc: David Laight , Al Viro , Nick Desaulniers , Christoph Hellwig , "kernel-team@android.com" , Andrew Morton , Jens Axboe , Arnd Bergmann , David Howells , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "linux-mips@vger.kernel.org" , "linux-parisc@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-s390@vger.kernel.org" , "sparclinux@vger.kernel.org" , "linux-block@vger.kernel.org" , "linux-scsi@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" , "linux-aio@kvack.org" , "io-uring@vger.kernel.org" , "linux-arch@vger.kernel.org" , "linux-mm@kvack.org" , "netdev@vger.kernel.org" , "keyrings@vger.kernel.org" , "linux-security-module@vger.kernel.org" References: <20200925045146.1283714-1-hch@lst.de> <20200925045146.1283714-3-hch@lst.de> <20201021161301.GA1196312@kroah.com> <20201021233914.GR3576660@ZenIV.linux.org.uk> <20201022082654.GA1477657@kroah.com> <80a2e5fa-718a-8433-1ab0-dd5b3e3b5416@redhat.com> <5d2ecb24db1e415b8ff88261435386ec@AcuMS.aculab.com> <20201022090155.GA1483166@kroah.com> From: David Hildenbrand Organization: Red Hat GmbH Message-ID: Date: Thu, 22 Oct 2020 11:19:15 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.1 MIME-Version: 1.0 In-Reply-To: <20201022090155.GA1483166@kroah.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org On 22.10.20 11:01, Greg KH wrote: > On Thu, Oct 22, 2020 at 10:48:59AM +0200, David Hildenbrand wrote: >> On 22.10.20 10:40, David Laight wrote: >>> From: David Hildenbrand >>>> Sent: 22 October 2020 09:35 >>>> >>>> On 22.10.20 10:26, Greg KH wrote: >>>>> On Thu, Oct 22, 2020 at 12:39:14AM +0100, Al Viro wrote: >>>>>> On Wed, Oct 21, 2020 at 06:13:01PM +0200, Greg KH wrote: >>>>>>> On Fri, Sep 25, 2020 at 06:51:39AM +0200, Christoph Hellwig wrote: >>>>>>>> From: David Laight >>>>>>>> >>>>>>>> This lets the compiler inline it into import_iovec() generating >>>>>>>> much better code. >>>>>>>> >>>>>>>> Signed-off-by: David Laight >>>>>>>> Signed-off-by: Christoph Hellwig >>>>>>>> --- >>>>>>>> fs/read_write.c | 179 ------------------------------------------------ >>>>>>>> lib/iov_iter.c | 176 +++++++++++++++++++++++++++++++++++++++++++++++ >>>>>>>> 2 files changed, 176 insertions(+), 179 deletions(-) >>>>>>> >>>>>>> Strangely, this commit causes a regression in Linus's tree right now. >>>>>>> >>>>>>> I can't really figure out what the regression is, only that this commit >>>>>>> triggers a "large Android system binary" from working properly. There's >>>>>>> no kernel log messages anywhere, and I don't have any way to strace the >>>>>>> thing in the testing framework, so any hints that people can provide >>>>>>> would be most appreciated. >>>>>> >>>>>> It's a pure move - modulo changed line breaks in the argument lists >>>>>> the functions involved are identical before and after that (just checked >>>>>> that directly, by checking out the trees before and after, extracting two >>>>>> functions in question from fs/read_write.c and lib/iov_iter.c (before and >>>>>> after, resp.) and checking the diff between those. >>>>>> >>>>>> How certain is your bisection? >>>>> >>>>> The bisection is very reproducable. >>>>> >>>>> But, this looks now to be a compiler bug. I'm using the latest version >>>>> of clang and if I put "noinline" at the front of the function, >>>>> everything works. >>>> >>>> Well, the compiler can do more invasive optimizations when inlining. If >>>> you have buggy code that relies on some unspecified behavior, inlining >>>> can change the behavior ... but going over that code, there isn't too >>>> much action going on. At least nothing screamed at me. >>> >>> Apart from all the optimisations that get rid off the 'pass be reference' >>> parameters and strange conditional tests. >>> Plenty of scope for the compiler getting it wrong. >>> But nothing even vaguely illegal. >> >> Not the first time that people blame the compiler to then figure out >> that something else is wrong ... but maybe this time is different :) > > I agree, I hate to blame the compiler, that's almost never the real > problem, but this one sure "feels" like it. > > I'm running some more tests, trying to narrow things down as just adding > a "noinline" to the function that got moved here doesn't work on Linus's > tree at the moment because the function was split into multiple > functions. > > Give me a few hours... I might be wrong but a) import_iovec() uses: - unsigned nr_segs -> int - unsigned fast_segs -> int b) rw_copy_check_uvector() uses: - unsigned long nr_segs -> long - unsigned long fast_seg -> long So when calling rw_copy_check_uvector(), we have to zero-extend the registers used for passing the arguments. That's definitely done when calling the function explicitly. Maybe when inlining something is messed up? Just a thought ... -- Thanks, David / dhildenb From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Subject: Re: Buggy commit tracked to: "Re: [PATCH 2/9] iov_iter: move rw_copy_check_uvector() into lib/iov_iter.c" References: <20200925045146.1283714-1-hch@lst.de> <20200925045146.1283714-3-hch@lst.de> <20201021161301.GA1196312@kroah.com> <20201021233914.GR3576660@ZenIV.linux.org.uk> <20201022082654.GA1477657@kroah.com> <80a2e5fa-718a-8433-1ab0-dd5b3e3b5416@redhat.com> <5d2ecb24db1e415b8ff88261435386ec@AcuMS.aculab.com> <20201022090155.GA1483166@kroah.com> From: David Hildenbrand Message-ID: Date: Thu, 22 Oct 2020 11:19:15 +0200 MIME-Version: 1.0 In-Reply-To: <20201022090155.GA1483166@kroah.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit List-ID: To: Greg KH Cc: David Laight , Al Viro , Nick Desaulniers , Christoph Hellwig , "kernel-team@android.com" , Andrew Morton , Jens Axboe , Arnd Bergmann , David Howells , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "linux-mips@vger.kernel.org" , "linux-parisc@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-s390@vger.kernel.org" , "sparclinux@vger.kernel.org" , "linux-block@vger.kernel.org" , "linux-scsi@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" , "linux-aio@kvack.org" , "io-uring@vger.kernel.org" , "linux-arch@vger.kernel.org" , "linux-mm@kvack.org" , "netdev@vger.kernel.org" , "keyrings@vger.kernel.org" , "linux-security-module@vger.kernel.org" On 22.10.20 11:01, Greg KH wrote: > On Thu, Oct 22, 2020 at 10:48:59AM +0200, David Hildenbrand wrote: >> On 22.10.20 10:40, David Laight wrote: >>> From: David Hildenbrand >>>> Sent: 22 October 2020 09:35 >>>> >>>> On 22.10.20 10:26, Greg KH wrote: >>>>> On Thu, Oct 22, 2020 at 12:39:14AM +0100, Al Viro wrote: >>>>>> On Wed, Oct 21, 2020 at 06:13:01PM +0200, Greg KH wrote: >>>>>>> On Fri, Sep 25, 2020 at 06:51:39AM +0200, Christoph Hellwig wrote: >>>>>>>> From: David Laight >>>>>>>> >>>>>>>> This lets the compiler inline it into import_iovec() generating >>>>>>>> much better code. >>>>>>>> >>>>>>>> Signed-off-by: David Laight >>>>>>>> Signed-off-by: Christoph Hellwig >>>>>>>> --- >>>>>>>> fs/read_write.c | 179 ------------------------------------------------ >>>>>>>> lib/iov_iter.c | 176 +++++++++++++++++++++++++++++++++++++++++++++++ >>>>>>>> 2 files changed, 176 insertions(+), 179 deletions(-) >>>>>>> >>>>>>> Strangely, this commit causes a regression in Linus's tree right now. >>>>>>> >>>>>>> I can't really figure out what the regression is, only that this commit >>>>>>> triggers a "large Android system binary" from working properly. There's >>>>>>> no kernel log messages anywhere, and I don't have any way to strace the >>>>>>> thing in the testing framework, so any hints that people can provide >>>>>>> would be most appreciated. >>>>>> >>>>>> It's a pure move - modulo changed line breaks in the argument lists >>>>>> the functions involved are identical before and after that (just checked >>>>>> that directly, by checking out the trees before and after, extracting two >>>>>> functions in question from fs/read_write.c and lib/iov_iter.c (before and >>>>>> after, resp.) and checking the diff between those. >>>>>> >>>>>> How certain is your bisection? >>>>> >>>>> The bisection is very reproducable. >>>>> >>>>> But, this looks now to be a compiler bug. I'm using the latest version >>>>> of clang and if I put "noinline" at the front of the function, >>>>> everything works. >>>> >>>> Well, the compiler can do more invasive optimizations when inlining. If >>>> you have buggy code that relies on some unspecified behavior, inlining >>>> can change the behavior ... but going over that code, there isn't too >>>> much action going on. At least nothing screamed at me. >>> >>> Apart from all the optimisations that get rid off the 'pass be reference' >>> parameters and strange conditional tests. >>> Plenty of scope for the compiler getting it wrong. >>> But nothing even vaguely illegal. >> >> Not the first time that people blame the compiler to then figure out >> that something else is wrong ... but maybe this time is different :) > > I agree, I hate to blame the compiler, that's almost never the real > problem, but this one sure "feels" like it. > > I'm running some more tests, trying to narrow things down as just adding > a "noinline" to the function that got moved here doesn't work on Linus's > tree at the moment because the function was split into multiple > functions. > > Give me a few hours... I might be wrong but a) import_iovec() uses: - unsigned nr_segs -> int - unsigned fast_segs -> int b) rw_copy_check_uvector() uses: - unsigned long nr_segs -> long - unsigned long fast_seg -> long So when calling rw_copy_check_uvector(), we have to zero-extend the registers used for passing the arguments. That's definitely done when calling the function explicitly. Maybe when inlining something is messed up? Just a thought ... -- Thanks, David / dhildenb From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Hildenbrand Date: Thu, 22 Oct 2020 09:19:15 +0000 Subject: Re: Buggy commit tracked to: "Re: [PATCH 2/9] iov_iter: move rw_copy_check_uvector() into lib/iov_it Message-Id: List-Id: References: <20200925045146.1283714-1-hch@lst.de> <20200925045146.1283714-3-hch@lst.de> <20201021161301.GA1196312@kroah.com> <20201021233914.GR3576660@ZenIV.linux.org.uk> <20201022082654.GA1477657@kroah.com> <80a2e5fa-718a-8433-1ab0-dd5b3e3b5416@redhat.com> <5d2ecb24db1e415b8ff88261435386ec@AcuMS.aculab.com> <20201022090155.GA1483166@kroah.com> In-Reply-To: <20201022090155.GA1483166@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Greg KH Cc: David Laight , Al Viro , Nick Desaulniers , Christoph Hellwig , "kernel-team@android.com" , Andrew Morton , Jens Axboe , Arnd Bergmann , David Howells , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "linux-mips@vger.kernel.org" , "linux-parisc@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-s390@vger.kernel.org" , "sparclinux@vger.kernel.org" , "linux-block@vger.kernel.org" , "linux-scsi@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" , "linux-aio@kvack.org" , "io-uring@vger.kernel.org" , "linux-arch@vger.kernel.org" , "linux-mm@kvack.org" , "netdev@vger.kernel.org" , "keyrings@vger.kernel.org" , "linux-security-module@vger.kernel.org" On 22.10.20 11:01, Greg KH wrote: > On Thu, Oct 22, 2020 at 10:48:59AM +0200, David Hildenbrand wrote: >> On 22.10.20 10:40, David Laight wrote: >>> From: David Hildenbrand >>>> Sent: 22 October 2020 09:35 >>>> >>>> On 22.10.20 10:26, Greg KH wrote: >>>>> On Thu, Oct 22, 2020 at 12:39:14AM +0100, Al Viro wrote: >>>>>> On Wed, Oct 21, 2020 at 06:13:01PM +0200, Greg KH wrote: >>>>>>> On Fri, Sep 25, 2020 at 06:51:39AM +0200, Christoph Hellwig wrote: >>>>>>>> From: David Laight >>>>>>>> >>>>>>>> This lets the compiler inline it into import_iovec() generating >>>>>>>> much better code. >>>>>>>> >>>>>>>> Signed-off-by: David Laight >>>>>>>> Signed-off-by: Christoph Hellwig >>>>>>>> --- >>>>>>>> fs/read_write.c | 179 ------------------------------------------------ >>>>>>>> lib/iov_iter.c | 176 +++++++++++++++++++++++++++++++++++++++++++++++ >>>>>>>> 2 files changed, 176 insertions(+), 179 deletions(-) >>>>>>> >>>>>>> Strangely, this commit causes a regression in Linus's tree right now. >>>>>>> >>>>>>> I can't really figure out what the regression is, only that this commit >>>>>>> triggers a "large Android system binary" from working properly. There's >>>>>>> no kernel log messages anywhere, and I don't have any way to strace the >>>>>>> thing in the testing framework, so any hints that people can provide >>>>>>> would be most appreciated. >>>>>> >>>>>> It's a pure move - modulo changed line breaks in the argument lists >>>>>> the functions involved are identical before and after that (just checked >>>>>> that directly, by checking out the trees before and after, extracting two >>>>>> functions in question from fs/read_write.c and lib/iov_iter.c (before and >>>>>> after, resp.) and checking the diff between those. >>>>>> >>>>>> How certain is your bisection? >>>>> >>>>> The bisection is very reproducable. >>>>> >>>>> But, this looks now to be a compiler bug. I'm using the latest version >>>>> of clang and if I put "noinline" at the front of the function, >>>>> everything works. >>>> >>>> Well, the compiler can do more invasive optimizations when inlining. If >>>> you have buggy code that relies on some unspecified behavior, inlining >>>> can change the behavior ... but going over that code, there isn't too >>>> much action going on. At least nothing screamed at me. >>> >>> Apart from all the optimisations that get rid off the 'pass be reference' >>> parameters and strange conditional tests. >>> Plenty of scope for the compiler getting it wrong. >>> But nothing even vaguely illegal. >> >> Not the first time that people blame the compiler to then figure out >> that something else is wrong ... but maybe this time is different :) > > I agree, I hate to blame the compiler, that's almost never the real > problem, but this one sure "feels" like it. > > I'm running some more tests, trying to narrow things down as just adding > a "noinline" to the function that got moved here doesn't work on Linus's > tree at the moment because the function was split into multiple > functions. > > Give me a few hours... I might be wrong but a) import_iovec() uses: - unsigned nr_segs -> int - unsigned fast_segs -> int b) rw_copy_check_uvector() uses: - unsigned long nr_segs -> long - unsigned long fast_seg -> long So when calling rw_copy_check_uvector(), we have to zero-extend the registers used for passing the arguments. That's definitely done when calling the function explicitly. Maybe when inlining something is messed up? Just a thought ... -- Thanks, David / dhildenb From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4BD7BC4363A for ; Thu, 22 Oct 2020 09:21:30 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 796B02419B for ; Thu, 22 Oct 2020 09:21:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="PBDa7/Yl"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="ObaPHaMw" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 796B02419B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4CH2124YcfzDqYq for ; Thu, 22 Oct 2020 20:21:26 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=redhat.com (client-ip=216.205.24.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=david@redhat.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=PBDa7/Yl; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ObaPHaMw; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4CH1yt59gzzDqX8 for ; Thu, 22 Oct 2020 20:19:33 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603358370; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GAx1sXwCwRg93ixXlQ7CLSdqwfjOuLlYgV9gYDuI6Ww=; b=PBDa7/Yl7azx5dBg3CGg9XXji6PtU1nO7Wak/Jodjwb0h45RSijw66byyFl5dbud8svGlz LWw6+UgEnCCkREpX1lMm+TngvGcNWR0Z7ZRdaUJKq7unckSQefJ4iYLIzUp886FKo6UCK6 v6tmcKYqbuwYzJvc+13ddRQttfZuwyw= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603358371; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GAx1sXwCwRg93ixXlQ7CLSdqwfjOuLlYgV9gYDuI6Ww=; b=ObaPHaMwdQroeFJ58GuvZBYPclTi+ISWsIPUhoICWGvmE9bO8GipZpAoudC8BdYK8HJj7K nd+YJ9QR6RWDa5djCoXdwY57l6+gyIvQXSwHPdzSblDMsmkb7SEKlXjrbckyDfiz9a3zig wQUamiuE52K71aeVwgPcjysXDHnWgFk= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-509-YuC2ea8uNjCRXVsi9pVVtQ-1; Thu, 22 Oct 2020 05:19:26 -0400 X-MC-Unique: YuC2ea8uNjCRXVsi9pVVtQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 64F581006C9F; Thu, 22 Oct 2020 09:19:22 +0000 (UTC) Received: from [10.36.113.152] (ovpn-113-152.ams2.redhat.com [10.36.113.152]) by smtp.corp.redhat.com (Postfix) with ESMTP id C826360BFA; Thu, 22 Oct 2020 09:19:16 +0000 (UTC) Subject: Re: Buggy commit tracked to: "Re: [PATCH 2/9] iov_iter: move rw_copy_check_uvector() into lib/iov_iter.c" To: Greg KH References: <20200925045146.1283714-1-hch@lst.de> <20200925045146.1283714-3-hch@lst.de> <20201021161301.GA1196312@kroah.com> <20201021233914.GR3576660@ZenIV.linux.org.uk> <20201022082654.GA1477657@kroah.com> <80a2e5fa-718a-8433-1ab0-dd5b3e3b5416@redhat.com> <5d2ecb24db1e415b8ff88261435386ec@AcuMS.aculab.com> <20201022090155.GA1483166@kroah.com> From: David Hildenbrand Organization: Red Hat GmbH Message-ID: Date: Thu, 22 Oct 2020 11:19:15 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.1 MIME-Version: 1.0 In-Reply-To: <20201022090155.GA1483166@kroah.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "linux-aio@kvack.org" , "linux-mips@vger.kernel.org" , David Howells , "linux-mm@kvack.org" , "keyrings@vger.kernel.org" , "sparclinux@vger.kernel.org" , Christoph Hellwig , "linux-arch@vger.kernel.org" , "linux-s390@vger.kernel.org" , "linux-scsi@vger.kernel.org" , "kernel-team@android.com" , Arnd Bergmann , "linux-block@vger.kernel.org" , Al Viro , "io-uring@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , Jens Axboe , "linux-parisc@vger.kernel.org" , "netdev@vger.kernel.org" , Nick Desaulniers , "linux-kernel@vger.kernel.org" , "linux-security-module@vger.kernel.org" , David Laight , "linux-fsdevel@vger.kernel.org" , Andrew Morton , "linuxppc-dev@lists.ozlabs.org" Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On 22.10.20 11:01, Greg KH wrote: > On Thu, Oct 22, 2020 at 10:48:59AM +0200, David Hildenbrand wrote: >> On 22.10.20 10:40, David Laight wrote: >>> From: David Hildenbrand >>>> Sent: 22 October 2020 09:35 >>>> >>>> On 22.10.20 10:26, Greg KH wrote: >>>>> On Thu, Oct 22, 2020 at 12:39:14AM +0100, Al Viro wrote: >>>>>> On Wed, Oct 21, 2020 at 06:13:01PM +0200, Greg KH wrote: >>>>>>> On Fri, Sep 25, 2020 at 06:51:39AM +0200, Christoph Hellwig wrote: >>>>>>>> From: David Laight >>>>>>>> >>>>>>>> This lets the compiler inline it into import_iovec() generating >>>>>>>> much better code. >>>>>>>> >>>>>>>> Signed-off-by: David Laight >>>>>>>> Signed-off-by: Christoph Hellwig >>>>>>>> --- >>>>>>>> fs/read_write.c | 179 ------------------------------------------------ >>>>>>>> lib/iov_iter.c | 176 +++++++++++++++++++++++++++++++++++++++++++++++ >>>>>>>> 2 files changed, 176 insertions(+), 179 deletions(-) >>>>>>> >>>>>>> Strangely, this commit causes a regression in Linus's tree right now. >>>>>>> >>>>>>> I can't really figure out what the regression is, only that this commit >>>>>>> triggers a "large Android system binary" from working properly. There's >>>>>>> no kernel log messages anywhere, and I don't have any way to strace the >>>>>>> thing in the testing framework, so any hints that people can provide >>>>>>> would be most appreciated. >>>>>> >>>>>> It's a pure move - modulo changed line breaks in the argument lists >>>>>> the functions involved are identical before and after that (just checked >>>>>> that directly, by checking out the trees before and after, extracting two >>>>>> functions in question from fs/read_write.c and lib/iov_iter.c (before and >>>>>> after, resp.) and checking the diff between those. >>>>>> >>>>>> How certain is your bisection? >>>>> >>>>> The bisection is very reproducable. >>>>> >>>>> But, this looks now to be a compiler bug. I'm using the latest version >>>>> of clang and if I put "noinline" at the front of the function, >>>>> everything works. >>>> >>>> Well, the compiler can do more invasive optimizations when inlining. If >>>> you have buggy code that relies on some unspecified behavior, inlining >>>> can change the behavior ... but going over that code, there isn't too >>>> much action going on. At least nothing screamed at me. >>> >>> Apart from all the optimisations that get rid off the 'pass be reference' >>> parameters and strange conditional tests. >>> Plenty of scope for the compiler getting it wrong. >>> But nothing even vaguely illegal. >> >> Not the first time that people blame the compiler to then figure out >> that something else is wrong ... but maybe this time is different :) > > I agree, I hate to blame the compiler, that's almost never the real > problem, but this one sure "feels" like it. > > I'm running some more tests, trying to narrow things down as just adding > a "noinline" to the function that got moved here doesn't work on Linus's > tree at the moment because the function was split into multiple > functions. > > Give me a few hours... I might be wrong but a) import_iovec() uses: - unsigned nr_segs -> int - unsigned fast_segs -> int b) rw_copy_check_uvector() uses: - unsigned long nr_segs -> long - unsigned long fast_seg -> long So when calling rw_copy_check_uvector(), we have to zero-extend the registers used for passing the arguments. That's definitely done when calling the function explicitly. Maybe when inlining something is messed up? Just a thought ... -- Thanks, David / dhildenb From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 32B07C4363A for ; Thu, 22 Oct 2020 09:20:44 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 84AA22463D for ; Thu, 22 Oct 2020 09:20:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="p851MFKF"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="PBDa7/Yl" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 84AA22463D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=whEnKq94XWw0H7LN62Asd5dLbq3FWNurXx8zfUfBt+c=; b=p851MFKFD/85BUI8loY9hC2SA UqHnmlf/S2F00dD6FfRGU02FUWy6I1X2gWfww8Eu+khHvvKzqsxn7O2+R1wGfbPuQKd0hXSoQQn5j olLcmSpuZ3576i2XrxqrA77hh9wn1ch5P7vEw1k4qGEtjmnVKfQX3Vtytbs/UDj7RFvptmTTGaHqP nFmnLTeVR8w/Y2WMKxrA2Ut3CnP4gmM8C9EjYKx3uyZ+vJlmAXD6cTSZbXQNvfyqKdpJubk58pnXa gPoKgDPKppO7BvX5uE1Z2/AjpYO3lay38mGpZjryAgyddOUThkKgNzs2C8fw8Yjr9MOWitZP3WO4B jaZh+RW7w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kVWkz-0003OY-2A; Thu, 22 Oct 2020 09:19:37 +0000 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kVWkw-0003MI-16 for linux-arm-kernel@lists.infradead.org; Thu, 22 Oct 2020 09:19:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603358370; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GAx1sXwCwRg93ixXlQ7CLSdqwfjOuLlYgV9gYDuI6Ww=; b=PBDa7/Yl7azx5dBg3CGg9XXji6PtU1nO7Wak/Jodjwb0h45RSijw66byyFl5dbud8svGlz LWw6+UgEnCCkREpX1lMm+TngvGcNWR0Z7ZRdaUJKq7unckSQefJ4iYLIzUp886FKo6UCK6 v6tmcKYqbuwYzJvc+13ddRQttfZuwyw= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-509-YuC2ea8uNjCRXVsi9pVVtQ-1; Thu, 22 Oct 2020 05:19:26 -0400 X-MC-Unique: YuC2ea8uNjCRXVsi9pVVtQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 64F581006C9F; Thu, 22 Oct 2020 09:19:22 +0000 (UTC) Received: from [10.36.113.152] (ovpn-113-152.ams2.redhat.com [10.36.113.152]) by smtp.corp.redhat.com (Postfix) with ESMTP id C826360BFA; Thu, 22 Oct 2020 09:19:16 +0000 (UTC) Subject: Re: Buggy commit tracked to: "Re: [PATCH 2/9] iov_iter: move rw_copy_check_uvector() into lib/iov_iter.c" To: Greg KH References: <20200925045146.1283714-1-hch@lst.de> <20200925045146.1283714-3-hch@lst.de> <20201021161301.GA1196312@kroah.com> <20201021233914.GR3576660@ZenIV.linux.org.uk> <20201022082654.GA1477657@kroah.com> <80a2e5fa-718a-8433-1ab0-dd5b3e3b5416@redhat.com> <5d2ecb24db1e415b8ff88261435386ec@AcuMS.aculab.com> <20201022090155.GA1483166@kroah.com> From: David Hildenbrand Organization: Red Hat GmbH Message-ID: Date: Thu, 22 Oct 2020 11:19:15 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.1 MIME-Version: 1.0 In-Reply-To: <20201022090155.GA1483166@kroah.com> Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201022_051934_106711_1B176776 X-CRM114-Status: GOOD ( 29.65 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "linux-aio@kvack.org" , "linux-mips@vger.kernel.org" , David Howells , "linux-mm@kvack.org" , "keyrings@vger.kernel.org" , "sparclinux@vger.kernel.org" , Christoph Hellwig , "linux-arch@vger.kernel.org" , "linux-s390@vger.kernel.org" , "linux-scsi@vger.kernel.org" , "kernel-team@android.com" , Arnd Bergmann , "linux-block@vger.kernel.org" , Al Viro , "io-uring@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , Jens Axboe , "linux-parisc@vger.kernel.org" , "netdev@vger.kernel.org" , Nick Desaulniers , "linux-kernel@vger.kernel.org" , "linux-security-module@vger.kernel.org" , David Laight , "linux-fsdevel@vger.kernel.org" , Andrew Morton , "linuxppc-dev@lists.ozlabs.org" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 22.10.20 11:01, Greg KH wrote: > On Thu, Oct 22, 2020 at 10:48:59AM +0200, David Hildenbrand wrote: >> On 22.10.20 10:40, David Laight wrote: >>> From: David Hildenbrand >>>> Sent: 22 October 2020 09:35 >>>> >>>> On 22.10.20 10:26, Greg KH wrote: >>>>> On Thu, Oct 22, 2020 at 12:39:14AM +0100, Al Viro wrote: >>>>>> On Wed, Oct 21, 2020 at 06:13:01PM +0200, Greg KH wrote: >>>>>>> On Fri, Sep 25, 2020 at 06:51:39AM +0200, Christoph Hellwig wrote: >>>>>>>> From: David Laight >>>>>>>> >>>>>>>> This lets the compiler inline it into import_iovec() generating >>>>>>>> much better code. >>>>>>>> >>>>>>>> Signed-off-by: David Laight >>>>>>>> Signed-off-by: Christoph Hellwig >>>>>>>> --- >>>>>>>> fs/read_write.c | 179 ------------------------------------------------ >>>>>>>> lib/iov_iter.c | 176 +++++++++++++++++++++++++++++++++++++++++++++++ >>>>>>>> 2 files changed, 176 insertions(+), 179 deletions(-) >>>>>>> >>>>>>> Strangely, this commit causes a regression in Linus's tree right now. >>>>>>> >>>>>>> I can't really figure out what the regression is, only that this commit >>>>>>> triggers a "large Android system binary" from working properly. There's >>>>>>> no kernel log messages anywhere, and I don't have any way to strace the >>>>>>> thing in the testing framework, so any hints that people can provide >>>>>>> would be most appreciated. >>>>>> >>>>>> It's a pure move - modulo changed line breaks in the argument lists >>>>>> the functions involved are identical before and after that (just checked >>>>>> that directly, by checking out the trees before and after, extracting two >>>>>> functions in question from fs/read_write.c and lib/iov_iter.c (before and >>>>>> after, resp.) and checking the diff between those. >>>>>> >>>>>> How certain is your bisection? >>>>> >>>>> The bisection is very reproducable. >>>>> >>>>> But, this looks now to be a compiler bug. I'm using the latest version >>>>> of clang and if I put "noinline" at the front of the function, >>>>> everything works. >>>> >>>> Well, the compiler can do more invasive optimizations when inlining. If >>>> you have buggy code that relies on some unspecified behavior, inlining >>>> can change the behavior ... but going over that code, there isn't too >>>> much action going on. At least nothing screamed at me. >>> >>> Apart from all the optimisations that get rid off the 'pass be reference' >>> parameters and strange conditional tests. >>> Plenty of scope for the compiler getting it wrong. >>> But nothing even vaguely illegal. >> >> Not the first time that people blame the compiler to then figure out >> that something else is wrong ... but maybe this time is different :) > > I agree, I hate to blame the compiler, that's almost never the real > problem, but this one sure "feels" like it. > > I'm running some more tests, trying to narrow things down as just adding > a "noinline" to the function that got moved here doesn't work on Linus's > tree at the moment because the function was split into multiple > functions. > > Give me a few hours... I might be wrong but a) import_iovec() uses: - unsigned nr_segs -> int - unsigned fast_segs -> int b) rw_copy_check_uvector() uses: - unsigned long nr_segs -> long - unsigned long fast_seg -> long So when calling rw_copy_check_uvector(), we have to zero-extend the registers used for passing the arguments. That's definitely done when calling the function explicitly. Maybe when inlining something is messed up? Just a thought ... -- Thanks, David / dhildenb _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel