Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp223836imm; Thu, 6 Sep 2018 01:08:53 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaFZyUnco2XmfmW1Fxp+x9tvCOxheLUA3KlVzwl3B5jEy4j8ABoDs5C/UzjPDemet55aTfJ X-Received: by 2002:a17:902:4a0c:: with SMTP id w12-v6mr1494751pld.289.1536221333634; Thu, 06 Sep 2018 01:08:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536221333; cv=none; d=google.com; s=arc-20160816; b=OCbrzSeDrn87PF2+My3btZhIUwzAAxwvw7tfBzPe3qStecXh6KoXGiNSwvqTH9gp81 sS8sNAYKyYL2aOx9Pgj3M0n5EO2mRtB/16qHD7NKhRVwOMUaK/MmBnbbVTAHY7JbZ7IT q+28G+CWwmsOER7yVHVx5Nw7h3jiY2ORGV+cxXUGStMGMwOpfEEGh36324zr+Z+TZ/Vh nNFfHl8FCejMwbDBhVnR0hiry7Clnm3y0Cp6Le3IOhmy8wBFFCYHWFmYVJmRk8+PW1xg Cbq5y98Xeu7K2o9eOPCKg3wlnb2RInqFn2ppNGWqe18T4R3fDKs/ztbWpQLgWg/vyUIY FzmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=ZcckQPqACtxkaVdTsPsov6eMt6Ovl2SJwVompMUg3Tc=; b=spKRQUyfwyw09YBoaaqL4FboJOL6SC+wGLogCP9F50eyX9NI+jNSg02eXPKNhPnS4E H0LwN/o4kNsEEwvO9xoEFVmBFhL4Z6d/ntmbsXIg6r1cPTcN7HM7u53A55A0wtfaSRT5 n6vFvOltZ9UtZCW1d44BArT4Mhb1f7a4RomtrSS9ET6OsaoQ1Zq17MJtEDohGZT4QTQ0 osziMajQ4dGqmoJqTjANZyr02BrbcNY/gThR/L1raMKZwgP2ZIvMp5D6WkCv27zJnS1e oCV8e7vtrGTzXRZDN0kh8NDTXEwQW6MXJxnrkkocrzt56Q4lIGONLKJQ7/Mq6KO8H4H8 N/kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=EtxI01tX; 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 z9-v6si4166323pln.462.2018.09.06.01.08.38; Thu, 06 Sep 2018 01:08:53 -0700 (PDT) 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=EtxI01tX; 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 S1728253AbeIFMkp (ORCPT + 99 others); Thu, 6 Sep 2018 08:40:45 -0400 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:53556 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728047AbeIFMju (ORCPT ); Thu, 6 Sep 2018 08:39:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1536221195; x=1567757195; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=Rgz6bxuvikFnobsyCOafergcB2Su5l9V6r+6XKdmfgA=; b=EtxI01tXJUNxVxD4bZ+eD9lvsR86Fo1moon954EwFrRqox25o5j5hHWj PFD4e4yxUvZ5n6dp54ov1pIq7JJNedrv20GKaO3ulyheqsOykGeBNYBWj VjOITxmGkSUWvxRryEEg8nAjdURd72p94NnTx9GWBsa1NCxyxleG823fU 8LcoljbqLRw83tHrVEx0kj1W17ErtvhkTXaU/r178W8ndIfI0jzMK4La2 6P+AHbB91JHvKesREVkH7O5e6omyGUVvxBNy8Hy482NacOpXy44OIj1qA Q36ap4bIMmo8uemQQVTKrpo0MfPOllbpHBkqcaXPwmIoIryC7inFjKsqR A==; X-IronPort-AV: E=Sophos;i="5.53,337,1531756800"; d="scan'208";a="186673948" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 06 Sep 2018 16:06:34 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 06 Sep 2018 00:52:13 -0700 Received: from jedi-01.sdcorp.global.sandisk.com (HELO jedi-01.int.fusionio.com) ([10.11.143.218]) by uls-op-cesaip02.wdc.com with ESMTP; 06 Sep 2018 01:05:37 -0700 From: Atish Patra To: palmer@sifive.com, linux-riscv@lists.infradead.org, hch@infradead.org, anup@brainfault.org Cc: mark.rutland@arm.com, atish.patra@wdc.com, tglx@linutronix.de, linux-kernel@vger.kernel.org, Damien.LeMoal@wdc.com, marc.zyngier@arm.com, jeremy.linton@arm.com, gregkh@linuxfoundation.org, jason@lakedaemon.net, catalin.marinas@arm.com, dmitriy@oss-tech.org, ard.biesheuvel@linaro.org Subject: [PATCH v3 05/12] RISC-V: Provide a cleaner raw_smp_processor_id() Date: Thu, 6 Sep 2018 01:05:28 -0700 Message-Id: <1536221135-182613-6-git-send-email-atish.patra@wdc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1536221135-182613-1-git-send-email-atish.patra@wdc.com> References: <1536221135-182613-1-git-send-email-atish.patra@wdc.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Palmer Dabbelt I'm not sure how I managed to miss this the first time, but this is much better. Signed-off-by: Palmer Dabbelt [Atish: code comment formatting and other fixes] Signed-off-by: Atish Patra --- arch/riscv/include/asm/smp.h | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/arch/riscv/include/asm/smp.h b/arch/riscv/include/asm/smp.h index 36016845..85d7619e 100644 --- a/arch/riscv/include/asm/smp.h +++ b/arch/riscv/include/asm/smp.h @@ -14,13 +14,9 @@ #ifndef _ASM_RISCV_SMP_H #define _ASM_RISCV_SMP_H -/* This both needs asm-offsets.h and is used when generating it. */ -#ifndef GENERATING_ASM_OFFSETS -#include -#endif - #include #include +#include #ifdef CONFIG_SMP @@ -34,12 +30,10 @@ void arch_send_call_function_ipi_mask(struct cpumask *mask); void arch_send_call_function_single_ipi(int cpu); /* - * This is particularly ugly: it appears we can't actually get the definition - * of task_struct here, but we need access to the CPU this task is running on. - * Instead of using C we're using asm-offsets.h to get the current processor - * ID. + * Obtains the hart ID of the currently executing task. This relies on + * THREAD_INFO_IN_TASK, but we define that unconditionally. */ -#define raw_smp_processor_id() (*((int*)((char*)get_current() + TASK_TI_CPU))) +#define raw_smp_processor_id() (current_thread_info()->cpu) #endif /* CONFIG_SMP */ -- 2.7.4