Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1038395imm; Thu, 13 Sep 2018 11:38:28 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdag8o8DCRbvNwAk2/suj7jQCEJXzvct+IkFHkGFFxIbK3UkldIP3lVrGIQZtmhtNd9EKk3Z X-Received: by 2002:a63:d244:: with SMTP id t4-v6mr8113340pgi.335.1536863908385; Thu, 13 Sep 2018 11:38:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536863908; cv=none; d=google.com; s=arc-20160816; b=wWR8pp4XTrBmzqTuP41K8YGqmGZyl4du0OL3a7vzZz7TPRsxkE0NJB88A0Z1C1gDbv GclO2PHLm0JZyE7VAFG0IIAvWmyyxsuPoGKVd1GXhhNaf0hpsbEb3UStN8to0MOQ85wy 2eVrJimTK4edGOpSYuhn27JZFDNTCSSApKTLJ5yg80pZkIdHZJZy/IltS/yx/HMQzxwJ vWmcA8yb4XPgW/o9+RTgfKcvhxdUiXmRKL/O6QCgu6ntEQKOktLV/E9MFhP6HG8Laahf SuYhVuADC7hK3LwOT1f6GvwSkrrdrNHnzbP4W53jWURRuKwh7oWBiJTIHhQ/4TijGY4B Rzhg== 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=9ktt1NxLDb/hGSgNO6NtwgIlIdQaRyxENzGGNArQWRI=; b=Q6SXY9eZ61Dl7Cak1v1KzwIMeE7rDItLru+/L+JXZqLnqTJivAJkvcu06Ri8WuE/lF NcVg+B9v9aAa8PLo/9YkZfGSjJ67pUVDdsBI/EYQxpC4l3PEWJXYJa531ECLN5PqOvu7 lR+woiEEjkGzTgJGboK4AQt7eXl/e2T0s9ZxT8jgNvr1XKW68v4LJq+drKk+Jf0nyazQ AMFtoibU3k4Sc7/XyYkVSr6Tl61edMW3czY2S8AfJF4BBlVE+tRy78KaoXlvxyYmiGWm hYHlyy+DjzIKJUQW5XiRZOhSenOxFE8Olp/7BI4/hXmVwanZUxaYkGgYex9GBnbgCD3k JYLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b="q8W/faT4"; 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 n8-v6si4696061pfh.210.2018.09.13.11.38.13; Thu, 13 Sep 2018 11:38:28 -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="q8W/faT4"; 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 S1728326AbeIMXs3 (ORCPT + 99 others); Thu, 13 Sep 2018 19:48:29 -0400 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:26981 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728168AbeIMXru (ORCPT ); Thu, 13 Sep 2018 19:47: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=1536863829; x=1568399829; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=5UY8xd2FdutBGQW8j3QnEHVqwWgY8eh8L1BzJ5gicx8=; b=q8W/faT4rvCEC4AMATz5+O5JSg23qFTM/zH/slKWrwLQnvdjPOaOQjG5 9WvUmHc1ZG2mpxOwwwNpW/ymfJvJHUmcz1SGO3jhKtxN8MMQkERuxsZyU jRLpo5boc/3HydKTh5jau3sTSR2fYIOLp0nz8x+WlNhaDbTZ4y/oodVLd xvsHjuRWb9tkNpviguBVZCPWxAESdqYVEqTS8hnjuKg41t52xD3SdQhsC gJb5FRsPQXbsPFbW0ajI9kKXWmdal4UBvHzadCztE6A/g6r10fhZYJEIa ZRhr1mYUdJELyVghdlRoYrAB/KDANQGwjhvIxzeg0LzM/KZCQY49JNggd A==; X-IronPort-AV: E=Sophos;i="5.53,370,1531756800"; d="scan'208";a="89712019" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 14 Sep 2018 02:37:08 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP; 13 Sep 2018 11:23:39 -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; 13 Sep 2018 11:37:08 -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, schwab@linux-m68k.org Subject: [PATCH v5 06/12] RISC-V: Provide a cleaner raw_smp_processor_id() Date: Thu, 13 Sep 2018 11:36:59 -0700 Message-Id: <1536863825-66808-7-git-send-email-atish.patra@wdc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1536863825-66808-1-git-send-email-atish.patra@wdc.com> References: <1536863825-66808-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 Reviewed-by: Christoph Hellwig --- 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