Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp376071rdb; Thu, 22 Feb 2024 06:34:59 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV1xuesxaotth8GjhL4fOvKSnPt8TxthdrycQMBgGAanHEaVrrTdwM5xwxAF46mnEt1MUYn4xJ5d3pzvWqWiQXv1PaKQW8NXcGIjM5IRQ== X-Google-Smtp-Source: AGHT+IEKzzQY6YS2p3LOfuQHr6Eg9fbphIfGqGx98f5zrW410SIw6waVkqwAeaVNEVfCDS4TBael X-Received: by 2002:a05:6359:4c13:b0:17b:5d17:fbc1 with SMTP id kj19-20020a0563594c1300b0017b5d17fbc1mr3698938rwc.2.1708612499420; Thu, 22 Feb 2024 06:34:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708612499; cv=pass; d=google.com; s=arc-20160816; b=MXG3hCRLt0xZGcJMq+fyG/wwrCF1PQH45JfxaMgvpAmzZPbEzSbK8Wdk4V2GMuhzDJ eFJWz/MA/LvEzINv8P2CFbe7UQLKolqvI7qgmOqWL9W8HdkjWpHwaoNeWmRL3B8daoin D88e5UbYu/QJ6wxEZKcC/0jCsCsSr3Ga/4374DowByABHjZ/xPlLJKVv1SpnT6Jyz3hW oZaT9DJ8z42kzoqUnikN1SnaqdBHd5I5WE9jLHw+NMS/N6HsvWYmp8For9LLAHspLmFx WRFfzeFW/eAV9aRO2jy3VUv9m/7Z7GKN8MsGUvRTKv8OWodeRteQh9NbcF3OcTxx8Uc1 F9Hg== 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=hREth8/sXqNJaKMmrgwnNsR+AJi7FjhJSz6BvL5ZC5w=; fh=ArwnLsabrY/Oo5OZ0B4waZHM7b0QXa0WdI7cjGO5R/4=; b=XNPVcwCFR1bdKbDztzBslrDTyt3YtuBGhw2nMGxq7NrBkPxncr16stWPb5vRtjRv9R 7IDe28Mi8MBS45TQPZYn8f0rDkEDhCixRiaIJG4KqzP6KJ7dPzRRRcD1lwlVXG9hIy8l nYD3lB24Rir7FUuAg5CHE2kHBVNT/6ayP6aNlOxP7MpyCR2WHLdNROOPlaIQqzC2rQrM tNbyStXHNrWu+g5/Bvs3rdVD5RRM32gMcLgBBZeTjw1zAmbmAyeV1JY41qzo8l2207iU T3VEI2I2WC6u4AMJbzWePBO+diVGv+yvNtaCdXpcqkvJJgEyGllV204eUerEXFos6mZ3 3eOg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=AijZ5kpJ; 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-76710-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76710-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. [139.178.88.99]) by mx.google.com with ESMTPS id b27-20020a63715b000000b005dccf9c665csi10253119pgn.664.2024.02.22.06.34.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 06:34:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76710-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=AijZ5kpJ; 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-76710-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76710-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 F1AC9283B56 for ; Thu, 22 Feb 2024 14:34:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D22C014C5AF; Thu, 22 Feb 2024 14:34:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="AijZ5kpJ" Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (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 8652C1474A2; Thu, 22 Feb 2024 14:34:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708612455; cv=none; b=VS+vO1kICprbDPbnQzLKP064Xw0w8H3Op2rXEDZyaNSUiqUo5zuDASNgsdfdJBwaMOWADBfly08P62N4hoUtvEyrY/CTPNd6I2EoLpv7p95oOihXCXPzbbbFHbO0xKWB8lbXOLUFH9McW5Tc4T5LBKPeUK11G04kL1CeF4xiiB8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708612455; c=relaxed/simple; bh=X+3QM5o0zewBV17loKNUt5tUmgE3HMIZKwh4yMXHe/s=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=eNVNuTMlob1oFQBWx9p+pd3muUSljCVR35JNQrjJUpKQp7RbZrW5iJBlIVii5JM96vtkQR6cjhTPZBTCBhyb1KL2D/7lF0IaGdg/mjPZGzhl3pscSN/MW++1kGq1VI0vN3cA0cAYfh8OrJmhyrMmBxdQT+v42nw568ozMjC3yLk= 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=AijZ5kpJ; arc=none smtp.client-ip=148.163.156.1 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 (m0353726.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41MEWAHY003885; Thu, 22 Feb 2024 14:33:50 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=hREth8/sXqNJaKMmrgwnNsR+AJi7FjhJSz6BvL5ZC5w=; b=AijZ5kpJwrZ8lZBm9/xupteLSWhLzMByIYc0AdLHgG0WAZs3Ep0FTycB1q2/mS1dm6g+ kFn9WUTdYTKfFTHUpvf0ybJglXmUO5SJZKL/H7agwahLBxTW4wr4OEbaiNjLRXSyWb/t CjPNx8c78KFpT/rmVaKVyWbGMizW3qRFC/wdgAOUtY/B3y9h9pTyXCLn8dujVSH+RvSp TQFJMLQSG+cAWCYGX2zp0QF4f5ruGQdRbwOjc2R7MwC6SpaKjBp93xK16e7RSVezWobq V+KfErA1s9VHjc8A+x19kQToaevEH+GY3xu2SlSHqKhYPnIYn/y560OQGHWOu/8vljMo jg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3we845g24c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 22 Feb 2024 14:33:49 +0000 Received: from m0353726.ppops.net (m0353726.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 41MEWLZI004423; Thu, 22 Feb 2024 14:33:48 GMT Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3we845g23m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 22 Feb 2024 14:33:48 +0000 Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41MDfUVm014339; Thu, 22 Feb 2024 14:33:47 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 3wb9u2x6nx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 22 Feb 2024 14:33:47 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41MEXgWC17892094 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Feb 2024 14:33:44 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 368D52004F; Thu, 22 Feb 2024 14:33:42 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2324920043; Thu, 22 Feb 2024 14:33:42 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTPS; Thu, 22 Feb 2024 14:33:42 +0000 (GMT) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 55669) id D7DFEE0332; Thu, 22 Feb 2024 15:33:41 +0100 (CET) From: Alexander Gordeev To: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot Cc: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Nicholas Piggin , Michael Ellerman , Heiko Carstens , Vasily Gorbik , Frederic Weisbecker Subject: [PATCH v2 RESEND 2/5] sched/vtime: get rid of generic vtime_task_switch() implementation Date: Thu, 22 Feb 2024 15:33:38 +0100 Message-Id: <5e8f7cfc5b405b892d55c51023e8149dfd83b253.1708612016.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: 3ehWUPFNx6Hwa8BJzdhvYh0kjUZ3R_pU X-Proofpoint-GUID: 8ANUiLJEJP9BmEUgyeQog1edqi5KkHDz 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-02-22_11,2024-02-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 bulkscore=0 phishscore=0 spamscore=0 mlxlogscore=731 suspectscore=0 adultscore=0 impostorscore=0 priorityscore=1501 mlxscore=0 clxscore=1015 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402220116 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 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