Received: by 2002:a05:6a10:5594:0:0:0:0 with SMTP id ee20csp559374pxb; Mon, 25 Apr 2022 16:32:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx769egvGZarTdx6HJbXnr49Z8lGRPEERydPsPkFDranYu56sRPUGwvHtmEIdB8Safv1oDE X-Received: by 2002:a63:2c9:0:b0:3ab:2c8:9425 with SMTP id 192-20020a6302c9000000b003ab02c89425mr10502191pgc.56.1650929566303; Mon, 25 Apr 2022 16:32:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650929566; cv=none; d=google.com; s=arc-20160816; b=R+hV+BOxoScrwgqamb1NEGcbPClPrJSC2hvJInbaRpDdt+0EIoOuCzR00gesEfqt+O nGFywQCC5b+8ESEUa4/Hj5MdHEgloot3b9h5uTgKY9n4DsKH/iV8rq92lrsrsie5UDF4 eiuTFd38V4r6f+EwyCnVF1fJjQGuSElaEM3529R03r8OFSJjoSMBZjmF2TDcG2+/wEOu z+vpgAetrpBB8Zbqo/HroYIi5KoHWY0e3W7lwnnEmVCVfFsR3K3Txt1UPSGfwJb0aj7Z OHL3Uk4I4OzKZDMh3X4907HjahT8OjD58vovMiPRgzexa3lcQ66nkSeDlc2P/pnGShT7 RUWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=859SzIAl5s4qyDYzHMnInkzDTVU0f+lfGR9c6BypQKU=; b=0M+TMOV/LssXMJXhgsXEY6dK0hZkMa73OT2VkPAncweBItAXS8APz7Z1jciSW8G1U7 fqP4eDNY4uD47ZfaAtWu6CVB0FN1pqTvCfLVzBdtVAcx8DfKzh6lYSzCzmikUOd/MOYQ nGP1ZZueQl/QLdIZlxH7Q2nzISNkther+eX5rTa1wzAfRCDA5BAz889WZcKDQcGmfyAi QZfDnFWSX7TdUTnwvlDyj5b4LkIxbKFEWwgEgxrH46W+WDVabFeUjWaVjBOi1NqOFCnl YBrbJDvtprLDG5iROpMd8WXC4n+8dVoIVLz5HJeE7z3hT5KDi5c7znL8oAYqrcKdwTLB ok/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=VFMKBb4s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mq6-20020a17090b380600b001d29340d057si841444pjb.3.2022.04.25.16.32.28; Mon, 25 Apr 2022 16:32:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=VFMKBb4s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233238AbiDYXQR (ORCPT + 99 others); Mon, 25 Apr 2022 19:16:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231320AbiDYXQP (ORCPT ); Mon, 25 Apr 2022 19:16:15 -0400 Received: from mail-qk1-x72b.google.com (mail-qk1-x72b.google.com [IPv6:2607:f8b0:4864:20::72b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58A6D4614D for ; Mon, 25 Apr 2022 16:13:08 -0700 (PDT) Received: by mail-qk1-x72b.google.com with SMTP id 79so149335qkk.10 for ; Mon, 25 Apr 2022 16:13:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=859SzIAl5s4qyDYzHMnInkzDTVU0f+lfGR9c6BypQKU=; b=VFMKBb4spKVN4vXzZmGlcljUkn8jDXuHsiypBo8IpuM+TtBh+LnxNjfREzL8kMHQ+/ GyN6Hve3dAxf26J8NV9n1G2dLOP6w4d8Wi+PdKWvN0RNtdhCshdN4Kj01Aa42XW/S7Rz 7Q9T6F4NBS917g8xR2MU60I8vn2Zp7N/VQteaEwXAVlbERBnfvYLAPKIunkG0MAt3gtV 0vk3il+3Co25IWYnl2IT5zWZ93sJcqqHpmE++7SkTInXHWwN35cr4URvGhyuj6pyWyBf iKRcbEl3hWk6wBiIdAdnote+DN2WS5js6dUKvdufawLmRDPL4DDEEFUTFynGLDs50qLB BnNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=859SzIAl5s4qyDYzHMnInkzDTVU0f+lfGR9c6BypQKU=; b=XMIf2FozRCc8GfJTPdMDddoGilFOwyYUVRALfY244336a9kYpe+WslAH2NAIeBGXdc sb+Vpo6ubbaZFCrB7F6aYr0QdKAnG2MFYLs45jEVY0se1IHJxtjQC0rTljD+eLcsGcFO AUxjGH9zY7WqoBNTNaaIrQHdTyMutLoSyrevtZ5KfrGZYYQUasn2bQ0miyvXnh9+8UC7 DCVe8nttgDw+FyqgbUS5q0GQCSbWbpWW3mzrpQkyoBeAeQHmRRQOnr5XtQvkCrEtJAiX wgG7wqqTRQwsJYzIZz2JSW5JIDcguFpPdH/DXgyFcV73pvzIAdRhq/kaDdLGSk/JyEoZ bAtw== X-Gm-Message-State: AOAM533XSQjju+ZR2Sp62JO1kuhbpcCuDj6/rRjZOuJIca+6pHZgK1sS E3rMCFgqK0diUsXm+g52nsI9aQ== X-Received: by 2002:a37:4549:0:b0:69f:556c:4e38 with SMTP id s70-20020a374549000000b0069f556c4e38mr4588420qka.202.1650928387552; Mon, 25 Apr 2022 16:13:07 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-142-162-113-129.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.162.113.129]) by smtp.gmail.com with ESMTPSA id h23-20020ac87777000000b002f3604761desm5115402qtu.35.2022.04.25.16.13.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Apr 2022 16:13:06 -0700 (PDT) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1nj7tB-009VkQ-Qg; Mon, 25 Apr 2022 20:13:05 -0300 Date: Mon, 25 Apr 2022 20:13:05 -0300 From: Jason Gunthorpe To: Mateusz =?utf-8?Q?Jo=C5=84czyk?= Cc: netdev@vger.kernel.org, "linux-kernel@vger.kernel.org" , David Laight , Andrew Morton , Christophe Leroy , Anshuman Khandual , linux-rdma@vger.kernel.org Subject: Re: "mm: uninline copy_overflow()" breaks i386 build in Mellanox MLX4 Message-ID: <20220425231305.GY64706@ziepe.ca> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 21, 2022 at 10:47:01PM +0200, Mateusz Jończyk wrote: > Hello, > > commit ad7489d5262d ("mm: uninline copy_overflow()") > > breaks for me a build for i386 in the Mellanox MLX4 driver: > >         In file included from ./arch/x86/include/asm/preempt.h:7, >                          from ./include/linux/preempt.h:78, >                          from ./include/linux/percpu.h:6, >                          from ./include/linux/context_tracking_state.h:5, >                          from ./include/linux/hardirq.h:5, >                          from drivers/net/ethernet/mellanox/mlx4/cq.c:37: >         In function ‘check_copy_size’, >             inlined from ‘copy_to_user’ at ./include/linux/uaccess.h:159:6, >             inlined from ‘mlx4_init_user_cqes’ at drivers/net/ethernet/mellanox/mlx4/cq.c:317:9, >             inlined from ‘mlx4_cq_alloc’ at drivers/net/ethernet/mellanox/mlx4/cq.c:394:10: >         ./include/linux/thread_info.h:228:4: error: call to ‘__bad_copy_from’ declared with attribute error: copy source size is too small >           228 |    __bad_copy_from(); >               |    ^~~~~~~~~~~~~~~~~ >         make[5]: *** [scripts/Makefile.build:288: drivers/net/ethernet/mellanox/mlx4/cq.o] Błąd 1 >         make[4]: *** [scripts/Makefile.build:550: drivers/net/ethernet/mellanox/mlx4] Błąd 2 >         make[3]: *** [scripts/Makefile.build:550: drivers/net/ethernet/mellanox] Błąd 2 >         make[2]: *** [scripts/Makefile.build:550: drivers/net/ethernet] Błąd 2 >         make[1]: *** [scripts/Makefile.build:550: drivers/net] Błąd 2 > > Reverting this commit fixes the build. Disabling Mellanox Ethernet drivers > in Kconfig (tested only with also disabling of all Infiniband support) also fixes the build. > > It appears that uninlining of copy_overflow() causes GCC to analyze the code deeper. This looks like a compiler bug to me, array_size(entries, cqe_size) cannot be known at compile time, so the __builtin_constant_p(bytes) should be compile time false meaning the other two bad branches should have been eliminated. Jason