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=-3.9 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=no 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 547CCC33CA9 for ; Tue, 14 Jan 2020 03:48:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 25A2B214AF for ; Tue, 14 Jan 2020 03:48:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=sifive.com header.i=@sifive.com header.b="nQc8qxdX" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729472AbgANDse (ORCPT ); Mon, 13 Jan 2020 22:48:34 -0500 Received: from mail-qk1-f193.google.com ([209.85.222.193]:43477 "EHLO mail-qk1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729366AbgANDse (ORCPT ); Mon, 13 Jan 2020 22:48:34 -0500 Received: by mail-qk1-f193.google.com with SMTP id t129so10884172qke.10 for ; Mon, 13 Jan 2020 19:48:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=CTJ2coo4RHoH/lJGEL6/xkagWbBVDH7gBcZR8SjOkz8=; b=nQc8qxdX/AeOVnGOFlRCgCYp1v+Q9S3HUvIYqgb2rMKCYn9H5NsgVRHIHo5c7toLey TL4BEKQxXsuUYLj7+4+xMp3q50jmsSvEjvG+9J0yvLmS8T2iQrpzs2qY9wRhbRKmCJxn qhL8WI1HWHG9fPkkH8HxV/eOlqTHBINXjp0kFBOeruRYTz/qagED/LKtJMr+FJECKcye axHnG/a53UeioPdkcDOXPDm5WZygoCFWZYwZpEcMGe9FJhkcook5Z5qNfC7miQ2HUWte nB5mIAF0jz0sjypPQprD8RerGyQAys+ZI5JkALp+Xx77+fFJp+XHYzq6w+NKG6SkW/jn 6+lA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=CTJ2coo4RHoH/lJGEL6/xkagWbBVDH7gBcZR8SjOkz8=; b=IXbyat4n5aa4v4W3LDn2hBav3asH+POG2t11+1RDx6kLCUPGA5CokdCr4cdSXENxQY 45k3JT97dbeB1C7cTwn96kzVLawce/QkdfTjg1wQnHu9lb534KSbTaEwPuXJL9T9A1cx 9DPU+EhbsWEED33HUnMJFmS8B1keefjhIzMg0V3Pa/uLhu3Eki0bnZuQKppWGU/CVUC2 Adsm2+tX/pi83x7wn/mO2lUfgCcqKWdJXfNrVd/m8xIdXEhYduKcC59t/qLg1CPJgvfB LkWcJM4+S42r+8G5CyPNAmt1xH1sofnEabF/AWUMaqWi7tHdd0Z2cjYWJqkYpIAQklrN HJTw== X-Gm-Message-State: APjAAAWj25i9vD4vTdgAso4RtvG+kkjXokbjpptilSew2R9dkIP5DVw6 FpW25MVj6k+unmZg1uuZKcp5HZuT76C3uN+misYMmg== X-Google-Smtp-Source: APXvYqzDpb9Yyqx7bCFNZvCTSYvZ5WdMj+Wq11S0hKuv/ey3nRFiCF4ih93/7FilTGOzb44QaMjq/NvjhXCEP9VwNiA= X-Received: by 2002:ae9:c018:: with SMTP id u24mr19621044qkk.339.1578973713171; Mon, 13 Jan 2020 19:48:33 -0800 (PST) MIME-Version: 1.0 References: <20200109031516.29639-1-greentime.hu@sifive.com> In-Reply-To: From: Greentime Hu Date: Tue, 14 Jan 2020 11:48:21 +0800 Message-ID: Subject: Re: [PATCH v3] riscv: make sure the cores stay looping in .Lsecondary_park To: Paul Walmsley Cc: Gt , greentime@kernel.org, Palmer Dabbelt , linux-riscv , Linux Kernel Mailing List , Andreas Schwab , Anup Patel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Paul, On Mon, Jan 13, 2020 at 2:12 AM Paul Walmsley wrote: > > Hi Greentime, > > On Thu, 9 Jan 2020, Paul Walmsley wrote: > > > On Thu, 9 Jan 2020, Greentime Hu wrote: > > > > > The code in secondary_park is currently placed in the .init section. The > > > kernel reclaims and clears this code when it finishes booting. That > > > causes the cores parked in it to go to somewhere unpredictable, so we > > > move this function out of init to make sure the cores stay looping there. > > > > > > Signed-off-by: Greentime Hu > > > Reviewed-by: Anup Patel > > > > Thanks, the following is what's been queued for v5.5-rc. > > During final testing, when building the kernel with an initramfs, I hit > the following linker error: > > LD .tmp_vmlinux1 > arch/riscv/kernel/head.o: in function `.L0 ':(.init.text+0x5c): relocation truncated to fit: R_RISCV_JAL against `.Lsecondary_park' > make[1]: *** [Makefile:1079: vmlinux] Error 1 > make: *** [Makefile:326: __build_one_by_one] Error 2 > > Could you take a look at this? I think it is because the sections are too far for bqeu to jump and the config I used just small enough for it to jump so I didn't see this bug. Sorry about that. I tried this fix to boot in Unleashed board. #ifdef CONFIG_SMP li t0, CONFIG_NR_CPUS - bgeu a0, t0, .Lsecondary_park + blt a0, t0, .Lgood_cores + tail .Lsecondary_park +.Lgood_cores: #endif 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=-3.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=no 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 E5788C33CA9 for ; Tue, 14 Jan 2020 03:48:40 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 B8B29214AF for ; Tue, 14 Jan 2020 03:48:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="GbUOvaZh"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=sifive.com header.i=@sifive.com header.b="nQc8qxdX" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B8B29214AF Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sifive.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+infradead-linux-riscv=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:To: Subject:Message-ID:Date:From:In-Reply-To:References:MIME-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=CTJ2coo4RHoH/lJGEL6/xkagWbBVDH7gBcZR8SjOkz8=; b=GbUOvaZhkOVdqDmhElcxnJPV8 AlaSg0MlIVAqyll8BcBF8fVK46wLGPcVwUdQf56X6wqckLe0B2DCaVRfE3gIeLPieUG7Qe/KdbwiM L+D0ZFvI5kP43G/KN5kgY0ULy2Wd747CiGVpW47QgXEoDhrTvzBFjXjyJlq7TIh8CtkxLYAHsCezj WyCI5R5faOLqkq7QdqtleKGrDgha4bPI6wrBh93W3ZowdifdcRLwaB2yx89w1CQcUUaW6ti3yQdU6 OC1R1QON+ffq6yqrIHm7nULxz8NwzpVHXBb3LbZdQ9l08iQIMkl3uMlciXHBkok2rTY+UXi7wuKL4 TPrh8nDcw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1irDC1-00026G-OH; Tue, 14 Jan 2020 03:48:37 +0000 Received: from mail-qk1-x741.google.com ([2607:f8b0:4864:20::741]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1irDBy-00025W-Qq for linux-riscv@lists.infradead.org; Tue, 14 Jan 2020 03:48:36 +0000 Received: by mail-qk1-x741.google.com with SMTP id r14so10871976qke.13 for ; Mon, 13 Jan 2020 19:48:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=CTJ2coo4RHoH/lJGEL6/xkagWbBVDH7gBcZR8SjOkz8=; b=nQc8qxdX/AeOVnGOFlRCgCYp1v+Q9S3HUvIYqgb2rMKCYn9H5NsgVRHIHo5c7toLey TL4BEKQxXsuUYLj7+4+xMp3q50jmsSvEjvG+9J0yvLmS8T2iQrpzs2qY9wRhbRKmCJxn qhL8WI1HWHG9fPkkH8HxV/eOlqTHBINXjp0kFBOeruRYTz/qagED/LKtJMr+FJECKcye axHnG/a53UeioPdkcDOXPDm5WZygoCFWZYwZpEcMGe9FJhkcook5Z5qNfC7miQ2HUWte nB5mIAF0jz0sjypPQprD8RerGyQAys+ZI5JkALp+Xx77+fFJp+XHYzq6w+NKG6SkW/jn 6+lA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=CTJ2coo4RHoH/lJGEL6/xkagWbBVDH7gBcZR8SjOkz8=; b=O/IxPhg6SeAcCCPHJKMorRpUTByceR9Q4XSO/XDqVYMn4NWWx+n+Ic6g615YCH7Vny 1Yo1YSJfbBmg32O9vs9Ui4UU25NGI2dnGV9MQ2TtDwgDgPRCCXaXkLhjb7cibzcnTSEV YjAalglO0sqdctmLLbi/T7FNNmer0RNA3VSzcs4xPLNwV6LvIMmofRLbmG15n9ATL9ze VpQyQt+IuPSKvhqTQuPuic0/rfL+1bc7Oaqda9i03NQf61FCkPK1CmKFalSElEmptxr+ 0IoIHfxTaoTN/yvm+AEOz3XIrP1ziVS5W3sZYRA471wbyhCpzUZv3nKAi38XyF59XO4g uZZQ== X-Gm-Message-State: APjAAAVJxisV5Wy9MVQ3qBqaqcuvuRK1GWbc+BN0qoQhGEaJm1h9S/dY Q1Uv62W6SnPNLm8OQ4f8AnEv33MhBSseQsh/lUfFzQ== X-Google-Smtp-Source: APXvYqzDpb9Yyqx7bCFNZvCTSYvZ5WdMj+Wq11S0hKuv/ey3nRFiCF4ih93/7FilTGOzb44QaMjq/NvjhXCEP9VwNiA= X-Received: by 2002:ae9:c018:: with SMTP id u24mr19621044qkk.339.1578973713171; Mon, 13 Jan 2020 19:48:33 -0800 (PST) MIME-Version: 1.0 References: <20200109031516.29639-1-greentime.hu@sifive.com> In-Reply-To: From: Greentime Hu Date: Tue, 14 Jan 2020 11:48:21 +0800 Message-ID: Subject: Re: [PATCH v3] riscv: make sure the cores stay looping in .Lsecondary_park To: Paul Walmsley Content-Type: text/plain; charset="UTF-8" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200113_194835_089628_8D74A995 X-CRM114-Status: GOOD ( 14.60 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andreas Schwab , Linux Kernel Mailing List , Palmer Dabbelt , Gt , Anup Patel , greentime@kernel.org, linux-riscv Sender: "linux-riscv" Errors-To: linux-riscv-bounces+infradead-linux-riscv=archiver.kernel.org@lists.infradead.org Hi Paul, On Mon, Jan 13, 2020 at 2:12 AM Paul Walmsley wrote: > > Hi Greentime, > > On Thu, 9 Jan 2020, Paul Walmsley wrote: > > > On Thu, 9 Jan 2020, Greentime Hu wrote: > > > > > The code in secondary_park is currently placed in the .init section. The > > > kernel reclaims and clears this code when it finishes booting. That > > > causes the cores parked in it to go to somewhere unpredictable, so we > > > move this function out of init to make sure the cores stay looping there. > > > > > > Signed-off-by: Greentime Hu > > > Reviewed-by: Anup Patel > > > > Thanks, the following is what's been queued for v5.5-rc. > > During final testing, when building the kernel with an initramfs, I hit > the following linker error: > > LD .tmp_vmlinux1 > arch/riscv/kernel/head.o: in function `.L0 ':(.init.text+0x5c): relocation truncated to fit: R_RISCV_JAL against `.Lsecondary_park' > make[1]: *** [Makefile:1079: vmlinux] Error 1 > make: *** [Makefile:326: __build_one_by_one] Error 2 > > Could you take a look at this? I think it is because the sections are too far for bqeu to jump and the config I used just small enough for it to jump so I didn't see this bug. Sorry about that. I tried this fix to boot in Unleashed board. #ifdef CONFIG_SMP li t0, CONFIG_NR_CPUS - bgeu a0, t0, .Lsecondary_park + blt a0, t0, .Lgood_cores + tail .Lsecondary_park +.Lgood_cores: #endif