Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp4514362imm; Tue, 11 Sep 2018 13:07:43 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdavre5c2teGSoe0zqWtAD2tIZ8mBaMFBdnyZBF6jzQ2UezRjh5+RuYWfdQI+Bo4BHU96RHt X-Received: by 2002:a17:902:7803:: with SMTP id p3-v6mr28817433pll.119.1536696463578; Tue, 11 Sep 2018 13:07:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536696463; cv=none; d=google.com; s=arc-20160816; b=R/lhzCaGi6QaZdeY4GfQMqZzq8f3/NMLM6ojnbIJRIbI38hRcG0wkAHlgSET5W6jEo nK1OMN9rN9j+oI4CKJDUYxrz7nlMi3szSBCqHFI+DChiN72HHWeR38wc/W68sLSKBt0x LFK2JjnLY6AZucbhUpcUffwv7cAI/bIGR02tjTZyBXiiCrAhYTwknDfsYk+Ci8DC6pdc C2NpdWqYiAgp0f33F7oH0FGWJ8mz6vCj4kj7mfS+GY05jLxl9fg1kJrZU69XtN1ljJg0 m6GGvSpk4mRk04bGHf4Qi2sNC4fWtObChNMCdnQxFrJxIg+w35RDBtN9eW7gHgsOtZr+ UF5w== 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=doho2g0/kq77Npzb3IAnHMB3IqFgGfcFB9k60QiOZjrsBPux3n+lVjokVcs4pmvqLc DOcFL8lJchpXGCgWR4LTMBv5VYDNwb9qFGapS61jW9CPrFCC+Zba/mDVQsdVIu9AAeLW 16VLPa2XgAE6j9lImIElVAwjcOuleUIa1WfUt5CBsrTVAUSdDO39xY/11sH3gMg2avXw CecElQd7vnDXi3hrbUfNjg8RYls4LszObi2BvBivYa7SVQEJ33Gz2kIzTN5Gw2PL+WfK piQVC45d6aq6TaZapFSkm4+OznEMasQ34pScxL5oLMrlDbwC8Tv9xKJ7qkJ4OwWPENcK rGsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=LXT7GgMK; 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 j8-v6si18532699pll.493.2018.09.11.13.07.26; Tue, 11 Sep 2018 13:07:43 -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=LXT7GgMK; 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 S1728273AbeILBHc (ORCPT + 99 others); Tue, 11 Sep 2018 21:07:32 -0400 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:52878 "EHLO esa1.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727804AbeILBGf (ORCPT ); Tue, 11 Sep 2018 21:06:35 -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=1536696343; x=1568232343; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=5UY8xd2FdutBGQW8j3QnEHVqwWgY8eh8L1BzJ5gicx8=; b=LXT7GgMKXjjL1ZJLZMEuLaF+xu2TJ8ybR/s2W7dRzvrSWRhajDq0NSQD eMjJUzoLDnvBNhec44m+H4PFcup/54opIcej0Uv8Z0DVAv9rHlJ5MMCoQ hn7L/lQkmFamgAcBZP+axhQemugJN9zDaSVNM72kwExgAQUjfjgJMvG6v 8dEcLIv1BkgKoUuow2cxIcqZpFlAxH+M0+5iP8G8hJh7SUjBVY9WjOY4a pJC2nickVyLmIti5UOags0bObcDzXM2ti4EDIzl3nVc36OgK5miCnlGBW njPnrZVYWClZ5mnANtuwhAK6RzpBCNU4Xzaqz9H9aNfRrIdouoKjhGok+ w==; X-IronPort-AV: E=Sophos;i="5.53,361,1531756800"; d="scan'208";a="193728831" 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; 12 Sep 2018 04:05:42 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP; 11 Sep 2018 12:52:16 -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; 11 Sep 2018 13:05:42 -0700 From: Atish Patra To: palmer@sifive.com, linux-riscv@lists.infradead.org Cc: mark.rutland@arm.com, hch@infradead.org, anup@brainfault.org, 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 v4 06/12] RISC-V: Provide a cleaner raw_smp_processor_id() Date: Tue, 11 Sep 2018 13:05:33 -0700 Message-Id: <1536696339-15204-7-git-send-email-atish.patra@wdc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1536696339-15204-1-git-send-email-atish.patra@wdc.com> References: <1536696339-15204-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