Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1689213imm; Tue, 2 Oct 2018 12:15:51 -0700 (PDT) X-Google-Smtp-Source: ACcGV636BuZqOeVIFLe8z8Jl9Irq59eTw3GibdgMIGqvxPD3T8MceHzetXEn/SToUIY3k/F/lZjr X-Received: by 2002:a63:9c3:: with SMTP id 186-v6mr15872547pgj.249.1538507751705; Tue, 02 Oct 2018 12:15:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538507751; cv=none; d=google.com; s=arc-20160816; b=CTmhab9LP5T7hhbRKjWBrpbX+wmsYKMprN+yYvBLCP7foZ8BtV0qeuOhvyoYXvLz4P dLcZzPFugUb/yfcSIa9t2bVhnkv3PBIIxbSSpITl8kww4OaHfTm5N1vyPTHV8cATt+Fj X3NxaeW9WzVVrMnWG784xTkbS6DCOMVaKVb633uboCZLAjJ/F6ALVGXhx1A7mIheCRwD dHTiCessRqXEMhFFzX/VlyUWvCzWpVIhkshyZNPZ8THEkTLUVPsllTTcmH6PZHEWSI+x 4DhnGvmHCZaOfjRgeoJuFXPlBdZ9dJX/h3YzamOkzkTYVwDv7RpPPLEXBRvRy6eZ5HBk spWA== 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=iz3qKMCf22QUknUQzZWbm0Yjyyl6Fz35BtSpMC9zNMf0eruoha/p8Z/9zMxK4wjzWR H+BRqfqvRkmyB95sBmMDTa7VUFuwqLN3tYa+vPRGA5BAL5WIfqRrkie0+aJBHhhRAmc0 j4TN0ty23BJlIE0AaobEpRrne9jYWflurEmQWobohlD/066eIERceSyRXMB+1D3xw1cG A0GleAu/EslF8+L9MuKK3uat6LtLmaOuVXFu8nVVxpauOMu4xVdPCfkFPd+dde091k/J olrnl+l3iEW9vmDFRQhV1yimhg4k8IEx4E8baAk41N/zlNV05GDgMoOBRqpEq9ExNnkA 4V6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=cqpMXrNS; 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 t62-v6si16706922pfd.133.2018.10.02.12.15.36; Tue, 02 Oct 2018 12:15:51 -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=cqpMXrNS; 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 S1728192AbeJCCAG (ORCPT + 99 others); Tue, 2 Oct 2018 22:00:06 -0400 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:61576 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727815AbeJCCAC (ORCPT ); Tue, 2 Oct 2018 22:00:02 -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=1538507710; x=1570043710; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=5UY8xd2FdutBGQW8j3QnEHVqwWgY8eh8L1BzJ5gicx8=; b=cqpMXrNSH0N4zJVqIvT4VzZutj/ab6OBuG2nOIBplFt0aRPYgORraeLi +Mw6iSpn1LGM9PXz0emEuTCmqRCRHMPnQ/GZsThMFJMYO5rerY1peLPsY iV7hZAInGlNUs+oJtOKR48Gii6Pp1s3HZupYwZWO/5ed77WOLeq0alXG5 k0XAxlgCVWAw2R17cw1sACcfpbUxpB2qbOx31ntQ3BqnH5TpbyGtRVwcJ ixbkYpLH0lGvbhHCae3UA8D91xeyCWX/1n1dV2qUxmYnMbIFc0Me/Y1qo x9Np+8QTDO6SbNjFwcX7dXNSNu3yrQfVtXeGOJcWxc5O7QAkE3A6hGijf A==; X-IronPort-AV: E=Sophos;i="5.54,332,1534780800"; d="scan'208";a="91076741" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 03 Oct 2018 03:15:09 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP; 02 Oct 2018 12:00:50 -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; 02 Oct 2018 12:15:10 -0700 From: Atish Patra To: linux-riscv@lists.infradead.org, palmer@sifive.com Cc: anup@brainfault.org, hch@infradead.org, linux-kernel@vger.kernel.org, atish.patra@wdc.com Subject: [PATCH v6 06/14] RISC-V: Provide a cleaner raw_smp_processor_id() Date: Tue, 2 Oct 2018 12:14:59 -0700 Message-Id: <1538507707-22299-7-git-send-email-atish.patra@wdc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1538507707-22299-1-git-send-email-atish.patra@wdc.com> References: <1538507707-22299-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