Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp63453imj; Fri, 8 Feb 2019 15:03:18 -0800 (PST) X-Google-Smtp-Source: AHgI3IYHiSVnvuNsI1V5lqbuWjQrRGtKXdxaLjPHl+9qQpMsRHFXMUQuPOINQzPR3MjcXrF7fw/G X-Received: by 2002:aa7:808a:: with SMTP id v10mr12648366pff.8.1549666997976; Fri, 08 Feb 2019 15:03:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549666997; cv=none; d=google.com; s=arc-20160816; b=NemCSckykbOoQEVwkwyaYdabn80HACAwAOFdzaKkNcsZao7yQjBI1nFe4GjpGi4IiZ PIlEFEYGb7yB0JZCBP4q3m4ilYM7mtJKEJJQuSDv2HV41T+duJvVl75T/8ximwxNcMSI 8Cf/v8JM/nXh+AUidmKJeBDKEU96vSSP3Rnir3Sm7jtvvB00CrYxtEWssSmrWNdz7Eru ZJRT9Lfd+OmJ6u9EpO4rVJbQdkfiVFOgryOmYt0cew+ZeBWNFnjwNDmikqeNdE/ergLw qJp7U5OmAXpNaFVTr1xd6BDV0Yq0oOIgzHAqniIF0GThMsWbYUJBLSvCCZWP5S9vAevw Bh1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=BZMm4y7ikdTCPYOE2W8z+xqzgTNeKKVn22IhtfW4R2I=; b=yPPv7RB17gdlDAT4WWfWZ3BLy9MHNKFkD7N6L8sbMwGwA3AbSHBbY6qFwC1JbJ0Hkp Ndb0wCzPTJgb4A30FWkQNRQdrrOPiLIN2UzfK3OcOeJvbxxWgqg0OrP588NCyB90jkck /Uzhdki+vhK88Kc+gz9P3BQt4NNHsWXjT/CW8W163JdNmp54vr4l6IkOUV15zP3GsuJK kk0lInVqB+Gvhz+Hh9UMQ3vMuCjT6ZCUPgxdBMAX1AfTWcsW4zmx7KACGPJKJMoU4pK1 ktwInMf0Gm1nuw7k4BQU119OJuulLRb5hZH44gImivbf4Luzd6pZ/kk1B4dATaeLb6iw dkRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b="hdot/TzR"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=wdc.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p3si3153897plr.376.2019.02.08.15.02.59; Fri, 08 Feb 2019 15:03:17 -0800 (PST) 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=fail header.i=@wdc.com header.s=dkim.wdc.com header.b="hdot/TzR"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=wdc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726864AbfBHXCy (ORCPT + 99 others); Fri, 8 Feb 2019 18:02:54 -0500 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:8199 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726020AbfBHXCy (ORCPT ); Fri, 8 Feb 2019 18:02:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1549666974; x=1581202974; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=HJS0dqTZ8pL/wWqfL161CgRt5Xxy3W9rZvtNpfXa3YI=; b=hdot/TzRe4GrwFRnljYtM2k9vy77Fh7Bz0cM9dIOxd2vXiFS8m50QZy/ OBdNQ+56ABkvZhnQyShVUhpDWoiWFRiTeaIn6PNjYI9aq8p4NQ3UnNZJR 0qFo8Wihy9HQu9OcMkYBHv9q0UjWMi0F2ALFvOAhU7d1XLv5SxMRxbXgh 2SArTiYiIm24CaKl35aq7WTXz3WAXp3nkwlWPRV5eyGpGt0CgSMiBioVu haC7mqyIBY77vLtcNylfHL+8eguhqfnVLOcdDY80NWeY3Z/RoJycpQNsS b4feV8JJApHcyGlUr/h1ofKxFMqN5dq6UI9mG6FFibt936l3MFQBuEm/S w==; X-IronPort-AV: E=Sophos;i="5.56,564,1539619200"; d="scan'208";a="102116688" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 09 Feb 2019 07:02:53 +0800 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP; 08 Feb 2019 14:41:35 -0800 Received: from usa003289.ad.shared (HELO [10.86.59.147]) ([10.86.59.147]) by uls-op-cesaip01.wdc.com with ESMTP; 08 Feb 2019 15:02:52 -0800 Subject: Re: [v3 PATCH 8/8] RISC-V: Assign hwcap only according to boot cpu. To: Christoph Hellwig Cc: "linux-riscv@lists.infradead.org" , =?UTF-8?Q?Patrick_St=c3=a4hlin?= , Albert Ou , Damien Le Moal , Jason Cooper , Alan Kao , Dmitriy Cherkasov , Anup Patel , Daniel Lezcano , "linux-kernel@vger.kernel.org" , Zong Li , Palmer Dabbelt , Paul Walmsley , Andreas Schwab , Marc Zyngier , Thomas Gleixner References: <1549590681-24125-1-git-send-email-atish.patra@wdc.com> <1549590681-24125-9-git-send-email-atish.patra@wdc.com> <20190208091133.GD16932@infradead.org> From: Atish Patra Message-ID: <8f5fd0c8-0320-00b1-4ddf-b1225be352c8@wdc.com> Date: Fri, 8 Feb 2019 15:02:52 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 MIME-Version: 1.0 In-Reply-To: <20190208091133.GD16932@infradead.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/8/19 1:11 AM, Christoph Hellwig wrote: >> + * We don't support running Linux on hertergenous ISA systems. >> + * But first "okay" processor might not be the boot cpu. >> + * Check the ISA of boot cpu. > > Please use up your available 80 characters per line in comments. > I will fix it. >> + /* >> + * All "okay" hart should have same isa. We don't know how to >> + * handle if they don't. Throw a warning for now. >> + */ >> + if (elf_hwcap && temp_hwcap != elf_hwcap) >> + pr_warn("isa mismatch: 0x%lx != 0x%lx\n", >> + elf_hwcap, temp_hwcap); >> + >> + if (hartid == boot_cpu_hartid) >> + boot_hwcap = temp_hwcap; >> + elf_hwcap = temp_hwcap; > > So we always set elf_hwcap to the capabilities of the previous cpu. > >> + temp_hwcap = 0; > > I think tmp_hwcap should be declared and initialized inside the outer loop > instead having to manually reset it like this. > >> + } >> >> + elf_hwcap = boot_hwcap; > > And then reset it here to the boot cpu. > > Shoudn't we only report the features supported by all cores? Otherwise > we'll still have problems if the boot cpu supports a feature, but not > others. > Hmm. The other side of the argument is boot cpu does have a feature that is not supported by other hart that didn't even boot. The user space may execute something based on boot cpu capability but that won't be enabled. At least, in this way we know that we are compatible completely with boot cpu capabilities. Thoughts ? Regards, Atish > Something like: > > for () { > unsigned long this_hwcap = 0; > > for (i = 0; i < strlen(isa); i++) > this_hwcap |= isa2hwcap[(unsigned char)(isa[i])]; > > if (elf_hwcap) > elf_hwcap &= this_hwcap; > else > elf_hwcap = this_hwcap; > } > >