Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3039081imj; Mon, 11 Feb 2019 12:45:26 -0800 (PST) X-Google-Smtp-Source: AHgI3IZ5JGYizpdIrlaE6RMkNPQU4J+bMpACq4uBhWA44SPih+Mh9hth5Ij7cLphITA+4D66+ksR X-Received: by 2002:a62:964d:: with SMTP id c74mr98241pfe.213.1549917926560; Mon, 11 Feb 2019 12:45:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549917926; cv=none; d=google.com; s=arc-20160816; b=cfCPUcshZmUpBduOWCiyFMbkxkcyq6jP2/f1tv7ebWCqBNw6gFYB0NOYvXyRNi2tr2 ohNqdbbFHxvZm9y1YW9Is/1Z9e1EOzIfBl2IbgWaH4Axxn+sTljMHejmmIcqgkR1oj9r g2iSAGhlEutgBqhsFzBmiDEVkejrpB0Elc8+mDMzB4RjrmU9baNQkJFLP5cXXTfYwI4T RJ1vOxpcTUr+3DXp0XHCvGJnbjViXsc5mC39BkZkEn0iNONGMsUrjgz9/cjRwCulY+Od Oopmu5x528x5hJDH5yllmajAf/nQzHmvrDtnCOGfltVPtkkfGTLx+2ivf1OdWaEyGmtE pmRg== 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=inYHiKqyP6DXthKjuQgPAJKgzgk5EdisN+BZSNJ37Is=; b=YRVQkP8tm9mMAZAKS/GIJfcdhiZDKReta1qWqv/7T1FnQe9LCtdC82I8fdoYEhCmLX P1qOAQ6RfXPo+XAflYE/STP36VV2Ud6XLw1zzMix/Bi+XCd6FUteRXlBg4UemtDOAQN4 63ZetoA36zNKizcifcatJxi/R6nU1DwjY8+HAqvqAcKQljQjkfTSV5rRz5u9NRHM5KqD UNQZYD3VG+VqKxf+agk3RxEOu0+ueUwp+YconYSZ6TMden3CbiR30dBkcaOv6PCowZ0G ZD5bMvqIy/ptcuzxOuDjWxXUwl3h1vHaxHLzKBwEUfKcCKms2dM2/RQlSAnwizTQujiV Rhdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=S3sQAZXA; 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 128si567795pgb.373.2019.02.11.12.45.10; Mon, 11 Feb 2019 12:45:26 -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=S3sQAZXA; 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 S2387603AbfBKUDd (ORCPT + 99 others); Mon, 11 Feb 2019 15:03:33 -0500 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:28720 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728086AbfBKUDc (ORCPT ); Mon, 11 Feb 2019 15:03:32 -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=1549915413; x=1581451413; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=dgMKljKrDeD8eESyLJyIVqLOrHbFP/IE6E7imTUziVA=; b=S3sQAZXAvVGu1iJM4UVlPd6yT0zB8rBc45SCFZh+9gr06JcR1jrcpALS 1n5n0mEego5tib66l9fiFmFNxyra2Nk3HY2R3q1P3uiNLm43AmtDQ4Q+P xsoKGcFw5nmm9o21TguE6BnCq5cnYaDE9KThKpNq05QfFV2PNSE91zj+1 S+Xt+PiKZrNBtNrrivF6i5aTjE8DR3KPnQ/K8msxhH6iRj6E/frPUdKbv MDk3OVAzGOOVe21K/pUzP7AuYG5Ud1IYjCbfFO1a6e1w4IBTAh3kIp9G+ eg6R6Ud3t4lNGyjqetk7eDZDG9yE2bIjAy5D/jjdhAH9fXHIT4GPDWUWK w==; X-IronPort-AV: E=Sophos;i="5.58,360,1544457600"; d="scan'208";a="199141389" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 12 Feb 2019 04:03:33 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 11 Feb 2019 11:44:09 -0800 Received: from cnf000690.ad.shared (HELO [10.86.62.97]) ([10.86.62.97]) by uls-op-cesaip02.wdc.com with ESMTP; 11 Feb 2019 12:03:32 -0800 Subject: Re: [v3 PATCH 8/8] RISC-V: Assign hwcap only according to boot cpu. To: Palmer Dabbelt , "david.abdurachmanov@gmail.com" Cc: Christoph Hellwig , Damien Le Moal , "aou@eecs.berkeley.edu" , "jason@lakedaemon.net" , "alankao@andestech.com" , "dmitriy@oss-tech.org" , "anup@brainfault.org" , "daniel.lezcano@linaro.org" , "me@packi.ch" , "linux-kernel@vger.kernel.org" , "marc.zyngier@arm.com" , Paul Walmsley , "schwab@suse.de" , "linux-riscv@lists.infradead.org" , "tglx@linutronix.de" , "zongbox@gmail.com" References: From: Atish Patra Message-ID: <83562b9d-e94b-76ce-7240-aac1dce43205@wdc.com> Date: Mon, 11 Feb 2019 12:03:30 -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: 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/11/19 11:02 AM, Palmer Dabbelt wrote: > On Fri, 08 Feb 2019 20:26:07 PST (-0800), david.abdurachmanov@gmail.com wrote: >> On Sat, Feb 9, 2019 at 12:03 AM Atish Patra wrote: >>> >>> 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 ? >> >> There is one example on the market, e.g., Samsung Exynos 9810. >> >> Mongoose 3 (big cores) only support ARMv8.0, while Cortex-A55 >> (little ones) support ARMv8.2 (and that brings atomics support). >> I think, it's the only ARM SOC that supports different ISA extensions >> between cores on the same package. >> >> Kernel scheduler doesn't know that big cores are missing atomics >> support or that applications needs it and moves the thread >> resulting in illegal instruction. >> >> E.g., see Golang issue: https://github.com/golang/go/issues/28431 >> >> I also recall Jon Masters (Computer Architect at Red Hat) advocating >> against having cores with mismatched capabilities on the server market. >> >> It just causes more problems down the line. > > IMO the best bet is to only put extensions in HWCAP that are supported by all > the harts that userspace will be scheduled on. > Fair enough. Instead of setting HWCAP in setup_arch() once, we can set it only for boot cpu. It will be updated after every cpu comes up online. Thus, HWCAP will consists all extensions supported by all cpus that are online currently. Regards, Atish