Received: by 2002:ab2:4a89:0:b0:1f4:a8b6:6e69 with SMTP id w9csp204709lqj; Wed, 10 Apr 2024 08:10:47 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUzqFXhSH9IHFkXiO2X/shYcaoBLoNCujniNc4H+URGDCAaCvEXWEZN8m7aHeRzLZi0DdEfwsBkcG1wMj2N/t8xQhSHrgJQBqeTm2jZ/w== X-Google-Smtp-Source: AGHT+IGUVLpxUKYMZS3g3ujMjkWxEa+LYnz8ibPGYYnatyFHD3LUr8DSwn0kr3aCjnsoCqPou5iP X-Received: by 2002:a17:90a:c001:b0:2a2:bc8c:d677 with SMTP id p1-20020a17090ac00100b002a2bc8cd677mr3474424pjt.26.1712761847083; Wed, 10 Apr 2024 08:10:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712761847; cv=pass; d=google.com; s=arc-20160816; b=mk6ZyZJ53zxaMU1Yjuf25yYFfKLLZO4t3umnuH2RKixfKv84WtPLXBmmBNLEOXCFJk zb17EnwIt/eDuHXPcpsp2uP63KmGKeKJEFRtGAgubRpVSR/50HSqBB9AhABkzMRwoMp7 UM4YuVQd0qZ1Q7SnMGgB3APPhAWJycXB40VPjqKui2AT+MW1XoDglVQH5noRxga6nVg2 aUAN8Cm1iRXanC/ZUOZooxgnDAkk4UKdDVnam/MgIdK9IczrFhpgJxYYhSjlPXoNfRyi Qyck3GmDr752q8eMLNQ0wZtrFDP+o1lfQNu7SCxxYwxccIEW3e9Os/LUvzoRRvyCUD++ 5CtQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=ZyVI4S/6V9lqG/ncU7ONC3vJ9GHZTNGLMVonuj1Kkqk=; fh=gvf1ATPIvpKCn+5c6F1rYd/FBFjLnHc2kw+q413RM48=; b=OrgAesozgb7PwQQaNkCJon8+7kGexoy6ptYmvkCN0VdPZcKn0iK/H1/c3InET7tgwl e0rCnKQ3B7Vh9RMhH3wkJtEXlRxVoWPwt0Zarxe6+Rov+00Bwdgk70rt2rntNqHQgR3M D2+vRiZX170TD7x5gVuFsGBH8hA2fkmsGFGhP3J4X2Bu6v/T/9ESTi8Igk1+Hq/02b0G N9KMeaqZzyZZDb96kg6+5lfaPP+h04OHzlfihAbmDclogv1+HzYXzHqc2QYjKdbx1iQY +hsBjc4J/nqxeCxZQ3+r/dQzeWrYlHuIeGmZ7EhaVMoKslx7VvFPowz+IMV/ps+O0X1x baEg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=akrC5UaS; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-138848-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-138848-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id a15-20020a17090a8c0f00b002a4ed388b28si1715607pjo.82.2024.04.10.08.10.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 08:10:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-138848-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=akrC5UaS; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-138848-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-138848-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id BC70F287B45 for ; Wed, 10 Apr 2024 15:10:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3148E16EC11; Wed, 10 Apr 2024 15:10:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="akrC5UaS" Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 22BE913A414; Wed, 10 Apr 2024 15:10:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712761824; cv=none; b=plPqRN+rquDp3s/16eUhzu6kAtmf6cFENOWtEG55UqvvKRGxcxt09H8Ie889LSobCzto53TPW7GG2eMdky9PBgjv6339EI4vGuHxSYZbDKtnxh6mjG5JMek/U6MMAq4o4Q9d0EMP0eSZ6eIq6LRRKGHAlA8+rEdqPD06EwmozBc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712761824; c=relaxed/simple; bh=S7n/4OMF3r3r+CIQ4lMdfHayQi2rOVSuNXS4lAQaCOU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=bfQc9of2wXXIH5JmvKJXVVWz0fn3AZk5/JDAb5zoVKd9JJHAYKaty94Q27CddRliSnKWGvlwpPJrhlNXmmymalpOK14YqNH4DmS2OssHPrQ4Ekesp5hEubfgVLjWwDOnU6hPlcI0aVDXktigs+OVPIZ7HakFDcA7Bo7qg09xmYQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=akrC5UaS; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Received: from pps.filterd (m0353723.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 43AEQsTk009603; Wed, 10 Apr 2024 15:09:56 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=ZyVI4S/6V9lqG/ncU7ONC3vJ9GHZTNGLMVonuj1Kkqk=; b=akrC5UaSvD7pvYo9Q96Oawc+mhrhf5lxfNLDoyoJM6hm8Q2SFzIiU5rBhQcxlcxwuMkB b7O3dA2JyRtSOi26Bxk9GGynUEiluT36GKp+WKGe0hzWrmJGRZAqv/VklJ2OPMFdtO2A fMGDEFzYkuoPx3XwBqhLcydrdWqUTgNsAbYQRXt8ODvoDWWj8CN2HWudddVYKoepqR30 qCIK/Oym/+T3ObptymdHAX2bSzDBkBiy0JDEnCDLqrneEOwy15Kq9PNUZEkTDnBcmxOK +4wrWk3b9JS2vidAr/BtO+Jk7RxMexNYZYvw7k3x9GzrWCP1aFXsm6R8ZsK7u3NZMk6D EA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3xdu3vrbup-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 10 Apr 2024 15:09:56 +0000 Received: from m0353723.ppops.net (m0353723.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 43AF9tht014887; Wed, 10 Apr 2024 15:09:55 GMT Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3xdu3vrbuj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 10 Apr 2024 15:09:55 +0000 Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 43AEqSEl021501; Wed, 10 Apr 2024 15:09:55 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 3xbjxkw5wv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 10 Apr 2024 15:09:54 +0000 Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 43AF9nKl42140098 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 10 Apr 2024 15:09:51 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1C7FC2004E; Wed, 10 Apr 2024 15:09:49 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0A17D20049; Wed, 10 Apr 2024 15:09:49 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTPS; Wed, 10 Apr 2024 15:09:48 +0000 (GMT) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 55669) id CE6CBE0656; Wed, 10 Apr 2024 17:09:48 +0200 (CEST) From: Alexander Gordeev To: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Arnd Bergmann Cc: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arch@vger.kernel.org, Nicholas Piggin , Michael Ellerman , Frederic Weisbecker , Heiko Carstens , Vasily Gorbik Subject: [PATCH v2 RESEND 2/5] sched/vtime: get rid of generic vtime_task_switch() implementation Date: Wed, 10 Apr 2024 17:09:45 +0200 Message-Id: <2cb6e3caada93623f6d4f78ad938ac6cd0e2fda8.1712760275.git.agordeev@linux.ibm.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: HAdgwWQD4FonvjPJuQYBlHeamsdoj4hL X-Proofpoint-GUID: JBNR68RfNJ8wFUKijt5vMU8uoUyWK4lQ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-10_04,2024-04-09_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 adultscore=0 impostorscore=0 priorityscore=1501 mlxlogscore=721 malwarescore=0 bulkscore=0 mlxscore=0 phishscore=0 lowpriorityscore=0 clxscore=1015 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2404010000 definitions=main-2404100109 The generic vtime_task_switch() implementation gets built only if __ARCH_HAS_VTIME_TASK_SWITCH is not defined, but requires an architecture to implement arch_vtime_task_switch() callback at the same time, which is confusing. Further, arch_vtime_task_switch() is implemented for 32-bit PowerPC architecture only and vtime_task_switch() generic variant is rather superfluous. Simplify the whole vtime_task_switch() wiring by moving the existing generic implementation to PowerPC. Reviewed-by: Frederic Weisbecker Reviewed-by: Nicholas Piggin Acked-by: Michael Ellerman Signed-off-by: Alexander Gordeev --- arch/powerpc/include/asm/cputime.h | 13 ------------- arch/powerpc/kernel/time.c | 22 ++++++++++++++++++++++ kernel/sched/cputime.c | 13 ------------- 3 files changed, 22 insertions(+), 26 deletions(-) diff --git a/arch/powerpc/include/asm/cputime.h b/arch/powerpc/include/asm/cputime.h index 4961fb38e438..aff858ca99c0 100644 --- a/arch/powerpc/include/asm/cputime.h +++ b/arch/powerpc/include/asm/cputime.h @@ -32,23 +32,10 @@ #ifdef CONFIG_PPC64 #define get_accounting(tsk) (&get_paca()->accounting) #define raw_get_accounting(tsk) (&local_paca->accounting) -static inline void arch_vtime_task_switch(struct task_struct *tsk) { } #else #define get_accounting(tsk) (&task_thread_info(tsk)->accounting) #define raw_get_accounting(tsk) get_accounting(tsk) -/* - * Called from the context switch with interrupts disabled, to charge all - * accumulated times to the current process, and to prepare accounting on - * the next process. - */ -static inline void arch_vtime_task_switch(struct task_struct *prev) -{ - struct cpu_accounting_data *acct = get_accounting(current); - struct cpu_accounting_data *acct0 = get_accounting(prev); - - acct->starttime = acct0->starttime; -} #endif /* diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c index df20cf201f74..c0fdc6d94fee 100644 --- a/arch/powerpc/kernel/time.c +++ b/arch/powerpc/kernel/time.c @@ -354,6 +354,28 @@ void vtime_flush(struct task_struct *tsk) acct->hardirq_time = 0; acct->softirq_time = 0; } + +/* + * Called from the context switch with interrupts disabled, to charge all + * accumulated times to the current process, and to prepare accounting on + * the next process. + */ +void vtime_task_switch(struct task_struct *prev) +{ + if (is_idle_task(prev)) + vtime_account_idle(prev); + else + vtime_account_kernel(prev); + + vtime_flush(prev); + + if (!IS_ENABLED(CONFIG_PPC64)) { + struct cpu_accounting_data *acct = get_accounting(current); + struct cpu_accounting_data *acct0 = get_accounting(prev); + + acct->starttime = acct0->starttime; + } +} #endif /* CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */ void __no_kcsan __delay(unsigned long loops) diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c index af7952f12e6c..aa48b2ec879d 100644 --- a/kernel/sched/cputime.c +++ b/kernel/sched/cputime.c @@ -424,19 +424,6 @@ static inline void irqtime_account_process_tick(struct task_struct *p, int user_ */ #ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE -# ifndef __ARCH_HAS_VTIME_TASK_SWITCH -void vtime_task_switch(struct task_struct *prev) -{ - if (is_idle_task(prev)) - vtime_account_idle(prev); - else - vtime_account_kernel(prev); - - vtime_flush(prev); - arch_vtime_task_switch(prev); -} -# endif - void vtime_account_irq(struct task_struct *tsk, unsigned int offset) { unsigned int pc = irq_count() - offset; -- 2.40.1