Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp263110pxb; Mon, 2 Nov 2020 21:31:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJw4diBPrZ5lmI+Jmw6gQE6TgypXiZZQ2peGBKfr2WdrUchw3QbDC86a/tIsFN5ZwEwJyGjN X-Received: by 2002:a50:d5dd:: with SMTP id g29mr3697698edj.344.1604381496096; Mon, 02 Nov 2020 21:31:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604381496; cv=none; d=google.com; s=arc-20160816; b=fwCLW0i0bHdyCOCxl1WxC+ykbj3q531n8BWfTpRfyW7zUuukDPr8U0xZA3jaDDrn+p 1yYwOq3CUzxeIVtyXVQ2qvT+QPagMJO/8jYNh2LUkNjdQanezPhuCrl6FTHneHiGOoTG hyDbAZYmohm6AlUIDuz5Cgk0YK7PK0Ee1yWspu/xkOcyaxV8a3DPk1t/dDJDrKPHii/W ij2Q5R00YvnjMlGGmueYXb5l5YlivYZ/NMIqyqcDV0sCVbTOsuXzkwK6TzL7PQAjNodH FKg2y32rLz5TiwlAbAodlJggYFbESH0h4hpcIrD4658CBifHEaSOsWp65Am0gWJfd3Ed z61Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject:dkim-signature:ai-spam-status:dkim-signature; bh=II35OElRkRV0Y5q6+D4TqKUAx/NyrJHp3sJ8Cro4jHE=; b=m79zJES719YHwLZ7cNO4oNSb4srZUt/IqXwoKZqZs6mDHBtIVbZ5EXYS1L5ZGHtHEh xYBwxfKxs+R9Lbf2XWPjGMsboqvXNmxsNgA+5OvJfXENyxt/xAyhjhFG+X7YNJpNAV+5 DnLhZkN7Xqdem8Iq5XEH+34SzUUAPLlq7gqCc9MHF9d3+pyxEcvJpPmn7I5HkaD71PLb gl+hIe3Sb/3+ErNq22/U/5ABGH2au0oGLNkQm19or0szEorrm5qQzHpjZEzTGQTkXTXg IGp7vlHYcbg28wiDPEJsT2vGFhcFVKdsu5PNq2oKelZfHSB4g2HHrEaIGEcsviaKPEgd u8kA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mymailcheap.com header.s=default header.b=rg1geAZX; dkim=fail header.i=@flygoat.com header.s=default header.b=Es9+8y5U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h23si13394523ejx.192.2020.11.02.21.31.13; Mon, 02 Nov 2020 21:31:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@mymailcheap.com header.s=default header.b=rg1geAZX; dkim=fail header.i=@flygoat.com header.s=default header.b=Es9+8y5U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726920AbgKCF3G (ORCPT + 99 others); Tue, 3 Nov 2020 00:29:06 -0500 Received: from relay-us1.mymailcheap.com ([51.81.35.219]:53136 "EHLO relay-us1.mymailcheap.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725958AbgKCF3F (ORCPT ); Tue, 3 Nov 2020 00:29:05 -0500 Received: from relay5.mymailcheap.com (relay5.mymailcheap.com [159.100.248.207]) by relay-us1.mymailcheap.com (Postfix) with ESMTPS id F083A20E80 for ; Tue, 3 Nov 2020 05:29:03 +0000 (UTC) Received: from relay2.mymailcheap.com (relay2.mymailcheap.com [151.80.165.199]) by relay5.mymailcheap.com (Postfix) with ESMTPS id D2CF7260EB; Tue, 3 Nov 2020 05:28:58 +0000 (UTC) Received: from filter1.mymailcheap.com (filter1.mymailcheap.com [149.56.130.247]) by relay2.mymailcheap.com (Postfix) with ESMTPS id 61E6E3ECDA; Tue, 3 Nov 2020 06:28:56 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by filter1.mymailcheap.com (Postfix) with ESMTP id 8C6972A2AC; Tue, 3 Nov 2020 00:28:55 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mymailcheap.com; s=default; t=1604381335; bh=GOnSbMLdOvGxt4Ou0iinP/mHH3Ln71unuX6HvSiRG7A=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=rg1geAZXSXgdqCVSDwOVBTn/g8l+pDQLvuFyANm3fs4fMR5qsaj7S8FB/aa4wvlYK 6wK5cWUBHcyU0IyGTzs1Dh9AsfrEcb8KkNCnE/j4Mo6AiDPG/Crq3JP6tEut0RXBqF LkohLcu4UDQ+9TMLfbGKNluxojsUiy8jt4iQI9x4= X-Virus-Scanned: Debian amavisd-new at filter1.mymailcheap.com Received: from filter1.mymailcheap.com ([127.0.0.1]) by localhost (filter1.mymailcheap.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VaskAYvXfNMU; Tue, 3 Nov 2020 00:28:53 -0500 (EST) Received: from mail20.mymailcheap.com (mail20.mymailcheap.com [51.83.111.147]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by filter1.mymailcheap.com (Postfix) with ESMTPS; Tue, 3 Nov 2020 00:28:53 -0500 (EST) Received: from [213.133.102.83] (ml.mymailcheap.com [213.133.102.83]) by mail20.mymailcheap.com (Postfix) with ESMTP id 720864012A; Tue, 3 Nov 2020 05:28:50 +0000 (UTC) Authentication-Results: mail20.mymailcheap.com; dkim=pass (1024-bit key; unprotected) header.d=flygoat.com header.i=@flygoat.com header.b="Es9+8y5U"; dkim-atps=neutral AI-Spam-Status: Not processed Received: from [0.0.0.0] (unknown [113.52.132.214]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail20.mymailcheap.com (Postfix) with ESMTPSA id 23B144012A; Tue, 3 Nov 2020 05:28:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=flygoat.com; s=default; t=1604381326; bh=GOnSbMLdOvGxt4Ou0iinP/mHH3Ln71unuX6HvSiRG7A=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=Es9+8y5UeYcoRBX66J8s7Va8GwxUVn/UAWpmZex/szVI+a3PV+83cwAkDBe706Ff1 YNmvvDOTbToEjsn0XvnohnNI9cV5edhupbamecHHupuOFYZKz8kSflKL3ZkZSlbrta 5KI9lK4nZoWGYQuYU0Fg1GxG8DGim+s9E3GVemjg= Subject: Re: [PATCH v2 5/6] MIPS: Loongson64: Make sure the PC address is correct when 3A4000+ CPU hotplug To: Tiezhu Yang , Thomas Bogendoerfer , Huacai Chen Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Xuefeng Li , Lu Zeng , Jun Yi References: <1604373306-3599-1-git-send-email-yangtiezhu@loongson.cn> <1604373306-3599-6-git-send-email-yangtiezhu@loongson.cn> From: Jiaxun Yang Message-ID: Date: Tue, 3 Nov 2020 13:28:39 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <1604373306-3599-6-git-send-email-yangtiezhu@loongson.cn> Content-Type: text/plain; charset=gbk; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 720864012A X-Spamd-Result: default: False [2.90 / 10.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; RECEIVED_SPAMHAUS_XBL(3.00)[113.52.132.214:received]; R_DKIM_ALLOW(0.00)[flygoat.com:s=default]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; R_SPF_SOFTFAIL(0.00)[~all]; ML_SERVERS(-3.10)[213.133.102.83]; DKIM_TRACE(0.00)[flygoat.com:+]; DMARC_POLICY_ALLOW(0.00)[flygoat.com,none]; RCPT_COUNT_SEVEN(0.00)[8]; DMARC_POLICY_ALLOW_WITH_FAILURES(0.00)[]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:24940, ipnet:213.133.96.0/19, country:DE]; RCVD_COUNT_TWO(0.00)[2]; MID_RHS_MATCH_FROM(0.00)[]; HFILTER_HELO_BAREIP(3.00)[213.133.102.83,1] X-Rspamd-Server: mail20.mymailcheap.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ?? 2020/11/3 11:15, Tiezhu Yang ะด??: > In loongson3_type3_play_dead(), in order to make sure the PC address is > correct, use lw to read the low 32 bits first, if the result is not zero, > then use ld to read the whole 64 bits, otherwise there maybe exists atomic > problem due to write high 32 bits first and then low 32 bits, like this: > > high 32 bits (write done) > -- only read high 32-bits which is wrong > low 32 bits (not yet write done) > > This problem is especially for Loongson 3A4000+ CPU due to using Mail_Send > register which can only send 32 bits data one time. Although it is hard to > reproduce, we can do something at the software level to avoid the risks for > 3A4000+ CPU, this change has no influence on the other Loongson CPUs. > > Signed-off-by: Lu Zeng > Signed-off-by: Jun Yi > Signed-off-by: Tiezhu Yang Hi Tiezhu, Sorry that I didn't look this patch carefully in previous rev, here's my comments, Firstly the commit message and code comment looks bogus... I'd prefer --- MIPS: Loongson64: SMP: Fix up play_dead jump indicator In play_dead function, the whole 64-bit PC mailbox was used as a indicator to determine if the master core had written boot jump information. However, after we introduced CSR mailsend, the 64-bit PC mailbox won't be written atomicly. Thus we have to use the lower 32-bit, which will be written at the last, as the jump indicator instead. -- Thanks. > --- > > v2: No changes > > arch/mips/loongson64/smp.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/mips/loongson64/smp.c b/arch/mips/loongson64/smp.c > index 736e98d..e32b46e 100644 > --- a/arch/mips/loongson64/smp.c > +++ b/arch/mips/loongson64/smp.c > @@ -764,9 +764,10 @@ static void loongson3_type3_play_dead(int *state_addr) > "1: li %[count], 0x100 \n" /* wait for init loop */ > "2: bnez %[count], 2b \n" /* limit mailbox access */ > " addiu %[count], -1 \n" > - " ld %[initfunc], 0x20(%[base]) \n" /* get PC via mailbox */ > + " lw %[initfunc], 0x20(%[base]) \n" /* get PC (low 32 bits) via mailbox */ Here you can comment as "Check jump indicator (lower 32-bit of PC mailbox)" Thanks. - Jiaxun > " beqz %[initfunc], 1b \n" > " nop \n" > + " ld %[initfunc], 0x20(%[base]) \n" /* get PC (whole 64 bits) via mailbox */ > " ld $sp, 0x28(%[base]) \n" /* get SP via mailbox */ > " ld $gp, 0x30(%[base]) \n" /* get GP via mailbox */ > " ld $a1, 0x38(%[base]) \n"