From nobody Mon Nov 25 09:17:22 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 AB15419048F for ; Mon, 28 Oct 2024 07:32:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100739; cv=none; b=pWOa11VqheHykPwoz1IQwtxl6z4An1tFEgwk7ayM4uRYH+4i5XMxxqb83xQe3z1JY9az/Nn/VmvoFgLbD8RZksXxaXXHnpIESHK0OEHPiTRXd1aWHzIOyNpH+74EvP0IWUsirNLxQkv3j0ZPL7F+GK0we+w2ySsGwkgZLNXInhc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100739; c=relaxed/simple; bh=fM4326lBSlyItUCyDsvky8XLESJ8Yos7plcqwTdqh/w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=NNojAzJpih0jxjxGUDODceIScIiv3fXwN7q4m2wyJ//KR4va4dDZ0bRA8A7ooPuyupXIJBCqyGXpiQt6RuDc/+fzp58l80UJu1L5QSxyWanFz74tAhB8D8YkBawrea8c9a0AfMPeVRP2JAnTXzep18fOEMaANXcwyb0y80HX6dI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=j7NJ0eXt; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=pvr256dP; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="j7NJ0eXt"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="pvr256dP" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730100736; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=54OvKsvI4pcx+jFe2hba+Pmf5q/X4eFe1wCaotDkyFc=; b=j7NJ0eXtcOZRq3ZpXc/xcw354TX8EcPCP7CH5CWdys4lFUwIHlKZGmvcpD03ak9fh096Yp WjhtJSEImM/SYhDl4/1C34470XrZwiuYDDVnJDre6KaUcrH+ZHOixTzCZ2eOWcjrBsM/MH ZwOJknNkqfZvf8rffR1syq3sW1Xp+wxrEFYwTIBu59njGssxHXsnExLITb6J/97rwkeQin APUguyWnIHGAWVx59fx4ctYhiql248udkV1Q5A8iRjgceT+4BydvsMHjTmKjdrWpioQuwy JJ5o8QbqzoD93zA3BT+/DdcTnVVSXMMsijlH2ruc+fWdeLHV6GOP9rWEFdZMwA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730100736; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=54OvKsvI4pcx+jFe2hba+Pmf5q/X4eFe1wCaotDkyFc=; b=pvr256dPPkwfpTLYBWFYX3kvalpn8v9pn42JGtvtXTbHNVANm31dj0IKMFUbxHo8gsL7rM 7OMYnNYGmwDoNGBw== To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Andreas Hindborg , Alice Ryhl , Miguel Ojeda , Kees Cook , linux-kernel@vger.kernel.org Cc: Nam Cao , Thomas Bogendoerfer Subject: [PATCH 01/31] KVM: MIPS: Switch to use hrtimer_setup() Date: Mon, 28 Oct 2024 08:31:34 +0100 Message-Id: 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: quoted-printable Content-Type: text/plain; charset="utf-8" There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function. Switch to use this new function. Patch was created by using Coccinelle. Signed-off-by: Nam Cao --- Cc: Thomas Bogendoerfer --- arch/mips/kvm/mips.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/mips/kvm/mips.c b/arch/mips/kvm/mips.c index 60b43ea85c12..cef3c423a41a 100644 --- a/arch/mips/kvm/mips.c +++ b/arch/mips/kvm/mips.c @@ -288,9 +288,8 @@ int kvm_arch_vcpu_create(struct kvm_vcpu *vcpu) if (err) return err; =20 - hrtimer_init(&vcpu->arch.comparecount_timer, CLOCK_MONOTONIC, - HRTIMER_MODE_REL); - vcpu->arch.comparecount_timer.function =3D kvm_mips_comparecount_wakeup; + hrtimer_setup(&vcpu->arch.comparecount_timer, kvm_mips_comparecount_wakeu= p, CLOCK_MONOTONIC, + HRTIMER_MODE_REL); =20 /* * Allocate space for host mode exception handlers that handle --=20 2.39.5 From nobody Mon Nov 25 09:17:22 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 46E5D191489 for ; Mon, 28 Oct 2024 07:32:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100740; cv=none; b=ZIp5t1KB48MMZoH56oElaLUGvFytl6FYACoGydXPt0jY3U+/WX0LA5nT4BWPS74NURRqPDyb7tTf9sm659rkhGorqMBEdWZtpb3j9AxAXG4IhdNPChFVEh01ofqqqZYaw29LgzstRyE/GE38B4N7vNsiKXo4jI34RNRqe3OMA5A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100740; c=relaxed/simple; bh=uOTK8RK+qfQgPko1/kcfrp+dzTqwlYdG2SYVqyuVRVs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=jqolk7eIxqSnXIJsbMiZGcE63M+mTpqSTbGbpgrlWNTpLJJKWsIjrMPoWVGxTLcUmWyT45h6PH+71bXrIn7nFJ8cmh8W9TKPemOlr3w7PDNk43rCNS3nzdctE+wOgahY5kHxhDZxEeh8Zm0WsBi44Cma49LvcBE7//i79zuC5HY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=iJAxSFkh; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=fnwSt15+; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="iJAxSFkh"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="fnwSt15+" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730100736; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4OaCPpaLXjT7nuaYNyzJEa7vwLha/LCJBeNJ/YYGThk=; b=iJAxSFkhI2ABfuuCozyySBhqF1nLpILkun7AdGnUB+9enkig4FKf2c3shVLOR9aeJ/+KSV CtwEIFRy7BdYnEcqgZvoKEEHET3JUJKNF6vLdPZ2i5D6SJ5ivk5HPZcvUsUPDGTah8pTUc q65HcY/DdGBGXMfB01MZRKu1yt9YGMG9mz1T7i6eZJwNdXamM17Qu/MBVZ2e4IKHMnC2m+ IwvrsQH2C42BFp6NgYGnHozU2k8rUzDtApmzCutyPOvO/MaDfgl9eEo1F+D80VJCiXWR9v DYm502KIONVVkGP0fC0kPogNsSPW4w5W6MkJqD+d7GO5OebGelvfk1oeJHSDQg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730100736; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4OaCPpaLXjT7nuaYNyzJEa7vwLha/LCJBeNJ/YYGThk=; b=fnwSt15+ep0Qqur193vbge3nr9ZoG42pgnmtVKxOXS2NeVaThOTtdYhgHf8q97ffh11IZf Uj9ogU7upwJj/qBg== To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Andreas Hindborg , Alice Ryhl , Miguel Ojeda , Kees Cook , linux-kernel@vger.kernel.org Cc: Nam Cao , Michael Ellerman Subject: [PATCH 02/31] KVM: PPC: Switch to use hrtimer_setup() Date: Mon, 28 Oct 2024 08:31:35 +0100 Message-Id: <83def641c1117ca6a1ffdb0c53813de97650fc2d.1729864823.git.namcao@linutronix.de> 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: quoted-printable Content-Type: text/plain; charset="utf-8" There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function. Switch to use this new function. Patch was created by using Coccinelle. Signed-off-by: Nam Cao --- Cc: Michael Ellerman --- arch/powerpc/kvm/powerpc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c index f14329989e9a..e6269ba3a839 100644 --- a/arch/powerpc/kvm/powerpc.c +++ b/arch/powerpc/kvm/powerpc.c @@ -769,8 +769,8 @@ int kvm_arch_vcpu_create(struct kvm_vcpu *vcpu) { int err; =20 - hrtimer_init(&vcpu->arch.dec_timer, CLOCK_REALTIME, HRTIMER_MODE_ABS); - vcpu->arch.dec_timer.function =3D kvmppc_decrementer_wakeup; + hrtimer_setup(&vcpu->arch.dec_timer, kvmppc_decrementer_wakeup, CLOCK_REA= LTIME, + HRTIMER_MODE_ABS); =20 #ifdef CONFIG_KVM_EXIT_TIMING mutex_init(&vcpu->arch.exit_timing_lock); --=20 2.39.5 From nobody Mon Nov 25 09:17:22 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 93EA01917ED for ; Mon, 28 Oct 2024 07:32:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100740; cv=none; b=Vdi+O3vslPMH8gE8rYVMsUw+L1MEbfG4fEWESvuiONxQNDkk+gCfp9klZtOofgEQk5lU1nXHBdYj6PMEZ8EBVuxdmJP6Sj3MOiywZBsrtuf6vYMXDZEd6pfm5aPapSwH8VBj6yHwJ7tfoskrYmFQswlc3UEcKe9+iZJ5aTrPNck= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100740; c=relaxed/simple; bh=Rf9etxNcd7hdI3Iu99sh6LQdxOGRbsp9nDK50ELLggk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=sZXj9iiKo8j+MitT2iVyrbYUgN0cAfuvTpuAsmIBSpp+eeo9J1jnPjDpkXN2T0lbZ/v5N0mgJ5tghlqPdBaf2gV2+nEg4p81Yg8fFJ4wGQvmHtBY+39p6/Xtlcdln/IMYlMosaeP2BeTRnVrYHujX4BLeU+k3xV95CQHKh2MsQE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=wUtp9bVq; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=aTWiHZHR; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="wUtp9bVq"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="aTWiHZHR" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730100737; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TcoPPSyL5mtK+cYGy9W3PxhhXEc0Thmk/MBB1C+VQRE=; b=wUtp9bVqeJEhO+VTnHds8Rr2VrmeSl1TRjNEpYuvzMdFykTB0HCOkHs3rHRCVPKcruuhJt CR9sCZS1ZuH8VhGk3TR7YOc4LylC1xp3DM3It2WqQzNa8NyNanbJBSNAIQNQBWTRgKr8AL dJo+Ldgd/loB4q3FbfSv1LkvwnONIZ62PUXLqkX6j2GUy8Imp1b8lWYypbRnNr0NNF9eho csgzA7ZbHS3o4xRsPsX7tJfrvdzLzq4PF0Kj/HgC97RPJBTgVr2urwNOfwu0gtTN82sOhh 6d9jpRR8j9cFiJYJYHg0c0EeGEX6ahVfnInpOjJrIv2f+zR0/vRk8+24uDKKwA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730100737; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TcoPPSyL5mtK+cYGy9W3PxhhXEc0Thmk/MBB1C+VQRE=; b=aTWiHZHRCH37XJc6Z27pg73rY+UQ6lr3R2HzLTVAh9AqZ7VRnk4yeB5KqOlOZ7T+JVcmEh w//HMFZV6mdnJ7Cw== To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Andreas Hindborg , Alice Ryhl , Miguel Ojeda , Kees Cook , linux-kernel@vger.kernel.org Cc: Nam Cao , Christian Borntraeger Subject: [PATCH 03/31] KVM: s390: Switch to use hrtimer_setup() Date: Mon, 28 Oct 2024 08:31:36 +0100 Message-Id: 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: quoted-printable Content-Type: text/plain; charset="utf-8" There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function. Switch to use this new function. Patch was created by using Coccinelle. Signed-off-by: Nam Cao --- Cc: Christian Borntraeger --- arch/s390/kvm/interrupt.c | 3 +-- arch/s390/kvm/kvm-s390.c | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c index 4f0e7f61edf7..3c8685ffea62 100644 --- a/arch/s390/kvm/interrupt.c +++ b/arch/s390/kvm/interrupt.c @@ -3174,8 +3174,7 @@ void kvm_s390_gisa_init(struct kvm *kvm) gi->alert.mask =3D 0; spin_lock_init(&gi->alert.ref_lock); gi->expires =3D 50 * 1000; /* 50 usec */ - hrtimer_init(&gi->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); - gi->timer.function =3D gisa_vcpu_kicker; + hrtimer_setup(&gi->timer, gisa_vcpu_kicker, CLOCK_MONOTONIC, HRTIMER_MODE= _REL); memset(gi->origin, 0, sizeof(struct kvm_s390_gisa)); gi->origin->next_alert =3D (u32)virt_to_phys(gi->origin); VM_EVENT(kvm, 3, "gisa 0x%pK initialized", gi->origin); diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index bb7134faaebf..4ab20ba0392c 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c @@ -3896,8 +3896,8 @@ static int kvm_s390_vcpu_setup(struct kvm_vcpu *vcpu) if (rc) return rc; } - hrtimer_init(&vcpu->arch.ckc_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); - vcpu->arch.ckc_timer.function =3D kvm_s390_idle_wakeup; + hrtimer_setup(&vcpu->arch.ckc_timer, kvm_s390_idle_wakeup, CLOCK_MONOTONI= C, + HRTIMER_MODE_REL); =20 vcpu->arch.sie_block->hpid =3D HPID_KVM; =20 --=20 2.39.5 From nobody Mon Nov 25 09:17:22 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 04E761917EE for ; Mon, 28 Oct 2024 07:32:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100741; cv=none; b=GpgOj/gd0Zavq+yKnmmmHOGlBoH+ZEMdQaLX7laly0/BhKp4mtXT2GPCyc4yMlIsMCO3ydxorqwOT26UWgRpHdECVPSFcBLXgFaJKJvQWGBfva0K4GuQlMk1CZSCUmSaikFzkc4WPEiMFevHqffdKqoYUQNRHT7Zy7iFG99+s+k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100741; c=relaxed/simple; bh=MwzPzekW1pA6NFxBLFP/Gi3ei4i2eOHMAczQbNbiveE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=R3CM187PqaiDi7AWnnbpUHFPCTUOvezBjGSUspABNNza7q/CtsCDfqiaytNZtMvRdV/p9Hav0R3axXFHkX1+bG9pCExjIbFt58xxtQ5RwNfvv2xanH38Ku65Wz3pEwm0Hzy4duWPjFO5S/K9DpjpGS8tzMV1nUanr1SH2efd2zc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=QM2/1ZS1; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=0RCEJo/I; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="QM2/1ZS1"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="0RCEJo/I" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730100737; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Pk8eiXQqU2Ur609erj6dwbyMBjwzv45Z/TfJvpEb3Cs=; b=QM2/1ZS1RjHztD8baiAh+oEZABOEXoqzfSqmx16Prk1sbRXe+p3XLzU0uYX12eIMZ1yZ/3 f5+e8y1UIwLDr7q6DPtaGsZSptFx2c7VQ5buOF8l+yVEUh69eN2OHC4dwY1tPJE/lnacC4 J0yFNrkEQIuiP60X3JS0maayipEMAxWJMQ94GcRXrx9UiBzcoWa1q7BIbALdy4ACU/S0Dm mY1/aIBaOBLjYD7gU62fmpfO6fPouUaYE1oJaV0LlsRr746g+E3/upzXAN+RRg0v5Sneyi mJN2a6jviyMkDJk6MveNyrg4uEsRBq0q03lu4Q7/ysQVlMxZDJXC/8rLWsrXLg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730100737; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Pk8eiXQqU2Ur609erj6dwbyMBjwzv45Z/TfJvpEb3Cs=; b=0RCEJo/IoC5mEMd8GNxzz7ONQbDUJiAEiQYLduM+rGc93OZyOUoLpeaH8TCgi7pC5UlZ0x FoaJN+QUrElW6cBg== To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Andreas Hindborg , Alice Ryhl , Miguel Ojeda , Kees Cook , linux-kernel@vger.kernel.org Cc: Nam Cao , Sean Christopherson Subject: [PATCH 04/31] KVM: x86: Switch to use hrtimer_setup() Date: Mon, 28 Oct 2024 08:31:37 +0100 Message-Id: <8774212e6c10c550743219e00738492eb379227c.1729864823.git.namcao@linutronix.de> 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: quoted-printable Content-Type: text/plain; charset="utf-8" There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function. Switch to use this new function. Patch was created by using Coccinelle. Signed-off-by: Nam Cao --- Cc: Sean Christopherson --- arch/x86/kvm/hyperv.c | 3 +-- arch/x86/kvm/i8254.c | 3 +-- arch/x86/kvm/lapic.c | 5 ++--- arch/x86/kvm/vmx/nested.c | 5 ++--- arch/x86/kvm/xen.c | 5 ++--- 5 files changed, 8 insertions(+), 13 deletions(-) diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c index 4f0a94346d00..19ea425a7264 100644 --- a/arch/x86/kvm/hyperv.c +++ b/arch/x86/kvm/hyperv.c @@ -952,8 +952,7 @@ static void stimer_init(struct kvm_vcpu_hv_stimer *stim= er, int timer_index) { memset(stimer, 0, sizeof(*stimer)); stimer->index =3D timer_index; - hrtimer_init(&stimer->timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); - stimer->timer.function =3D stimer_timer_callback; + hrtimer_setup(&stimer->timer, stimer_timer_callback, CLOCK_MONOTONIC, HRT= IMER_MODE_ABS); stimer_prepare_msg(stimer); } =20 diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c index cd57a517d04a..9342442e9650 100644 --- a/arch/x86/kvm/i8254.c +++ b/arch/x86/kvm/i8254.c @@ -690,8 +690,7 @@ struct kvm_pit *kvm_create_pit(struct kvm *kvm, u32 fla= gs) pit->kvm =3D kvm; =20 pit_state =3D &pit->pit_state; - hrtimer_init(&pit_state->timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); - pit_state->timer.function =3D pit_timer_fn; + hrtimer_setup(&pit_state->timer, pit_timer_fn, CLOCK_MONOTONIC, HRTIMER_M= ODE_ABS); =20 pit_state->irq_ack_notifier.gsi =3D 0; pit_state->irq_ack_notifier.irq_acked =3D kvm_pit_ack_irq; diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index 2098dc689088..1cfcd9125ffb 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -2887,9 +2887,8 @@ int kvm_create_lapic(struct kvm_vcpu *vcpu) =20 apic->nr_lvt_entries =3D kvm_apic_calc_nr_lvt_entries(vcpu); =20 - hrtimer_init(&apic->lapic_timer.timer, CLOCK_MONOTONIC, - HRTIMER_MODE_ABS_HARD); - apic->lapic_timer.timer.function =3D apic_timer_fn; + hrtimer_setup(&apic->lapic_timer.timer, apic_timer_fn, CLOCK_MONOTONIC, + HRTIMER_MODE_ABS_HARD); if (lapic_timer_advance) apic->lapic_timer.timer_advance_ns =3D LAPIC_TIMER_ADVANCE_NS_INIT; =20 diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c index a8e7bc04d9bf..c8cdf2ef00aa 100644 --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -5279,9 +5279,8 @@ static int enter_vmx_operation(struct kvm_vcpu *vcpu) if (enable_shadow_vmcs && !alloc_shadow_vmcs(vcpu)) goto out_shadow_vmcs; =20 - hrtimer_init(&vmx->nested.preemption_timer, CLOCK_MONOTONIC, - HRTIMER_MODE_ABS_PINNED); - vmx->nested.preemption_timer.function =3D vmx_preemption_timer_fn; + hrtimer_setup(&vmx->nested.preemption_timer, vmx_preemption_timer_fn, CLO= CK_MONOTONIC, + HRTIMER_MODE_ABS_PINNED); =20 vmx->nested.vpid02 =3D allocate_vpid(); =20 diff --git a/arch/x86/kvm/xen.c b/arch/x86/kvm/xen.c index c386fbe6b58d..73e85b1ebb08 100644 --- a/arch/x86/kvm/xen.c +++ b/arch/x86/kvm/xen.c @@ -265,9 +265,8 @@ static void kvm_xen_stop_timer(struct kvm_vcpu *vcpu) =20 static void kvm_xen_init_timer(struct kvm_vcpu *vcpu) { - hrtimer_init(&vcpu->arch.xen.timer, CLOCK_MONOTONIC, - HRTIMER_MODE_ABS_HARD); - vcpu->arch.xen.timer.function =3D xen_timer_callback; + hrtimer_setup(&vcpu->arch.xen.timer, xen_timer_callback, CLOCK_MONOTONIC, + HRTIMER_MODE_ABS_HARD); } =20 static void kvm_xen_update_runstate_guest(struct kvm_vcpu *v, bool atomic) --=20 2.39.5 From nobody Mon Nov 25 09:17:22 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 DE5811922EA for ; Mon, 28 Oct 2024 07:32:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100742; cv=none; b=ACbbcAlN25BJ11KibAXe2vb6+xwC85N9U/t1v3/QRQnHo1+WWjUSD377o1kK2sPYqHCzOwEFIGoi2oPjPfP+7XmxNn4D04FSt2bZZ/2SbW0qS1dchQHOi9R6JVmXZpJvqZTUvd5P0osz9XpQ3OXckUzE3QpRVrcnDTS4IR8e33w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100742; c=relaxed/simple; bh=MDXngocv7tPdUvz8DqTIpMISjrUpd68bMeQIaHuzXkA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=esDWS+hmGBwvS/nZY0XY3cExCIZeK6754N7snTBEJfZnf6tiYpQC4YmBuxwbyLJMwFPrtwZxt/ffqMlQyMt4E5M2Hds+VFN5KZ+5x5PEoyGHN4Kk/0N2estxzFDPEKyKzt8eB0E+70NxyrXKh3dzXb+MQ7Q8AgThYiGQJsId0ZU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=NowObxvY; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=hn70gjMg; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="NowObxvY"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="hn70gjMg" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730100737; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NZR0n1Z7yUnxyg/FOVlgc5mhT02OpYm3oHjnsxlsSzg=; b=NowObxvYIfafnnIXpmqQsFE+3S4CcNsBrczgKWEN1ngnKoFXiUluJy05MPzJIvss4rsN6y qotder9Xd48g2218LzpopY2UrRuQPh2Q4Yq3qwOFWm0fUsGKIExZdGjeB+hhD0Mmy0JPRH jUpbhqyVjDBs0yivmqZgUIBxXBcPaM80LJbazEAJ0wqOArek5z0JGqOMBuKckmmPjxkj5t wyxXAtng+L0Vlts3KY6e1ukg2PPLPwSSYq7CjlD65H7QNRvIfIMtUkF4mIGWvebqZreSm3 wQsKevtF8Znik29HGsV7lZIm/7hibpUHwIj4mRoVeqpT3OH77JgP1VHMaX8Elw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730100737; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NZR0n1Z7yUnxyg/FOVlgc5mhT02OpYm3oHjnsxlsSzg=; b=hn70gjMgNdyJBWT+8oSSJ1F07k+ySGkhTGhMm1hw0VuUyKEIdJliWIl2er2roGn1jf9bm6 r2Jzro686HMBPQDQ== To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Andreas Hindborg , Alice Ryhl , Miguel Ojeda , Kees Cook , linux-kernel@vger.kernel.org Cc: Nam Cao , Marc Zyngier Subject: [PATCH 05/31] KVM: arm64: Switch to use hrtimer_setup() Date: Mon, 28 Oct 2024 08:31:38 +0100 Message-Id: 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: quoted-printable Content-Type: text/plain; charset="utf-8" There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function. Switch to use this new function. Signed-off-by: Nam Cao Acked-by: Marc Zyngier --- Cc: Marc Zyngier --- arch/arm64/kvm/arch_timer.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/arch/arm64/kvm/arch_timer.c b/arch/arm64/kvm/arch_timer.c index 879982b1cc73..92e4fb5dcf52 100644 --- a/arch/arm64/kvm/arch_timer.c +++ b/arch/arm64/kvm/arch_timer.c @@ -993,8 +993,7 @@ static void timer_context_init(struct kvm_vcpu *vcpu, i= nt timerid) else ctxt->offset.vm_offset =3D &kvm->arch.timer_data.poffset; =20 - hrtimer_init(&ctxt->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_HARD); - ctxt->hrtimer.function =3D kvm_hrtimer_expire; + hrtimer_setup(&ctxt->hrtimer, kvm_hrtimer_expire, CLOCK_MONOTONIC, HRTIME= R_MODE_ABS_HARD); =20 switch (timerid) { case TIMER_PTIMER: @@ -1021,8 +1020,8 @@ void kvm_timer_vcpu_init(struct kvm_vcpu *vcpu) timer_set_offset(vcpu_ptimer(vcpu), 0); } =20 - hrtimer_init(&timer->bg_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_HARD); - timer->bg_timer.function =3D kvm_bg_timer_expire; + hrtimer_setup(&timer->bg_timer, kvm_bg_timer_expire, CLOCK_MONOTONIC, + HRTIMER_MODE_ABS_HARD); } =20 void kvm_timer_init_vm(struct kvm *kvm) --=20 2.39.5 From nobody Mon Nov 25 09:17:22 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 347551922F9 for ; Mon, 28 Oct 2024 07:32:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100743; cv=none; b=NOYfLaqgzfFUrCYfFlyuRZ2Z9Qaxgt3uEmz+49grCdzFFgLUePQbZkb2uSHBwgDhHaAFBzpcfxfMTyClmVOwL8p1sCeZVDAJRue/KqwhyF76fWV/Mq8R64jKwNNRLVlLJseNA8l95MUlb+SsahE2y+3e0tBlaUciXt8ottybYww= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100743; c=relaxed/simple; bh=CqHN/CevzE2KWFjgA9NTQe5jdoRTX+hW3VuxFLg85S0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=dH/2fh0a9Luqea5yOTzeUJDkZF1QaJ+4uW3CcYUj2xI2wXzguljVydjCn7koBiM37yO2YW73OmTku2OJjyBvq/m/ANeB8L+QpJ6Pr7qzBqGOlpk8FLFMI6N4Fnldv3FbNyjUKb2Bcxl8Yb04Lf2mGMPKPprPs5ewc0AC+s63lE4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=julUtZR+; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=Brgh6lIr; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="julUtZR+"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Brgh6lIr" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730100738; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=guF/UA1hI0xHq7jYGgwI8l3WfvemyIeIMX1G1unXY0c=; b=julUtZR+gSME1hVuTKca3rZxMOkEvSY79YvA9ipymWVPxFoZbpi0O990iZcTz8a/p+cD/O 7H+hZz2geb//twUWEfuKEcWxeI+Qw6P7+M2wlNTxLqJv1qBChfOEGC61ZvjliKdMNqCkSG ZehBCO+am5j5M8gFNPAO4/utONaBGoz/lJnNLnSlRBWLgWQdKwH6/wvwA003rhCmgqhcl+ iYxvERiPkzg3+fGSPijOicV47RErgLHZaykJlemR5IZESagTDNzMoaAebz9aSbzOB6MPuk pAcw8unKmGXbKPrC0FT44wM3oQdlm5stj5lxdwU4CV8kt8msbyyTisQJk8kPsQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730100738; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=guF/UA1hI0xHq7jYGgwI8l3WfvemyIeIMX1G1unXY0c=; b=Brgh6lIrKuJFwFSWD1mdlPUr/I1I5ow7+C9iRyIs4Q2c0ubRHMs/isb6XnO1Vcou9Xjb4G 8TYHTYfYp/k4ShAw== To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Andreas Hindborg , Alice Ryhl , Miguel Ojeda , Kees Cook , linux-kernel@vger.kernel.org Cc: Nam Cao , Huacai Chen Subject: [PATCH 06/31] LoongArch: KVM: Switch to use hrtimer_setup() Date: Mon, 28 Oct 2024 08:31:39 +0100 Message-Id: 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: quoted-printable Content-Type: text/plain; charset="utf-8" There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function. Switch to use this new function. Patch was created by using Coccinelle. Signed-off-by: Nam Cao --- Cc: Huacai Chen --- arch/loongarch/kvm/vcpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/loongarch/kvm/vcpu.c b/arch/loongarch/kvm/vcpu.c index 0697b1064251..eada16d2532c 100644 --- a/arch/loongarch/kvm/vcpu.c +++ b/arch/loongarch/kvm/vcpu.c @@ -1457,8 +1457,8 @@ int kvm_arch_vcpu_create(struct kvm_vcpu *vcpu) vcpu->arch.vpid =3D 0; vcpu->arch.flush_gpa =3D INVALID_GPA; =20 - hrtimer_init(&vcpu->arch.swtimer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_PINNE= D); - vcpu->arch.swtimer.function =3D kvm_swtimer_wakeup; + hrtimer_setup(&vcpu->arch.swtimer, kvm_swtimer_wakeup, CLOCK_MONOTONIC, + HRTIMER_MODE_ABS_PINNED); =20 vcpu->arch.handle_exit =3D kvm_handle_exit; vcpu->arch.guest_eentry =3D (unsigned long)kvm_loongarch_ops->exc_entry; --=20 2.39.5 From nobody Mon Nov 25 09:17:22 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 9F727192B61 for ; Mon, 28 Oct 2024 07:32:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100743; cv=none; b=BBqyT83yamfAFTVjvX7ZIa4OZlLmuMEkj+UNVk/DYK7/+LBgnPokRdrr+NGIbPj/UNt1Vta6xyrTf4NV684meb6VLqKJq6a3+D9Nv3BsZ7/hI2qrwVk4ploOOLbq7eOpXVf7GI0YSGwt7ykbJ94Fmb+0VAbey6oZpQyy1F//9tk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100743; c=relaxed/simple; bh=HHvpS2gHaoYjWnehOnpADwDP4ZmwbW8a7d6jUtoNHGI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=FJm/bdzYnseWbjO98F1GYEzC6WnUwJMgrGh0PYmLN8IVLOm1JWVVlFPksAHVU6hwa3ffLqmryjskZBotVP3FGPW3zFmAelpiYHK7JANCKDJiRjtkdN5pxLxjsoLezecpdVx1JMnyFRfXBqQCAB7cpQljgpTYz2AwMshwKagi/0o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=Cyk7bb4O; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=6X4Odxek; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Cyk7bb4O"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="6X4Odxek" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730100738; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1DJ0btonr8jZwahcv7pasP/jPhkqMfKmuRiG8N2yMAM=; b=Cyk7bb4O4uAwf7Fm1LS0LOOWz+/WLmihltLHliXwLGz0I94aE7mZrMr7i742dS89LMt0pb +DyUjFtw6pVi5cfUtu71+snGuU/34DrAI2xJK3bhOgit8fYZ4K2s+XyQ9L9K/Cvorb9eMz 8xnAskomsTniPoJO10+ZrTduIjCJCyxy+qBl48p3xhMVOsVukPWgJi1h9Mj3fg/nKTP3N1 /lhU7XYJzfWR4HQ+etEqSYVgHiV56l4+0rZpuPiilDTqpQYFbM4rUkD6BqpuCTyEE5KE/t c0C0fX01yYRb8OI3eadjRb2nVm+WNmmAHy/87rk3VMnhmg0ZKAvX9Avqcc48Ng== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730100738; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1DJ0btonr8jZwahcv7pasP/jPhkqMfKmuRiG8N2yMAM=; b=6X4OdxekgQzCedoVSwVGUrNMvb5M7RScE3G/cfyX6bBOC0KgJQUuCLTRRKQmh+sJK1IKlc huur2BeHF6K9bHDw== To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Andreas Hindborg , Alice Ryhl , Miguel Ojeda , Kees Cook , linux-kernel@vger.kernel.org Cc: Nam Cao , Anup Patel Subject: [PATCH 07/31] riscv: kvm: Switch to use hrtimer_setup() Date: Mon, 28 Oct 2024 08:31:40 +0100 Message-Id: <888e7cbae0d492fc284f94113f7fad081a77138f.1729864823.git.namcao@linutronix.de> 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: quoted-printable Content-Type: text/plain; charset="utf-8" There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function. Switch to use this new function. Patch was created by using Coccinelle. Signed-off-by: Nam Cao --- Cc: Anup Patel --- arch/riscv/kvm/vcpu_timer.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/riscv/kvm/vcpu_timer.c b/arch/riscv/kvm/vcpu_timer.c index 75486b25ac45..74b78b0346df 100644 --- a/arch/riscv/kvm/vcpu_timer.c +++ b/arch/riscv/kvm/vcpu_timer.c @@ -248,18 +248,19 @@ int kvm_riscv_vcpu_timer_init(struct kvm_vcpu *vcpu) if (t->init_done) return -EINVAL; =20 - hrtimer_init(&t->hrt, CLOCK_MONOTONIC, HRTIMER_MODE_REL); t->init_done =3D true; t->next_set =3D false; =20 /* Enable sstc for every vcpu if available in hardware */ if (riscv_isa_extension_available(NULL, SSTC)) { t->sstc_enabled =3D true; - t->hrt.function =3D kvm_riscv_vcpu_vstimer_expired; + hrtimer_setup(&t->hrt, kvm_riscv_vcpu_vstimer_expired, CLOCK_MONOTONIC, + HRTIMER_MODE_REL); t->timer_next_event =3D kvm_riscv_vcpu_update_vstimecmp; } else { t->sstc_enabled =3D false; - t->hrt.function =3D kvm_riscv_vcpu_hrtimer_expired; + hrtimer_setup(&t->hrt, kvm_riscv_vcpu_hrtimer_expired, CLOCK_MONOTONIC, + HRTIMER_MODE_REL); t->timer_next_event =3D kvm_riscv_vcpu_update_hrtimer; } =20 --=20 2.39.5 From nobody Mon Nov 25 09:17:22 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 69831192598 for ; Mon, 28 Oct 2024 07:32:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100743; cv=none; b=KPF2PNEA2xVDMEZQUiwiQBLEJ7O8Mrn/7XFKlLpRN3i/IKosMT4tUury9QGq4IX8zXzAXlPKtoxBBsY1hhQGJElSKDtUUpC63cesBJwryw1hXLJmZ66UcadQrMzZaT82em+KScW4qtcj3NRZQMqQM7Yk8vINj2sL0hB2YyHbNwA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100743; c=relaxed/simple; bh=LXpvU1UUt7B3sh4Trxnx9NpWLLGwl3SdmlEwiVkDrs8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=WRoySOqOTSEpxg4n/YOM35XxzKXUfJ7wv40okXWm98TVh8BpInpsg6tfNwapQOssF5J+ChWGeqXBnwUQy+XIaHjbGCrELIc8n8ltAhXduMgBl6deJ67BWEWi44YI8O1oYZVd8nWacT1eminQ/KV1kUj+b1iJYgolLvIoMCvcqtE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=O3nlWm8+; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=h3Z+Qkq9; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="O3nlWm8+"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="h3Z+Qkq9" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730100738; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DrfT+2lc1VSoJ47yhkWIvgcQ4dSCLxfio26mAKCAksE=; b=O3nlWm8+DkygHkHQCATfcz1vLNFbXzKJbDkkSuCz1r/eRhWcCK/7oskJPrcw5xDjW8F08K VSOson6hRMjY+3olXT5nNdps9b05iU99/zrVkRYekKcDptJ1p92U1Digwhvfp5FUnXUDvf MatTD7DSUOJzlB++G+so/SWBXoVp03biazLMyFHmHI9dePHK88w3wri7UIgU8tCvYhpdYm aUGJJQsI7+a6KmpwxLZ0LIbFYocFZMO6o1XUUAF26LdNes9loxHC0BRpaIUl/g4ygf2TRR kLPhyFt9ve2x+Mn/pkW8Bg+eGyoXROSK23IVgQm/QkUbrLMhTYAOkuk1qkc4Nw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730100738; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DrfT+2lc1VSoJ47yhkWIvgcQ4dSCLxfio26mAKCAksE=; b=h3Z+Qkq99Xgf0uS7AerTofTATmO1m0I44Fig28vA1CcTxYtFmJPHSDruhcDupKzHjZqEgB J3Xb3sL0Jg0FU7CA== To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Andreas Hindborg , Alice Ryhl , Miguel Ojeda , Kees Cook , linux-kernel@vger.kernel.org Cc: Nam Cao , Sascha Hauer Subject: [PATCH 08/31] ARM: imx: Switch to use hrtimer_setup() Date: Mon, 28 Oct 2024 08:31:41 +0100 Message-Id: <63ef9ac46df5156bccc35b0a907431be49d0b055.1729864823.git.namcao@linutronix.de> 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: quoted-printable Content-Type: text/plain; charset="utf-8" There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function. Switch to use this new function. Signed-off-by: Nam Cao --- Cc: Sascha Hauer --- arch/arm/mach-imx/mmdc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-imx/mmdc.c b/arch/arm/mach-imx/mmdc.c index b68cb86dbe4c..a568b5e15dcb 100644 --- a/arch/arm/mach-imx/mmdc.c +++ b/arch/arm/mach-imx/mmdc.c @@ -509,9 +509,8 @@ static int imx_mmdc_perf_init(struct platform_device *p= dev, void __iomem *mmdc_b pmu_mmdc->mmdc_ipg_clk =3D mmdc_ipg_clk; pmu_mmdc->devtype_data =3D device_get_match_data(&pdev->dev); =20 - hrtimer_init(&pmu_mmdc->hrtimer, CLOCK_MONOTONIC, - HRTIMER_MODE_REL); - pmu_mmdc->hrtimer.function =3D mmdc_pmu_timer_handler; + hrtimer_setup(&pmu_mmdc->hrtimer, mmdc_pmu_timer_handler, CLOCK_MONOTONIC, + HRTIMER_MODE_REL); =20 cpumask_set_cpu(raw_smp_processor_id(), &pmu_mmdc->cpu); =20 --=20 2.39.5 From nobody Mon Nov 25 09:17:22 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 E8C3B192B8F for ; Mon, 28 Oct 2024 07:32:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100744; cv=none; b=VDi0wim521CaoZ6Qq/onF14wstq+VDXnkhuhMDjrc6EzFtC5nuhFTBb32BqjOPFkgfy9mNRwzbLc4F1y1l6Xj9KRoom+hlyxKuquG5y8unxQx8Bu+R0i8+i+EbM0rhDsMlzLW7L0K7qrY00z+g5ogW0t0/LI9pU6/d/USM9fSIM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100744; c=relaxed/simple; bh=WM1Mp7nD+1z2S/O3yOgyCIJPT8k4b8byfoBHNxw6N7c=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Crq3pI3V1XqsEzuec6dYwwKzChx3LYimPb8RK4cDiO2mojknamqZ375uTihwyTv/IMsUNQSElJbmcT8cvhfCDQ1sghRu0uRu6sYlrT7Tu0YxUvLQ60Ye0GaktaGlOV9qnCImMkW+J5amGc0mNB+hYKypVOVgWHRpUdUIIHGg+gk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=ipfvYEN5; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=PVdLhbiX; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="ipfvYEN5"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="PVdLhbiX" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730100739; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=B5zZoeNFjrAN+nVop+LdA4aT3KoLdw5lw2yxTRa3DO0=; b=ipfvYEN5IsSFKk50pBtqhrJ5a/k3WQOOFbch/hs57sBc0dYTVC9pGhSJ5UDmbm84vNr5YY r5HjrVUoWrg3OlT0TLENx1FbKDbGk8CCL5AI50TAOCCQfz/ps02T7IHb5aBfZBrBd/3MpO PTSU791EsEEV8FqSA6DkcQTHk7PiMKt+17z5HTadIjwtGkTDkwIeoEM/4otp6RveSBihJ3 HU92TmH+Y5vCiZ2u3IfcX2wAhOl56/6Gu76O3YHtxTa49moL3DwXgcaOb7KrwVTixPjn3d QmoCoNyt8avBC1B25AnKG55xSwkF6SJjVqhGf8plvIlbgxe56kMfCh99wYF42w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730100739; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=B5zZoeNFjrAN+nVop+LdA4aT3KoLdw5lw2yxTRa3DO0=; b=PVdLhbiXLdlGzwIvIJSmCLsmwfo5hREos5lj6r8k5oMSKmJMOuJgMQfVMXKvPtuCsDpW6K 8ZCGpj5LYjL9DRAQ== To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Andreas Hindborg , Alice Ryhl , Miguel Ojeda , Kees Cook , linux-kernel@vger.kernel.org Cc: Nam Cao , Russell King Subject: [PATCH 09/31] ARM: 8611/1: l2x0: Switch to use hrtimer_setup() Date: Mon, 28 Oct 2024 08:31:42 +0100 Message-Id: <0d4ef3ad2558fd19e09e5977712a69e2c43ae094.1729864823.git.namcao@linutronix.de> 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: quoted-printable Content-Type: text/plain; charset="utf-8" There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function. Switch to use this new function. Patch was created by using Coccinelle. Signed-off-by: Nam Cao --- Cc: Russell King --- arch/arm/mm/cache-l2x0-pmu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/arm/mm/cache-l2x0-pmu.c b/arch/arm/mm/cache-l2x0-pmu.c index 993fefdc167a..93ef0502b7ff 100644 --- a/arch/arm/mm/cache-l2x0-pmu.c +++ b/arch/arm/mm/cache-l2x0-pmu.c @@ -539,8 +539,7 @@ static __init int l2x0_pmu_init(void) * at higher frequencies. */ l2x0_pmu_poll_period =3D ms_to_ktime(1000); - hrtimer_init(&l2x0_pmu_hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); - l2x0_pmu_hrtimer.function =3D l2x0_pmu_poll; + hrtimer_setup(&l2x0_pmu_hrtimer, l2x0_pmu_poll, CLOCK_MONOTONIC, HRTIMER_= MODE_REL); =20 cpumask_set_cpu(0, &pmu_cpu); ret =3D cpuhp_setup_state_nocalls(CPUHP_AP_PERF_ARM_L2X0_ONLINE, --=20 2.39.5 From nobody Mon Nov 25 09:17:22 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 D7075192B78 for ; Mon, 28 Oct 2024 07:32:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100744; cv=none; b=SSgy47Ywufbxg/q0vRlx7RLmRmCnImqGsa3G0lVjBP0hZDiD4Tn4dw+Uln3iD9vP0ISNydv8Y+HWr1T5VgM63oQm/CP2trZ+Sus5oteBtEDTJBQR8T/YpmALGcYaOKPhKPLbEdwRTZnH7o0ukUSSsKpf/ZivKbRsdRtXHLlogek= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100744; c=relaxed/simple; bh=5MZt17PaMlsHfNRKyGAIFHUJ+wkj5i3UiEoH00D7aik=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=daknXdVl5zWSim8ZM5qSlLGV7jIeaVYX6QwZRL6Ya/lVAtYK9wlHk6pP6aaHTpMg7vKLtAIyjJNvICeEfY6zWICKsRXtH7lAmGwHGZj2XL/sf6R6RvO2Puk941/ic66ybAMOf8nm0O6lwVN45RndGIcYbVZGllOXGuRUyJDvFso= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=Ob67aNQV; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=CMSwTDVw; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Ob67aNQV"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="CMSwTDVw" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730100739; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AxwZp1odMq9uoPIq7uyz56U1ANYVR+uLtMQUbFRNsoI=; b=Ob67aNQVJ2vmXD48JMg76G9LAhvRtlYe+BZwJp8xAhCUxyJ1XUdQjRTN4S3Wp6d0m/r3cP jhVy7fMDd0fpiBC9J+2P8M+6UzHHJ5Fa7r2y8iNKhltFKdl1aPrc0b77M4op6xZ8PPwMSi EwApT8qLARocXytNnNx5aAGinbIG/cUQH8ygO6QYobK/Uc1sLEH2lhpoGBDPJyaPbl8utD e2wYCKUj/x03in5TP44zu3iHhL+ju7oq2obuQg3oZAFNQ5bOBHddsmzPgfenEEysZU3YXO 5kySGjo4M+KTTd0SSy0Jt9dNNwInjCrnAFsQokA78XmRYTUUxF2vD3Wn0MK3LA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730100739; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AxwZp1odMq9uoPIq7uyz56U1ANYVR+uLtMQUbFRNsoI=; b=CMSwTDVw7VVUHDmc42Bsf+4kqEpFAgsrg0NWOJtTIw8M9YcLv0pHEx2YXmpjRBfBA4vTrI zR+dKTFRhCnjPXDA== To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Andreas Hindborg , Alice Ryhl , Miguel Ojeda , Kees Cook , linux-kernel@vger.kernel.org Cc: Nam Cao , Michael Ellerman Subject: [PATCH 10/31] powerpc/watchdog: Switch to use hrtimer_setup() Date: Mon, 28 Oct 2024 08:31:43 +0100 Message-Id: <80cf6f14a74a374903997670926b8ce3a9439558.1729864823.git.namcao@linutronix.de> 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: quoted-printable Content-Type: text/plain; charset="utf-8" There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function. Switch to use this new function. Patch was created by using Coccinelle. Signed-off-by: Nam Cao --- Cc: Michael Ellerman --- arch/powerpc/kernel/watchdog.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/powerpc/kernel/watchdog.c b/arch/powerpc/kernel/watchdog.c index 8c464a5d8246..2429cb1c7baa 100644 --- a/arch/powerpc/kernel/watchdog.c +++ b/arch/powerpc/kernel/watchdog.c @@ -495,8 +495,7 @@ static void start_watchdog(void *arg) =20 *this_cpu_ptr(&wd_timer_tb) =3D get_tb(); =20 - hrtimer_init(hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); - hrtimer->function =3D watchdog_timer_fn; + hrtimer_setup(hrtimer, watchdog_timer_fn, CLOCK_MONOTONIC, HRTIMER_MODE_R= EL); hrtimer_start(hrtimer, ms_to_ktime(wd_timer_period_ms), HRTIMER_MODE_REL_PINNED); } --=20 2.39.5 From nobody Mon Nov 25 09:17:22 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 42D4B192D63 for ; Mon, 28 Oct 2024 07:32:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100744; cv=none; b=YflL7s1j6e6BZIfFvvHPsMYuHKu2CXvCm075lfHCJDhCgqMfviL4/mYFiNVUH/mX4e+KldF+U6P7ou1hoy7i1yun53w7FLxxAcgGH5yi7VTdOp4+0l4DYzWU+V8kBUXQfWJVahq7tw6Bf5N6l/2DZJeL8hiEPvxlfAqLNEfjgQo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100744; c=relaxed/simple; bh=bkqsIoCyE3CqSdDhx7dadJrfLwphPvU3dAe3uOitme8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=KCB+79A8g1hnBIfKKeHFI/e7OtMcIn775fYOmuWUPr39pYWjmUV8Y5+NxLj5ZXXmzUvn+cQUnlUf7S8tUvm7KT2Znf+mXxX8x7qhonctofGjLu0quNLBQtMjZjp/tukogn1PNZyJMRbeRg0+CoR6jPXlv/xn/bKAiuUxSCQaJIA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=caBvsLBS; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=gBGboDw5; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="caBvsLBS"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="gBGboDw5" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730100739; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=f/bFwrQjSGVLIFbGNl9gheDznbX3lT4A2xnJTp6woys=; b=caBvsLBSuNZHOOv6Ak9Hjy3hcH80QJwywcu2t/XYHT5TqxKNV5G8by6Qs6a2kojGxwAPz+ VdcmaD13xmCPsUTqBqzmPtcKS2IRS6vmm+NHB8fips7oHh7nPfrGgpciPTUPkLCenP4niS 7tlrmwu6X04bXjDY3s86ou5vQEMTg/qUD9Unqki1PGqHeD8NPMUsZ7q4b18dRcfHuo/fgL 7lIB+FL+frqM6/5rks/0gyxY2fBHhIlCDGDkhhI3OG98JLgr/M7SIwKDIjrygD/U0XWlMd EWQJYteV97vPH7NF4olcT7ocQVJ4JA/9xmhFIhNGQRYmi4JGxqe9HqIX9rGkeg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730100739; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=f/bFwrQjSGVLIFbGNl9gheDznbX3lT4A2xnJTp6woys=; b=gBGboDw5EPF0VtdEVuqyHOAmc8K+F+LPj+4UlHI5rDJ7uNNED9tzQBeM0CVAsNHIlr8onN 2pa1txmFYrgsd4Aw== To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Andreas Hindborg , Alice Ryhl , Miguel Ojeda , Kees Cook , linux-kernel@vger.kernel.org Cc: Nam Cao , Peter Zijlstra Subject: [PATCH 11/31] perf/x86: Switch to use hrtimer_setup() Date: Mon, 28 Oct 2024 08:31:44 +0100 Message-Id: <0687a34c6cc33bd7f814b6c71c029d5cfcad0de8.1729864823.git.namcao@linutronix.de> 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: quoted-printable Content-Type: text/plain; charset="utf-8" There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function. Switch to use this new function. Patch was created by using Coccinelle. Signed-off-by: Nam Cao --- Cc: Peter Zijlstra --- arch/x86/events/intel/uncore.c | 3 +-- arch/x86/events/rapl.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/x86/events/intel/uncore.c b/arch/x86/events/intel/uncore.c index d98fac567684..1579ee33f8eb 100644 --- a/arch/x86/events/intel/uncore.c +++ b/arch/x86/events/intel/uncore.c @@ -347,8 +347,7 @@ void uncore_pmu_cancel_hrtimer(struct intel_uncore_box = *box) =20 static void uncore_pmu_init_hrtimer(struct intel_uncore_box *box) { - hrtimer_init(&box->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); - box->hrtimer.function =3D uncore_pmu_hrtimer; + hrtimer_setup(&box->hrtimer, uncore_pmu_hrtimer, CLOCK_MONOTONIC, HRTIMER= _MODE_REL); } =20 static struct intel_uncore_box *uncore_alloc_box(struct intel_uncore_type = *type, diff --git a/arch/x86/events/rapl.c b/arch/x86/events/rapl.c index a481a939862e..d072955e5930 100644 --- a/arch/x86/events/rapl.c +++ b/arch/x86/events/rapl.c @@ -264,8 +264,7 @@ static void rapl_hrtimer_init(struct rapl_pmu *pmu) { struct hrtimer *hr =3D &pmu->hrtimer; =20 - hrtimer_init(hr, CLOCK_MONOTONIC, HRTIMER_MODE_REL); - hr->function =3D rapl_hrtimer_handle; + hrtimer_setup(hr, rapl_hrtimer_handle, CLOCK_MONOTONIC, HRTIMER_MODE_REL); } =20 static void __rapl_pmu_event_start(struct rapl_pmu *pmu, --=20 2.39.5 From nobody Mon Nov 25 09:17:22 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 E174B192B7A for ; Mon, 28 Oct 2024 07:32:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100744; cv=none; b=X2zAcBxuVQPMXj4/9X+SklhFqjkrd4UaKIU5mg1BMGCAeFLK3jq15VFb9kH+xSQRK0f91/ubXkW2Ym3snmrFSpRMuBnlyK6m2ifFmkpnsUsMKlXpdIVdbpFFR1HFAEWhHVrnYTPmOWi1uM8EWYjsliW1yezuLXwZ7lfZHeoN5DQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100744; c=relaxed/simple; bh=x/4qqfVZz8UK+7KJkSqM+6cSCvj9XzwqFHCDwY0R5l4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=OIbj+33op1Z3aw+fBTFyMTnpExTGcjq0+kapEPhyEh7FLMFeL/Ed23evojxakSkvrLi/BKrlOX8XeILmXYZxK38/dJ1HJcqFxOpaeObvNn2CSJi4wjFxIWzwkKGq+Nd95IPeKLDfE00N7nAJroreuMbIu5SjI+V1e0bsUoZoRW8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=fhZWZlYu; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=bhqgYewx; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="fhZWZlYu"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="bhqgYewx" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730100740; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=j53Dvajnc3k7LMWT3g6jXPZAJLgmsTlqEmPEo0TGLY8=; b=fhZWZlYuXxwL5Wwq7pmwzRxInjpbDdJqB+qIKKPs+Vn8IyHuavyD3q83QkvWlpnKXNvUa/ Mz9XJbf3zGe8tcqvM2fJZRybekwSdaGZCMiVkLq9kyKa4U0OQQ2qxd6hZEW39F+Y1VTB7x 9H81adToqXk/Zj+GSSBBiC6EuiIeOzT2TSkGYLTcbcEy2ye/7qjUIL4UcNQQtjW0gmkcuG 46hl0vTqXQvRNgH9zggaejPAOFeJ7T4lrdFq/9Y9MzfETzjXkJLrDXw3oamGbMUysxAqt3 vQT8W3c4f6AVnGlqjKEG7im1espBMr8OyNuIlt9woLTY9EzUU/T1q0Tpeny5vg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730100740; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=j53Dvajnc3k7LMWT3g6jXPZAJLgmsTlqEmPEo0TGLY8=; b=bhqgYewxRk1yV6kitieJ0jaIMDOiSvImIOoUT39AguG1eyaEaj15CLAfmcdAxkCzpkRWu6 RHX3hQjeGXfSOoBA== To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Andreas Hindborg , Alice Ryhl , Miguel Ojeda , Kees Cook , linux-kernel@vger.kernel.org Cc: Nam Cao , Christian Borntraeger Subject: [PATCH 12/31] s390/ap_bus: Switch to use hrtimer_setup() Date: Mon, 28 Oct 2024 08:31:45 +0100 Message-Id: <868e70867e5f24da86e36aff6240b1fd9696436f.1729864823.git.namcao@linutronix.de> 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: quoted-printable Content-Type: text/plain; charset="utf-8" There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function. Switch to use this new function. Patch was created by using Coccinelle. Signed-off-by: Nam Cao --- Cc: Christian Borntraeger --- drivers/s390/crypto/ap_bus.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c index 60cea6c24349..98beb2656c3f 100644 --- a/drivers/s390/crypto/ap_bus.c +++ b/drivers/s390/crypto/ap_bus.c @@ -2327,8 +2327,7 @@ static inline int __init ap_async_init(void) */ if (MACHINE_IS_VM) poll_high_timeout =3D 1500000; - hrtimer_init(&ap_poll_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); - ap_poll_timer.function =3D ap_poll_timeout; + hrtimer_setup(&ap_poll_timer, ap_poll_timeout, CLOCK_MONOTONIC, HRTIMER_M= ODE_ABS); =20 queue_work(system_long_wq, &ap_scan_bus_work); =20 --=20 2.39.5 From nobody Mon Nov 25 09:17:22 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 C9882193091 for ; Mon, 28 Oct 2024 07:32:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100745; cv=none; b=FUkeTfBSTqcCo95p6qTpQ+t4zRk4WWDNE5SschRef5hxJ5NBbhGAUaOSgiy4OTY5laYwc+M7+9xYN0LIsHvWbIr/iF0P6gFsAHqwZfG2XSFIKXuDJ3vTLEbyqmufRVqrrPJJF3GhugVf56ZjusiWcQjwX0HrSCtRtJt7tqqCqAI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100745; c=relaxed/simple; bh=0ecXry8nQgCLZWFX+XxTBgYOSXIn55VUfnVFoUBcUFo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=mBlaj/3EdlJx70K8JZL+8bfbc/py+8frXTmfmcHyKAZb1c0q15Fh+x+eYoqH+CvX0tU5y5pEpUXUO5xuRFdkzJRI41dpCI0VbU7oIDooTL4ZTeFoZdYUKN33A9MGljUgzM8rX6YXD1OZpBRe7h60tElMtbH69Q3iQ/1d/qCswdw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=n2z1lP95; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=0fjlMWvx; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="n2z1lP95"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="0fjlMWvx" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730100740; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2hsPfc6VMYyr8r/5biFCpi3upGU+24IB6TEB4bhCneg=; b=n2z1lP95SUBbs6/SnZlt+/Thcx1w9poXMSGdpsrB2H5mX+/z4SMDhPyAz6A2Oc9NB/qhln ixaXrIHkW0x+38DGabqrtcUay5ICxd5Uv5Yhlrm5im4oYnuHCdfa37aLPgA5tjZ1UN2r+/ BCadnlooppXqIylMJVw0Khltb5+4AObY6MHPf80tmh4hrgxd9KaoVUbQkJkxTdiQk0Hp6J DgzQH1his8j7/plpPdik+eAK0wMx1a7NUcUHBfi9siY9K0O85jMqU7ZaYpjOuS9fAbPAoy VlbTieXvzBPkhRo0j0IXl+Ke2rCC5Bk7lUAwUlA4FzCZTVyJ4pjg7leutnULnQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730100740; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2hsPfc6VMYyr8r/5biFCpi3upGU+24IB6TEB4bhCneg=; b=0fjlMWvxSAmpR/tvlMHsVFPSQYzG6jswnHwfT2L2uMCje/W0BTJoK7OeKgUI5JMnxaUTZM A8k8/S1l0INhP7DQ== To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Andreas Hindborg , Alice Ryhl , Miguel Ojeda , Kees Cook , linux-kernel@vger.kernel.org Cc: Nam Cao , Peter Zijlstra Subject: [PATCH 13/31] sched: Switch to use hrtimer_setup() Date: Mon, 28 Oct 2024 08:31:46 +0100 Message-Id: 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: quoted-printable Content-Type: text/plain; charset="utf-8" There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function. Switch to use this new function. Signed-off-by: Nam Cao --- Cc: Peter Zijlstra --- kernel/sched/core.c | 3 +-- kernel/sched/deadline.c | 6 ++---- kernel/sched/fair.c | 8 ++++---- kernel/sched/rt.c | 5 ++--- 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 43e453ab7e20..b86dc57e9dcd 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -903,8 +903,7 @@ static void hrtick_rq_init(struct rq *rq) #ifdef CONFIG_SMP INIT_CSD(&rq->hrtick_csd, __hrtick_start, rq); #endif - hrtimer_init(&rq->hrtick_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_HARD); - rq->hrtick_timer.function =3D hrtick; + hrtimer_setup(&rq->hrtick_timer, hrtick, CLOCK_MONOTONIC, HRTIMER_MODE_RE= L_HARD); } #else /* CONFIG_SCHED_HRTICK */ static inline void hrtick_clear(struct rq *rq) diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index 9ce93d0bf452..cd9d68e87aa0 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -1362,8 +1362,7 @@ static void init_dl_task_timer(struct sched_dl_entity= *dl_se) { struct hrtimer *timer =3D &dl_se->dl_timer; =20 - hrtimer_init(timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_HARD); - timer->function =3D dl_task_timer; + hrtimer_setup(timer, dl_task_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_HAR= D); } =20 /* @@ -1817,8 +1816,7 @@ static void init_dl_inactive_task_timer(struct sched_= dl_entity *dl_se) { struct hrtimer *timer =3D &dl_se->inactive_timer; =20 - hrtimer_init(timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_HARD); - timer->function =3D inactive_task_timer; + hrtimer_setup(timer, inactive_task_timer, CLOCK_MONOTONIC, HRTIMER_MODE_R= EL_HARD); } =20 #define __node_2_dle(node) \ diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 225b31aaee55..c82ada095bca 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -6576,14 +6576,14 @@ void init_cfs_bandwidth(struct cfs_bandwidth *cfs_b= , struct cfs_bandwidth *paren cfs_b->hierarchical_quota =3D parent ? parent->hierarchical_quota : RUNTI= ME_INF; =20 INIT_LIST_HEAD(&cfs_b->throttled_cfs_rq); - hrtimer_init(&cfs_b->period_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_PINN= ED); - cfs_b->period_timer.function =3D sched_cfs_period_timer; + hrtimer_setup(&cfs_b->period_timer, sched_cfs_period_timer, CLOCK_MONOTON= IC, + HRTIMER_MODE_ABS_PINNED); =20 /* Add a random offset so that timers interleave */ hrtimer_set_expires(&cfs_b->period_timer, get_random_u32_below(cfs_b->period)); - hrtimer_init(&cfs_b->slack_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); - cfs_b->slack_timer.function =3D sched_cfs_slack_timer; + hrtimer_setup(&cfs_b->slack_timer, sched_cfs_slack_timer, CLOCK_MONOTONIC, + HRTIMER_MODE_REL); cfs_b->slack_started =3D false; } =20 diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index 172c588de542..082e3970dc18 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c @@ -127,9 +127,8 @@ void init_rt_bandwidth(struct rt_bandwidth *rt_b, u64 p= eriod, u64 runtime) =20 raw_spin_lock_init(&rt_b->rt_runtime_lock); =20 - hrtimer_init(&rt_b->rt_period_timer, CLOCK_MONOTONIC, - HRTIMER_MODE_REL_HARD); - rt_b->rt_period_timer.function =3D sched_rt_period_timer; + hrtimer_setup(&rt_b->rt_period_timer, sched_rt_period_timer, CLOCK_MONOTO= NIC, + HRTIMER_MODE_REL_HARD); } =20 static inline void do_start_rt_bandwidth(struct rt_bandwidth *rt_b) --=20 2.39.5 From nobody Mon Nov 25 09:17:22 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 C97F519308C for ; Mon, 28 Oct 2024 07:32:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100745; cv=none; b=e9PVxTKCwqEowQ+orM8Gp6jzGSBb16VgmzYHUvt++ZWKiY0sH3iyihR20dnzLzXSAcs8eZeHrFKZ/ELW0HDJTPgto3IQMuqtnBeKksLS/9H8OkWrNtnWlN8rsPMI2P/wk0/cHoSHqtcgj+KJ+xetEpzGnULla6TIxtzXInej7so= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100745; c=relaxed/simple; bh=DfHnjs0zRp77LMFhFnQjrRmXjAyDlcatya5U1zQD+z4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=kNfV8mbdh1YLFYhsNoI/v/dFPNBF4++MDMDg8hsq3ZIbkYPijTjF02VdF71VHLRqXkzSdAv82ut9vYXzhXY3V7HDAr+E6IkJVPHo/0eI7SGVurD6QSSRHXFuXFtGhp1JTsM9Q/uGn3MlHfFdrkmAhywRZbar4lTT6D6QJElm4o8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=AB7/brsO; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=lYCXeFyu; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="AB7/brsO"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="lYCXeFyu" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730100741; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LYDkJHwStlxtqgAaPv1XWIrF0br6yxUQpyGRGxVNX1A=; b=AB7/brsOOZashvaJvWjcHNsQi8e4ViQmrqoscqmASYO81a5sKQdplF6TaFO9rxfl6WCIcZ UpdXIxZ/+SzLs31ddruQzAaaKubkf2lgSXjoHD+77ajOfYTZMiNVaZ3UlWyGucLTd7C47O 4voDyey+PNfQSkHtqkyCYC9xundMtr41FxnycFdGEw5CJlBcjqHny4Ty8OEUxuIandz4G/ DhmwOUUKM8Yu96zi90KG0LVJBGyv/isjSe71lN8lBsiFh4/LFjdEJ4nsE/nm9WMHKGfvLt N9TlRBuwhRiRxzTDHemirDZUlbYRzthNdtVWkg3Br0qR/mBvYXh37qc92p7UNA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730100741; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LYDkJHwStlxtqgAaPv1XWIrF0br6yxUQpyGRGxVNX1A=; b=lYCXeFyuJxV1cM6MbN5yT79IgPeG5AdOJaj4HYxxJMFBh4/b/Afa97H5xejA1bF/fHMCBy bK642+60bJAuiTBA== To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Andreas Hindborg , Alice Ryhl , Miguel Ojeda , Kees Cook , linux-kernel@vger.kernel.org Cc: Nam Cao , "Paul E. McKenney" Subject: [PATCH 14/31] rcu: Switch to use hrtimer_setup() Date: Mon, 28 Oct 2024 08:31:47 +0100 Message-Id: <4c07452c5f64a4e44158d74d27ad0693b9f20ffe.1729864823.git.namcao@linutronix.de> 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: quoted-printable Content-Type: text/plain; charset="utf-8" There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function. Switch to use this new function. Patch was created by using Coccinelle. Signed-off-by: Nam Cao Reviewed-by: Paul E. McKenney --- Cc: "Paul E. McKenney" --- kernel/rcu/tree.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index a60616e69b66..686c4bdbd62e 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -3701,8 +3701,8 @@ run_page_cache_worker(struct kfree_rcu_cpu *krcp) &krcp->page_cache_work, msecs_to_jiffies(rcu_delay_page_cache_fill_msec)); } else { - hrtimer_init(&krcp->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); - krcp->hrtimer.function =3D schedule_page_work_fn; + hrtimer_setup(&krcp->hrtimer, schedule_page_work_fn, CLOCK_MONOTONIC, + HRTIMER_MODE_REL); hrtimer_start(&krcp->hrtimer, 0, HRTIMER_MODE_REL); } } --=20 2.39.5 From nobody Mon Nov 25 09:17:22 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 83F441D9A43 for ; Mon, 28 Oct 2024 07:32:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100746; cv=none; b=deff8rMu51lnjYUihqR3bO9rd5gz/TW2sJ5b8Tf1SZJNwGZSPLwBcSgLvUaKOWdZRQ0stOHF4OSBp7cmrA/IC9YJSTMCiCUbnBZvfRZC7J/fpz0Y5KZKvVFEkE8/nMSj9A0AT5HsQokfk70GcJbfT0DfUGEn+0h4ygYPaB0rPqI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100746; c=relaxed/simple; bh=pBPcBdVdcXr6X8+Bd1rD+OFstKHVX3SZ/1x9RfOtVjQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=EMoCa8Qmir8Yn50wcl28Zh9II+l19fa69ycFZ5qJK7yFfDi80ZNbCQYVf+JDYz0W9e/qbxQk4wPas3R04ewrMgTy/B4FxL+APw/5jCzhWzoKioWcRXvQIQpc+j5f1PovjLxr9oy0ujCzfcjInanaA/ojJ6ocUhMj0UJMnBnPDfg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=3GsM0Id4; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=Ad4MP629; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="3GsM0Id4"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Ad4MP629" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730100741; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=E0YTJ4rNcKrR8odEM+5Vgl9rVPk6+FQbqrJCGZPG1E8=; b=3GsM0Id4iZ1D7Wc9Vki5NlJgO1LyNyNf2V5IXQWQv59ITxVMZlLpjxhTQGOXAQ2G9AMo2W Uod/yIO9BM+RtUGRgAQJKqzpA09H1sxaan//03S8KxjITYneGEt66yLBTaGFTKl9hfaCug RhQ2oqhUmaQYDu8UkR651eeS4MzoleUIV9QqS3mLHu5+HboNrPJ7WJdj4rBak9PmVSEAqA iwddDpPewNtyEGxHsVaMFES5pkHIqwkBxfhTg5VkWtxRmpLwDml8Aoz5suAksiWY66y9R5 4PAFHgDRxoiQsp00U0NjCugiUDQRZ8DSZ1gRlWrbAMzYBqqzum1WsXW3ZrSLrg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730100741; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=E0YTJ4rNcKrR8odEM+5Vgl9rVPk6+FQbqrJCGZPG1E8=; b=Ad4MP629P/JQy5mUoHc6yzto1eEknlIMn9QO7C/j0Idl36jnoy0fzQqy4AhG4ZO4FkKaVA 0XjtSemoGg/9RFBw== To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Andreas Hindborg , Alice Ryhl , Miguel Ojeda , Kees Cook , linux-kernel@vger.kernel.org Cc: Nam Cao , Andrew Morton Subject: [PATCH 15/31] lib: test_objpool: Switch to use hrtimer_setup() Date: Mon, 28 Oct 2024 08:31:48 +0100 Message-Id: <01ff5361b87371fabf5dfd4a9f9f1e5a30894193.1729864823.git.namcao@linutronix.de> 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: quoted-printable Content-Type: text/plain; charset="utf-8" There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function. Switch to use this new function. Patch was created by using Coccinelle. Signed-off-by: Nam Cao --- Cc: Andrew Morton --- lib/test_objpool.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/test_objpool.c b/lib/test_objpool.c index 5a3f6961a70f..89db1933eb41 100644 --- a/lib/test_objpool.c +++ b/lib/test_objpool.c @@ -190,8 +190,7 @@ static int ot_init_hrtimer(struct ot_item *item, unsign= ed long hrtimer) return -ENOENT; =20 item->hrtcycle =3D ktime_set(0, hrtimer * 1000000UL); - hrtimer_init(hrt, CLOCK_MONOTONIC, HRTIMER_MODE_REL); - hrt->function =3D ot_hrtimer_handler; + hrtimer_setup(hrt, ot_hrtimer_handler, CLOCK_MONOTONIC, HRTIMER_MODE_REL); return 0; } =20 --=20 2.39.5 From nobody Mon Nov 25 09:17:22 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 83E811D9A41 for ; Mon, 28 Oct 2024 07:32:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100747; cv=none; b=C1EXURS+JeWbdr8szXNvqFWTYruxXJjPq/I8OpR6NqfnC2PTMBeeGeyPHpVgY65oaXa2uG2hcW8aWOLTTryfkt5FXXftLuNlZqu2YN6mSKVGT+OHwfEojszbhass+YNx96ETZTa/Kk/3kwrMTz3UUVgV/HURkyE14jneZHaOB8I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100747; c=relaxed/simple; bh=CYN2F4nmYOv1X5ETWaW+HtQmDogIdnj83TRshJhjxOg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=jyHc3cQtDkVwxDXe3wO47VGCiTjo/1ZaPqSpWJscvx0+IYE6X5l8QvysRLyCgC2pnZ9upOc6VY2aKVTsbjQzJd/z+TcXgKgs/FgF91WNX0dhuQC+8q5/ASVanHlW8Cqb0SyHrviZdCw5DJFz9jko2Y0YUtn5eJbXWRCGBBzdKvA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=x/CAwXhl; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=2PzDTKpg; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="x/CAwXhl"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="2PzDTKpg" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730100741; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=G7bpCQiI2JfjFnV7/EMF4stz4GlAScPSQTmIH11qGxw=; b=x/CAwXhlL8lGBbyTbC5mSCD+azuHF67u+M9KfXytVrY5ROn7kYlzv2AFghA/apygwzrzys a9jDbybf1LNsoc5SXso8m4W7tmTf/8j8oFPiWoCOurMrfnWhkScLYpSWm1ktsGAz/jmoGk +PA13Ttf2sJY2rAxoP0CsdHxVC80OGO0wf9N9Wv+MMp1ryBV3/jbIq9/n15IR1n0ZCu+Mb 9oEXSk5fozMKt/q+dO3uU6nqMEwsLqKXYcrJKhCc4UXF2+YhBZ1Cl9wLaa6REtLpFYwO7G rezIcq9Mfskqa/+7BQtZQYOirKG0yZxUdIfkkqYDFKRmPACseK2lcq91fgSXLA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730100741; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=G7bpCQiI2JfjFnV7/EMF4stz4GlAScPSQTmIH11qGxw=; b=2PzDTKpgh1ftKdN8ocu2Jcx9hsrqDcyUrru+H6StSG3Qn0XXr9jVEMRjqnVh+7C7yedZ2B tQbdEZkJKk7FfuCQ== To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Andreas Hindborg , Alice Ryhl , Miguel Ojeda , Kees Cook , linux-kernel@vger.kernel.org Cc: Nam Cao , Jens Axboe Subject: [PATCH 16/31] io_uring/timeout: Switch to use hrtimer_setup() Date: Mon, 28 Oct 2024 08:31:49 +0100 Message-Id: <8bc0762e419b6fd1d0a0da31a187d19826d71187.1729864823.git.namcao@linutronix.de> 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: quoted-printable Content-Type: text/plain; charset="utf-8" There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function. Switch to use the new function. This new function is also used to initialize the callback function in .prep() (the callback function depends on whether it is IORING_OP_TIMEOUT or IORING_OP_LINK_TIMEOUT). Thus, callback function setup in io_timeout() and io_queue_linked_timeout() are now redundant, therefore remove them. Signed-off-by: Nam Cao --- Cc: Jens Axboe --- io_uring/timeout.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/io_uring/timeout.c b/io_uring/timeout.c index 2ffe5e1dc68a..a4165e54238b 100644 --- a/io_uring/timeout.c +++ b/io_uring/timeout.c @@ -388,8 +388,7 @@ static int io_linked_timeout_update(struct io_ring_ctx = *ctx, __u64 user_data, io =3D req->async_data; if (hrtimer_try_to_cancel(&io->timer) =3D=3D -1) return -EALREADY; - hrtimer_init(&io->timer, io_timeout_get_clock(io), mode); - io->timer.function =3D io_link_timeout_fn; + hrtimer_setup(&io->timer, io_link_timeout_fn, io_timeout_get_clock(io), m= ode); hrtimer_start(&io->timer, timespec64_to_ktime(*ts), mode); return 0; } @@ -409,8 +408,7 @@ static int io_timeout_update(struct io_ring_ctx *ctx, _= _u64 user_data, timeout->off =3D 0; /* noseq */ data =3D req->async_data; list_add_tail(&timeout->list, &ctx->timeout_list); - hrtimer_init(&data->timer, io_timeout_get_clock(data), mode); - data->timer.function =3D io_timeout_fn; + hrtimer_setup(&data->timer, io_timeout_fn, io_timeout_get_clock(data), mo= de); hrtimer_start(&data->timer, timespec64_to_ktime(*ts), mode); return 0; } @@ -537,7 +535,6 @@ static int __io_timeout_prep(struct io_kiocb *req, return -EINVAL; =20 data->mode =3D io_translate_timeout_mode(flags); - hrtimer_init(&data->timer, io_timeout_get_clock(data), data->mode); =20 if (is_timeout_link) { struct io_submit_link *link =3D &req->ctx->submit_state.link; @@ -548,6 +545,10 @@ static int __io_timeout_prep(struct io_kiocb *req, return -EINVAL; timeout->head =3D link->last; link->last->flags |=3D REQ_F_ARM_LTIMEOUT; + hrtimer_setup(&data->timer, io_link_timeout_fn, io_timeout_get_clock(dat= a), + data->mode); + } else { + hrtimer_setup(&data->timer, io_timeout_fn, io_timeout_get_clock(data), d= ata->mode); } return 0; } @@ -607,7 +608,6 @@ int io_timeout(struct io_kiocb *req, unsigned int issue= _flags) } add: list_add(&timeout->list, entry); - data->timer.function =3D io_timeout_fn; hrtimer_start(&data->timer, timespec64_to_ktime(data->ts), data->mode); spin_unlock_irq(&ctx->timeout_lock); return IOU_ISSUE_SKIP_COMPLETE; @@ -626,7 +626,6 @@ void io_queue_linked_timeout(struct io_kiocb *req) if (timeout->head) { struct io_timeout_data *data =3D req->async_data; =20 - data->timer.function =3D io_link_timeout_fn; hrtimer_start(&data->timer, timespec64_to_ktime(data->ts), data->mode); list_add_tail(&timeout->list, &ctx->ltimeout_list); --=20 2.39.5 From nobody Mon Nov 25 09:17:22 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 D00BD1D9A65 for ; Mon, 28 Oct 2024 07:32:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100749; cv=none; b=oTAo79qEzCdPGs3ALMKyorPBfRCLpYzBqgn59iPpJmPfb0FtWtt/QXYEF9YKAM/g9o1h6q1oGdplylqoOyydwFyhWa+NIUvbMjmN6a7RUUkE6AgAGs+cWnuJTqOII1KL3ITcDuSnAFqPemn62NUUPwaAgUtiKJq6/ZdyRdPr+xk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100749; c=relaxed/simple; bh=Ew+TKsZ3uXdb1xQGbj+3wauKU40de7RZ2fzPnuiA6o8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ZzjuLmQ5stqrshYzVPMwLMo4RLOAIYqPm098IKxvP6X6fNR79QCcdDHc4CxZt4FZowJuERVYpEmU3yYMeyTMQtEIA1ooffB21R6uO+nOnRRO/bnIxCEIhB6Zng9UVUEsKWh3hQ41OkSj2ideirfq134XvgBjcCBBbhXG1s/ssxE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=gN1SIfI4; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=XKAzwu9U; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="gN1SIfI4"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="XKAzwu9U" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730100742; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=I7kFf9pAcvdmeBgd8q5rvVb62slmZ5vf490qFQNjGiY=; b=gN1SIfI4D6WO46H2xv9myHRS06FeIal+xkTHJTONyafiZuBDUDJ7MYO1l2OAiEW+uZpbeG 5+FKUq3MBD0E00uc/EC/+QS7QS2qNgte3FyKTfOs3qmmBrv96JzBksfnfubSSafW7IBbW5 VCwAKIBWE+fNnCyJY3gHoSJdLmwtJd8OWLo0HgVDCbhKAnusuKOKQ5LY6ozpFGrI+9rU7n 6LOOFm5+zXJekvWuMsnyXoTirsDxXAgI8q+qXJBZ15USXOOcU9Q75xsD333OZQTc7f8/wk aAPtlYVbKQUQq9IF+d7CWpBE/y0JcjN3EK+lI99LgAxY9r1wu2j55KT5pClb4A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730100742; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=I7kFf9pAcvdmeBgd8q5rvVb62slmZ5vf490qFQNjGiY=; b=XKAzwu9UVTVOFcw/KrpKD0twPlDiVolNoUjiy9uxyTKLYeKVidRSA++4ggMQ3c5ZIZwDEs CUSLeFd9ch22FpBQ== To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Andreas Hindborg , Alice Ryhl , Miguel Ojeda , Kees Cook , linux-kernel@vger.kernel.org Cc: Nam Cao , Oleg Nesterov Subject: [PATCH 17/31] fork: Switch to use hrtimer_setup() Date: Mon, 28 Oct 2024 08:31:50 +0100 Message-Id: <83e8fe18090bd092f2ea022a053ae8be2edefefd.1729864823.git.namcao@linutronix.de> 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: quoted-printable Content-Type: text/plain; charset="utf-8" There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function. Switch to use this new function. Patch was created by using Coccinelle. Signed-off-by: Nam Cao --- Cc: Oleg Nesterov --- kernel/fork.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/kernel/fork.c b/kernel/fork.c index 60c0b4868fd4..9a2e1905232f 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -1864,8 +1864,7 @@ static int copy_signal(unsigned long clone_flags, str= uct task_struct *tsk) =20 #ifdef CONFIG_POSIX_TIMERS INIT_HLIST_HEAD(&sig->posix_timers); - hrtimer_init(&sig->real_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); - sig->real_timer.function =3D it_real_fn; + hrtimer_setup(&sig->real_timer, it_real_fn, CLOCK_MONOTONIC, HRTIMER_MODE= _REL); #endif =20 task_lock(current->group_leader); --=20 2.39.5 From nobody Mon Nov 25 09:17:22 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 D019B1D9A70 for ; Mon, 28 Oct 2024 07:32:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100747; cv=none; b=VNj6XGzSSN5R05M+DPc7nKA66447Hx4Y/7lcRoTM0X6Qmwsk/J3ZPdxhzxa+36l8wpxnHvynvWzCnYS2IjsjVG8YCC8vHfvZFaoj29U//7vuq5NbeztsWky+43lFRQIvTwkxprHGnTiio7hnksPtzVVLoA1MuL9YCIaZUJtfWe4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100747; c=relaxed/simple; bh=nQkCZ0QeSqwArx6zMrnw3mGTzEtMAXDHMaORDcyFTtU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=R6gtgS1d2uJDxEdcEI98Zqj+eTElbbiriJAt2g1stz/qrqKa3iXAzm1Ebhsh1++NSTLQmGEt0zlm712w+KVOTEjrmMa259edtMpPoBqsYAw6bs9+nlV6RMlZ+0hSzNnaINM2Phe7yLfu4yIMuzoU8YezdiQTwK5OmRUflhT26bk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=mZK2ibLO; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=/E1eEpDR; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="mZK2ibLO"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="/E1eEpDR" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730100742; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tI8GMXx99SYylXxSswRZGqbleLEadn1lRz6gImUuT2Y=; b=mZK2ibLOFu1sMeHJMSqqMTx4bedygVIoNlCrGxTuvnPpKGlzANApy2vzjcgpVBqtgxjwIN f9+Os8UPkoM29PfIM0Z7m6AlyYf/pYem6fCAiJz44cXn+RDRmzHg6c8N7OyC0M5epDJO8P HlRTdcbCOhQlmZbRcWBzz7KOFXcsnYY2+ic4TfFxV4udhrenZr6gp8iwkZVwEoRrJF+w2I RtnYKHigbXdVjbl85GgHs14Pdqn6Jw2rNa3cfgzpIHp2ysRIu+SDSxfUk7CrNrCpS8SRbb RbbtoJqymwpvtrF4BIN4vb0fSa3B/lKdfij7FffNpvCSCHWTA8ZXhv0ea3Y93Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730100742; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tI8GMXx99SYylXxSswRZGqbleLEadn1lRz6gImUuT2Y=; b=/E1eEpDRn1j+7/4dFpD5Hecwj8WY1r1kBMUj94PEvfB7AjgdbE36PGSfHOkq7Mn2Mz5XPU XLNDwSk/37JWNlAQ== To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Andreas Hindborg , Alice Ryhl , Miguel Ojeda , Kees Cook , linux-kernel@vger.kernel.org Cc: Nam Cao , Peter Zijlstra Subject: [PATCH 18/31] perf: Switch to use hrtimer_setup() Date: Mon, 28 Oct 2024 08:31:51 +0100 Message-Id: <432209f20747fba448f80a10b5cc776536ac490b.1729864823.git.namcao@linutronix.de> 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: quoted-printable Content-Type: text/plain; charset="utf-8" There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function. Switch to use this new function. Patch was created by using Coccinelle. Signed-off-by: Nam Cao --- Cc: Peter Zijlstra --- kernel/events/core.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/kernel/events/core.c b/kernel/events/core.c index e3589c4287cb..a4d0d7b0311f 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -1151,8 +1151,8 @@ static void __perf_mux_hrtimer_init(struct perf_cpu_p= mu_context *cpc, int cpu) cpc->hrtimer_interval =3D ns_to_ktime(NSEC_PER_MSEC * interval); =20 raw_spin_lock_init(&cpc->hrtimer_lock); - hrtimer_init(timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_PINNED_HARD); - timer->function =3D perf_mux_hrtimer_handler; + hrtimer_setup(timer, perf_mux_hrtimer_handler, CLOCK_MONOTONIC, + HRTIMER_MODE_ABS_PINNED_HARD); } =20 static int perf_mux_hrtimer_restart(struct perf_cpu_pmu_context *cpc) @@ -11273,8 +11273,7 @@ static void perf_swevent_init_hrtimer(struct perf_e= vent *event) if (!is_sampling_event(event)) return; =20 - hrtimer_init(&hwc->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_HARD); - hwc->hrtimer.function =3D perf_swevent_hrtimer; + hrtimer_setup(&hwc->hrtimer, perf_swevent_hrtimer, CLOCK_MONOTONIC, HRTIM= ER_MODE_REL_HARD); =20 /* * Since hrtimers have a fixed rate, we can do a static freq->period --=20 2.39.5 From nobody Mon Nov 25 09:17:22 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 E95631DA100 for ; Mon, 28 Oct 2024 07:32:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100748; cv=none; b=qloqbERKMEKFYTOyePIlAgbIs0JOgRxja4evSEkaBTfTjunoaVHCDzHux75N6AOJcic05X1IV+f8eroBVwfA4k48ZdyG3t2UwJECNgEN2/nrd9z1aW46h48yOT5u3E0xJY9SbIBAgEm4quHqcnaOt1+mYbcCZeEiti6H7owY73A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100748; c=relaxed/simple; bh=smHFkqsz3mw1mDZYwEhWupekt1AIYFjkWHBFa6NC69U=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=RG/ssroU4hr9cS6l0TW28/z59Ia5Q2RRzBG8Dx8Sfzt0S0VRDgtu1yD4/ugV23/OKb83S1x4uAkRdc7qxmhU/Q56AoJIrcRKQVhl5ZCE4skJeBbda/xAgllQJWXYF1JeUFrf/pT0htyTLpaxGLU0i16BYf/jsYnKJ/ueOYjD/mE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=uPKByuFy; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=dPzTHwAP; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="uPKByuFy"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="dPzTHwAP" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730100742; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7Z9eNHLYeEy7Ewiv3AXJ5/PjzpzROuY0tnmMn4YrxhM=; b=uPKByuFy8eQA5q6FZkkpPZYrQOAXxjp7KtRGY3m4d5EqHMRHEXWO3YubzAmQo/vcRPOdDS ch6t9gbtixJ+Ba8Qq/scI1CI2mC4ygQkkzbPLs31HRV86en5PqsLunLzMYy/Bw0vudiFP3 aAaAu248rOZduD013uoIyCfTBmhuBV10n6EkV7ONjyX+xV3uY3MzbK7QbO2NV/gRgRA1ky TeRG+8koZlKrSVm+coyYImSWnmC8YwJl8N39APNk/luU7+VBUOf8Dsf8YRsC42p1cVuaz5 dX832jHji6C3RGyCTK3n6MKRJj9PUmsS70yDB5AfcIcPFz+CCwf+thl4Ubsv6g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730100742; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7Z9eNHLYeEy7Ewiv3AXJ5/PjzpzROuY0tnmMn4YrxhM=; b=dPzTHwAPlJ5PR0o/inpR9cRDEqbn02QRO+yW7MFpDPqEHg1kFFfnESmdkThcw/7ivyHUFn cEHDqE2H9XJmXLDg== To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Andreas Hindborg , Alice Ryhl , Miguel Ojeda , Kees Cook , linux-kernel@vger.kernel.org Cc: Nam Cao , Christian Brauner Subject: [PATCH 19/31] timerfd: Switch to use hrtimer_setup() Date: Mon, 28 Oct 2024 08:31:52 +0100 Message-Id: <5155e89593a311901e2bc2fb3a72f7fbfea2fb57.1729864823.git.namcao@linutronix.de> 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: quoted-printable Content-Type: text/plain; charset="utf-8" There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function. Switch to use this new function. Signed-off-by: Nam Cao --- Cc: Christian Brauner --- fs/timerfd.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fs/timerfd.c b/fs/timerfd.c index 137523e0bb21..c57ebced16bf 100644 --- a/fs/timerfd.c +++ b/fs/timerfd.c @@ -207,9 +207,8 @@ static int timerfd_setup(struct timerfd_ctx *ctx, int f= lags, ALARM_REALTIME : ALARM_BOOTTIME, timerfd_alarmproc); } else { - hrtimer_init(&ctx->t.tmr, clockid, htmode); + hrtimer_setup(&ctx->t.tmr, timerfd_tmrproc, clockid, htmode); hrtimer_set_expires(&ctx->t.tmr, texp); - ctx->t.tmr.function =3D timerfd_tmrproc; } =20 if (texp !=3D 0) { @@ -444,7 +443,7 @@ SYSCALL_DEFINE2(timerfd_create, int, clockid, int, flag= s) ALARM_REALTIME : ALARM_BOOTTIME, timerfd_alarmproc); else - hrtimer_init(&ctx->t.tmr, clockid, HRTIMER_MODE_ABS); + hrtimer_setup(&ctx->t.tmr, timerfd_tmrproc, clockid, HRTIMER_MODE_ABS); =20 ctx->moffs =3D ktime_mono_to_real(0); =20 --=20 2.39.5 From nobody Mon Nov 25 09:17:22 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 F12E11DA109 for ; Mon, 28 Oct 2024 07:32:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100748; cv=none; b=QTT7+/mJ6uGdx1UTApdxKm4m6ZUQOzIfeYx91/kRSwtgSC3gqYmd00oKHfXGPxjqadYCcl/ueuQZ20Qk7m7yrLgC2zPUZ9xCpgiIkyhbQY+IpyjADvBOwPeePIw9smf4KF34xzp+TLyAiWgO4F/Ta5LnjtSn9/SXC6Oqrerp+4I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100748; c=relaxed/simple; bh=R/JV9EZmAnsOfvYNISqRPW34yAoYN0tB9a88AkngsXM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=gg4oh9OHJ5nQ8B1nLWweLqbAIDyjQQ0gXVeGfUw2KqdvFNWDv8UVtg70TMVrqyHofKFae/MQaSi84nS1slkxXfGpdS7R5w3DSl4FGxfgqJVLjV1/+BFEu6WcnZV807fN7IyCM7GZEfQmJ9hltQ4nkWiks/6B1Q16kZz81K3+ETM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=b5CFTuhA; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=VHzhmV+U; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="b5CFTuhA"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="VHzhmV+U" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730100743; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GDwyCLcsjSW0TN6AweNduUtpoLabOWtIspLAF0L+hZY=; b=b5CFTuhAgLScM/fgLykEN98jNcu5x/IF8cWvmu5txrUA1xoHcpSk/yZto/uSTs81voJ4TR OwznVXfiZImro9mc+zKv5Svi7eZPkDWbG19jNaZjN0dw0u4oGTqnxUh6eArRMWOpNKuikR ZQ7tluRpzbpv+Tq/zF1Fvdc2htUYkURuk/uKIQplMk4IzKu8pN1azGHBQHJPcfDuMC2m6h TIRdFxC+KXGvvSXUuSy3j3DWjp+qUBtIiNCNf/vyhVXOU03XWh0Bsxtg/O4bRXkrQut4RX BOyiBQkUmiNtN5jHl1OPLl2DAky5HbodxxsXne8jeRwgok/9TrmvSjOaJZvV6A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730100743; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GDwyCLcsjSW0TN6AweNduUtpoLabOWtIspLAF0L+hZY=; b=VHzhmV+UPwrhEkP3yH9GJJ9APCbPP0uiyZbUfycUCKnkoPzh0+wW2+ZE3BuGaGbe5/7VTs T7cMVHSroDVW/LBg== To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Andreas Hindborg , Alice Ryhl , Miguel Ojeda , Kees Cook , linux-kernel@vger.kernel.org Cc: Nam Cao , John Stultz Subject: [PATCH 20/31] time: Switch to hrtimer_setup() Date: Mon, 28 Oct 2024 08:31:53 +0100 Message-Id: <219ac422c7baf22e194e79d651cf1443f11d6b8c.1729864823.git.namcao@linutronix.de> 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: quoted-printable Content-Type: text/plain; charset="utf-8" There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function. Switch to use this new function. Signed-off-by: Nam Cao --- Cc: John Stultz --- kernel/time/ntp.c | 3 +-- kernel/time/posix-timers.c | 7 +++---- kernel/time/sched_clock.c | 3 +-- kernel/time/tick-broadcast-hrtimer.c | 3 +-- kernel/time/tick-sched.c | 6 ++---- 5 files changed, 8 insertions(+), 14 deletions(-) diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c index b550ebe0f03b..577e11d1b191 100644 --- a/kernel/time/ntp.c +++ b/kernel/time/ntp.c @@ -678,8 +678,7 @@ void ntp_notify_cmos_timer(bool offset_set) =20 static void __init ntp_init_cmos_sync(void) { - hrtimer_init(&sync_hrtimer, CLOCK_REALTIME, HRTIMER_MODE_ABS); - sync_hrtimer.function =3D sync_timer_callback; + hrtimer_setup(&sync_hrtimer, sync_timer_callback, CLOCK_REALTIME, HRTIMER= _MODE_ABS); } #else /* CONFIG_GENERIC_CMOS_UPDATE) || defined(CONFIG_RTC_SYSTOHC) */ static inline void __init ntp_init_cmos_sync(void) { } diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c index fc40dacabe78..f3acb16d6254 100644 --- a/kernel/time/posix-timers.c +++ b/kernel/time/posix-timers.c @@ -430,7 +430,7 @@ static void posix_timer_unhash_and_free(struct k_itimer= *tmr) =20 static int common_timer_create(struct k_itimer *new_timer) { - hrtimer_init(&new_timer->it.real.timer, new_timer->it_clock, 0); + hrtimer_setup(&new_timer->it.real.timer, posix_timer_fn, new_timer->it_cl= ock, 0); return 0; } =20 @@ -784,7 +784,7 @@ static void common_hrtimer_arm(struct k_itimer *timr, k= time_t expires, /* * Posix magic: Relative CLOCK_REALTIME timers are not affected by * clock modifications, so they become CLOCK_MONOTONIC based under the - * hood. See hrtimer_init(). Update timr->kclock, so the generic + * hood. See hrtimer_setup(). Update timr->kclock, so the generic * functions which use timr->kclock->clock_get_*() work. * * Note: it_clock stays unmodified, because the next timer_set() might @@ -793,8 +793,7 @@ static void common_hrtimer_arm(struct k_itimer *timr, k= time_t expires, if (timr->it_clock =3D=3D CLOCK_REALTIME) timr->kclock =3D absolute ? &clock_realtime : &clock_monotonic; =20 - hrtimer_init(&timr->it.real.timer, timr->it_clock, mode); - timr->it.real.timer.function =3D posix_timer_fn; + hrtimer_setup(&timr->it.real.timer, posix_timer_fn, timr->it_clock, mode); =20 if (!absolute) expires =3D ktime_add_safe(expires, timer->base->get_time()); diff --git a/kernel/time/sched_clock.c b/kernel/time/sched_clock.c index 68d6c1190ac7..39017f1f8486 100644 --- a/kernel/time/sched_clock.c +++ b/kernel/time/sched_clock.c @@ -249,8 +249,7 @@ void __init generic_sched_clock_init(void) * Start the timer to keep sched_clock() properly updated and * sets the initial epoch. */ - hrtimer_init(&sched_clock_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_HARD); - sched_clock_timer.function =3D sched_clock_poll; + hrtimer_setup(&sched_clock_timer, sched_clock_poll, CLOCK_MONOTONIC, HRTI= MER_MODE_REL_HARD); hrtimer_start(&sched_clock_timer, cd.wrap_kt, HRTIMER_MODE_REL_HARD); } =20 diff --git a/kernel/time/tick-broadcast-hrtimer.c b/kernel/time/tick-broadc= ast-hrtimer.c index e28f9210f8a1..a88b72b0f35e 100644 --- a/kernel/time/tick-broadcast-hrtimer.c +++ b/kernel/time/tick-broadcast-hrtimer.c @@ -100,7 +100,6 @@ static enum hrtimer_restart bc_handler(struct hrtimer *= t) =20 void tick_setup_hrtimer_broadcast(void) { - hrtimer_init(&bctimer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_HARD); - bctimer.function =3D bc_handler; + hrtimer_setup(&bctimer, bc_handler, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_HAR= D); clockevents_register_device(&ce_broadcast_hrtimer); } diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 753a184c7090..bcea3a9fe638 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c @@ -1572,12 +1572,10 @@ void tick_setup_sched_timer(bool hrtimer) struct tick_sched *ts =3D this_cpu_ptr(&tick_cpu_sched); =20 /* Emulate tick processing via per-CPU hrtimers: */ - hrtimer_init(&ts->sched_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_HARD); + hrtimer_setup(&ts->sched_timer, tick_nohz_handler, CLOCK_MONOTONIC, HRTIM= ER_MODE_ABS_HARD); =20 - if (IS_ENABLED(CONFIG_HIGH_RES_TIMERS) && hrtimer) { + if (IS_ENABLED(CONFIG_HIGH_RES_TIMERS) && hrtimer) tick_sched_flag_set(ts, TS_FLAG_HIGHRES); - ts->sched_timer.function =3D tick_nohz_handler; - } =20 /* Get the next period (per-CPU) */ hrtimer_set_expires(&ts->sched_timer, tick_init_jiffy_update()); --=20 2.39.5 From nobody Mon Nov 25 09:17:22 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 702001DA2E5 for ; Mon, 28 Oct 2024 07:32:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100748; cv=none; b=e5HVVRpo8iBIrH4VcOCvy5aVC2AFR4UPHtGBDuRK6KeDsgnlpszfEA8+iIVJrnFG1ZsBb3YBRioM1SFpSUZQ/XBuU+sXhGhz1hztwL364tLk1nVrVjEoqgh2S2rWQURwJmPmkYKQr86zHJC8DKArmzSNPLK7UgHnbI5KJIurWAA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100748; c=relaxed/simple; bh=pLxhj5bKMX4bcctwIPGHD0uwceLobFGtNcrfedOzlEI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=hjth78hwOAhk7gtuzJPgveeJSzR2NpdBRY7scEJgn0WW8QrktzaI2keQYlQYAYNOTRrSGrC7uc1Ye7l5CFxwj04pfLY+IDdgMmN7rGsbMuMcIm06XvTn6OMiV5IjeRGDDsVC5YiJ27/4tb7AQ0d/IN9cc66YdtCEMUEZUslsWNM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=z/CH1ake; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=xBSSkSda; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="z/CH1ake"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="xBSSkSda" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730100743; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zjWG6LJTetYcLcPDh5I0erASVjRFAMJtO3qW93fU5ME=; b=z/CH1akeCVekbuFwH9mAT/40T+JyON7TM3wN3UmHwFL10Tu0j7n2Ka/aATuQw1UvdcSIcN vRw29d5f3Zq6Cj9ZPnZIJgQchnNN871VDsNs8pV+i/3qkvbTz07CL9X2tNIw/TGEhZZ8XD MLHQpVVzGZrPhdCeIXSV1uOM5/q6+XhXMe8du4u8ZH08+yru4BaCKaV7Y8O5NtH4pKnxQw qH8igT1xsA78l6Vo7pIjfZXU2yp8R2yk9v0VSiQnQzUMNm3c75K1Q6g4uuyk+MlOWK473H /E2pyBNW0mwLl/RYrT8G9Zj+/LAe8aHYS7gmkuSQGS8qqZq4fT1sS8caBUQAzQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730100743; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zjWG6LJTetYcLcPDh5I0erASVjRFAMJtO3qW93fU5ME=; b=xBSSkSdamZNfVePK5zUjKMxXQ/RgXeKfZuywTyPAkietjGwhggliOspb7P8Q00Lxp7Cvhj K0fxhDvYgCPFBGAA== To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Andreas Hindborg , Alice Ryhl , Miguel Ojeda , Kees Cook , linux-kernel@vger.kernel.org Cc: Nam Cao , Alexei Starovoitov Subject: [PATCH 21/31] bpf: Switch to use hrtimer_setup() Date: Mon, 28 Oct 2024 08:31:54 +0100 Message-Id: <6f1b677bf762e116278d5902be61af1eeefc78a7.1729864823.git.namcao@linutronix.de> 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: quoted-printable Content-Type: text/plain; charset="utf-8" There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function. Switch to use this new function. Patch was created by using Coccinelle. Signed-off-by: Nam Cao --- Cc: Alexei Starovoitov --- kernel/bpf/helpers.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c index 1a43d06eab28..3518519e468a 100644 --- a/kernel/bpf/helpers.c +++ b/kernel/bpf/helpers.c @@ -1284,8 +1284,7 @@ static int __bpf_async_init(struct bpf_async_kern *as= ync, struct bpf_map *map, u =20 atomic_set(&t->cancelling, 0); INIT_WORK(&t->cb.delete_work, bpf_timer_delete_work); - hrtimer_init(&t->timer, clockid, HRTIMER_MODE_REL_SOFT); - t->timer.function =3D bpf_timer_cb; + hrtimer_setup(&t->timer, bpf_timer_cb, clockid, HRTIMER_MODE_REL_SOFT); cb->value =3D (void *)async - map->record->timer_off; break; case BPF_ASYNC_TYPE_WQ: --=20 2.39.5 From nobody Mon Nov 25 09:17:22 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 DA74D1DA634 for ; Mon, 28 Oct 2024 07:32:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100748; cv=none; b=l4bkBSIos+FoiwcEPF8Ir81smPSyNbu/4ZfKsGXTyGWysmtgqSBlZcFDb18eX9Tnstilm/jRmc/Vpi27/maL2MrQuQr+iDR574VRNe+RAvSHqaPX89YR0QRWr1IrCti0YbO6ydDZLqLt+Xjutno1yuPNRoS4hjud45CCgOPwN4g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100748; c=relaxed/simple; bh=4j1WP5ehxHj4mYlvpYltxxrO4sqQU0hAN2uFCoJmt2w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=FbgmX+iWRNAZbcYuIOMac5vpJxpI8x7P4QfEPlp7u2RRG0QnDAU3QwHGDyVgfVxX5HFjijWqmMrrL7RBlLlOHX++CZtLu7j+nyuHiqlq6z7Hf9pGIZYcQyjUBlTna6KFpc7mAQyZ4K8tgg5Tjj6bsFuCmg8HKchevXgR5YY3vGM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=c/2yptmz; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=jgH6gSDT; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="c/2yptmz"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="jgH6gSDT" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730100744; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=huKaPtaYzUgDhdKaFdYHwviz0Ur8cPBTKnQ57LRJxeg=; b=c/2yptmzy99p0qknVenIbAuV8FLy7mL9zD6IpJT/31tDj4Z40kRK8/I2sWgRYk4a9zCFe4 TzrNYEkmeKgRJaToCZybw9Ovo6b6mQMAYM0m2nx6A4gnlZsfHiZau4MY6zF1EaaFrHk2Vd Umbu8jINh1C9XHQ4vFeNLiLUJJiLWoehl3VEpBNGqsRUXd1GZ1KkINr6lEnZL3/OetpUUe rwRE/wwbJ7fMKFHqr5SdtuVwVmz4MhmD83+4NGScGcAAGSvbN3G/0rSjdUXCGqn4/653Xl /6HPvNXmmaUziWWiiXZGWqMHOXZl1sDSR47hUCdJR3P0wgd5vlwH7893BRf1KA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730100744; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=huKaPtaYzUgDhdKaFdYHwviz0Ur8cPBTKnQ57LRJxeg=; b=jgH6gSDTpxzju8Uh/8S0+lwqfbD2gu7+Rhsh9QbOVx9OyoC9pfRe7J57bW9VlJqhwViEQa c+S10DBayTI4MUDQ== To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Andreas Hindborg , Alice Ryhl , Miguel Ojeda , Kees Cook , linux-kernel@vger.kernel.org Cc: Nam Cao , Richard Weinberger Subject: [PATCH 22/31] ubifs: Switch to use hrtimer_setup() Date: Mon, 28 Oct 2024 08:31:55 +0100 Message-Id: <2443754dc58c8afba6c5df7a7cca3e3669332086.1729864823.git.namcao@linutronix.de> 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: quoted-printable Content-Type: text/plain; charset="utf-8" There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function. Switch to use this new function. Patch was created by using Coccinelle. Signed-off-by: Nam Cao --- Cc: Richard Weinberger --- fs/ubifs/io.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/ubifs/io.c b/fs/ubifs/io.c index 01d8eb170382..a79f229df475 100644 --- a/fs/ubifs/io.c +++ b/fs/ubifs/io.c @@ -1179,8 +1179,7 @@ int ubifs_wbuf_init(struct ubifs_info *c, struct ubif= s_wbuf *wbuf) wbuf->c =3D c; wbuf->next_ino =3D 0; =20 - hrtimer_init(&wbuf->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); - wbuf->timer.function =3D wbuf_timer_callback_nolock; + hrtimer_setup(&wbuf->timer, wbuf_timer_callback_nolock, CLOCK_MONOTONIC, = HRTIMER_MODE_REL); return 0; } =20 --=20 2.39.5 From nobody Mon Nov 25 09:17:22 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 DF4821DA636 for ; Mon, 28 Oct 2024 07:32:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100748; cv=none; b=kEywhHE4C6UjtAO9ildkgHKzCe/NCFicwYnUdswAZceiUCs0AtHYa0iqSZ6WYy8j66Sip60VhH730xf7l04WDVDhT7eALgUzm8uNEhZ2bFv2X56LLVgKelo6MwaU+fkPBtVkQFoiyYYZV2mMg4VFtrxzpHOnEHphNFDn/8FlVNI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100748; c=relaxed/simple; bh=1D5djsJJhUbyC6s770KVGASKS1s8lM7wTCs0rej2u0s=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Mz0QOdP0aSGUW7d8zCPLB8IYYKwUPxdBPr1uO6bG90jY1PhI1+8mAVZ6Ep6VrFnc/qF49KxiPdcJZGCAEdwnh9hnJaAi1PkgqMfMWoB11mcj6hm+7dqrm7Zh0gV44ukIr+z6op4NAg4M2UTgUxW6rMM4AknwGDmQmN9Tt6EjRJU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=H80daaLM; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=uAMF1zq5; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="H80daaLM"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="uAMF1zq5" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730100744; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=E0xFF/M4ax0EfZBXafrdTX12jJ2L1U8cGyCeiGxsanQ=; b=H80daaLM7mEqTF8x+CdJpXKtEy+G5CefxNveCLTe3bXQglh69geVpE2hv3DRQAKTPFysnk IDrKliLP8J1Rs498xpCeEZe59k5u7QJU9uedCRypRs0HsTkGk435wOf1tCqTgkspZFFiNf FY+ifFdSiiylatr92aBgG2zDwYyP88rZrn6EoZdHRk10H4logSHoT1+6JWhx5v4kBg38cj 6RuSwi05Hm9/f0DJPT1MtT8kJ96QWBPSl01+QWx+DDG3ekexyyhrBSjGDc3e4Auj5mCa+1 ntYMm8VQL3Q0o85lQKSauZtY+jlriDv5gfvmPOm6j4kq9z/iCJZ/AK/oPfwTDw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730100744; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=E0xFF/M4ax0EfZBXafrdTX12jJ2L1U8cGyCeiGxsanQ=; b=uAMF1zq5lmUiPnt+9EBZ4VdommVw9YB4CvnYbQ+DK6Sub+7ImgEP6Hhus/ygrzSRWtNrK2 73/SI2wFcXyASvCw== To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Andreas Hindborg , Alice Ryhl , Miguel Ojeda , Kees Cook , linux-kernel@vger.kernel.org Cc: Nam Cao , Wim Van Sebroeck Subject: [PATCH 23/31] watchdog: Switch to use hrtimer_setup() Date: Mon, 28 Oct 2024 08:31:56 +0100 Message-Id: <4d05966faebbf507b050f2f42d01b9f81f65a7f5.1729864823.git.namcao@linutronix.de> 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: quoted-printable Content-Type: text/plain; charset="utf-8" There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function. Switch to use this new function. Patch was created by using Coccinelle. Signed-off-by: Nam Cao --- Cc: Wim Van Sebroeck --- drivers/watchdog/softdog.c | 8 +++----- drivers/watchdog/watchdog_dev.c | 4 ++-- drivers/watchdog/watchdog_hrtimer_pretimeout.c | 4 ++-- kernel/watchdog.c | 3 +-- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/drivers/watchdog/softdog.c b/drivers/watchdog/softdog.c index 7a1096265f18..0820e35ad2e3 100644 --- a/drivers/watchdog/softdog.c +++ b/drivers/watchdog/softdog.c @@ -187,14 +187,12 @@ static int __init softdog_init(void) watchdog_set_nowayout(&softdog_dev, nowayout); watchdog_stop_on_reboot(&softdog_dev); =20 - hrtimer_init(&softdog_ticktock, CLOCK_MONOTONIC, HRTIMER_MODE_REL); - softdog_ticktock.function =3D softdog_fire; + hrtimer_setup(&softdog_ticktock, softdog_fire, CLOCK_MONOTONIC, HRTIMER_M= ODE_REL); =20 if (IS_ENABLED(CONFIG_SOFT_WATCHDOG_PRETIMEOUT)) { softdog_info.options |=3D WDIOF_PRETIMEOUT; - hrtimer_init(&softdog_preticktock, CLOCK_MONOTONIC, - HRTIMER_MODE_REL); - softdog_preticktock.function =3D softdog_pretimeout; + hrtimer_setup(&softdog_preticktock, softdog_pretimeout, CLOCK_MONOTONIC, + HRTIMER_MODE_REL); } =20 if (soft_active_on_boot) diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_de= v.c index 4190cb800cc4..8f59f66c61bf 100644 --- a/drivers/watchdog/watchdog_dev.c +++ b/drivers/watchdog/watchdog_dev.c @@ -1051,8 +1051,8 @@ static int watchdog_cdev_register(struct watchdog_dev= ice *wdd) } =20 kthread_init_work(&wd_data->work, watchdog_ping_work); - hrtimer_init(&wd_data->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_HARD); - wd_data->timer.function =3D watchdog_timer_expired; + hrtimer_setup(&wd_data->timer, watchdog_timer_expired, CLOCK_MONOTONIC, + HRTIMER_MODE_REL_HARD); watchdog_hrtimer_pretimeout_init(wdd); =20 if (wdd->id =3D=3D 0) { diff --git a/drivers/watchdog/watchdog_hrtimer_pretimeout.c b/drivers/watch= dog/watchdog_hrtimer_pretimeout.c index 940b53718a91..fbc7eecd8b20 100644 --- a/drivers/watchdog/watchdog_hrtimer_pretimeout.c +++ b/drivers/watchdog/watchdog_hrtimer_pretimeout.c @@ -23,8 +23,8 @@ void watchdog_hrtimer_pretimeout_init(struct watchdog_dev= ice *wdd) { struct watchdog_core_data *wd_data =3D wdd->wd_data; =20 - hrtimer_init(&wd_data->pretimeout_timer, CLOCK_MONOTONIC, HRTIMER_MODE_RE= L); - wd_data->pretimeout_timer.function =3D watchdog_hrtimer_pretimeout; + hrtimer_setup(&wd_data->pretimeout_timer, watchdog_hrtimer_pretimeout, CL= OCK_MONOTONIC, + HRTIMER_MODE_REL); } =20 void watchdog_hrtimer_pretimeout_start(struct watchdog_device *wdd) diff --git a/kernel/watchdog.c b/kernel/watchdog.c index 262691ba62b7..46d0852683de 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c @@ -789,8 +789,7 @@ static void watchdog_enable(unsigned int cpu) * Start the timer first to prevent the hardlockup watchdog triggering * before the timer has a chance to fire. */ - hrtimer_init(hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_HARD); - hrtimer->function =3D watchdog_timer_fn; + hrtimer_setup(hrtimer, watchdog_timer_fn, CLOCK_MONOTONIC, HRTIMER_MODE_R= EL_HARD); hrtimer_start(hrtimer, ns_to_ktime(sample_period), HRTIMER_MODE_REL_PINNED_HARD); =20 --=20 2.39.5 From nobody Mon Nov 25 09:17:22 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 880721DACBB for ; Mon, 28 Oct 2024 07:32:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100749; cv=none; b=ON8s/Uwq4EvNKD2guXNheSLCFIUdYvqSyn/uqmi6oRMavh7XhfPdZ4jrPVmnvneG8jP9NG3fqrkKl7u5FfFRC1sxC3jWeng1R5ilMidmdnD0YusIHfGG9AqFfrn7PypDnAqBkNiL8tmRZCkCP1gyPlOMHwn6wicK99vRViqPZM8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100749; c=relaxed/simple; bh=DgvwSAkDCHNl9T+jExGv9opoZtlAjlaik41GARiZMmw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=oBHASsB98RIky5CeCM/W1MGDhW3qgdAHd8ru72qr5ssUeb2Dezbuc8yMSPFtqTknELxUz5EU1RNqCoVyzFfDfG/hBQizdb4lo5iZNHie7GlXiq+ZE8cCYkyQQLEXYwEe/zcopCUAW24rjGX6ip6IQI9j5JAOk7w1zahiqvQNcz4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=s7DoRECV; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=hhECnvon; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="s7DoRECV"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="hhECnvon" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730100744; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=V47MlVMzGanDaCs+1QO3kznYikX5lsFVO9X/vkH7Msk=; b=s7DoRECVY8MlaAa5x23iW3Eyu0suKb73jj2QdsBaQBANnnCJXHE9vxH+wwjGsR33hjfkTs CE7zpWS/Eavl75bQspeGRWkHwCMEo97Kg1H59dEpi5/vd2HCJ1QS72RVEgjcFXxdrYEYFP 5dttmuPpGT+UWK6MPi06mKVLOxwp2eQr1AoJpw26psfUa+ZF4ipqnxoi9U1InQJzcs27EQ 5mBm1bsgMZqc138RZiz4OqLzfgPSRHK2JS2N9wfhtMieL48NwqF4nH33D7K+piNV+q1ZOn hd3jNFPMArPQYo2c5TKQdTczyJxDjSC7zZ8WTa1RahC+TnSrGOCQFAZW4WfsTA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730100744; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=V47MlVMzGanDaCs+1QO3kznYikX5lsFVO9X/vkH7Msk=; b=hhECnvonTSx0bG7qRo7xYtMr7tok82jXY1cP1wjCJKb4nqN1BGqTmqrsEFGSJmLl7Hs5gX HhoQiW1gl3SoriAQ== To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Andreas Hindborg , Alice Ryhl , Miguel Ojeda , Kees Cook , linux-kernel@vger.kernel.org Cc: Nam Cao , Steven Rostedt Subject: [PATCH 24/31] tracing/osnoise: Switch to use hrtimer_setup() Date: Mon, 28 Oct 2024 08:31:57 +0100 Message-Id: <491c6ad7c82f8fc446d0727757e6b4267ac64417.1729864823.git.namcao@linutronix.de> 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: quoted-printable Content-Type: text/plain; charset="utf-8" There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function. Switch to use this new function. Patch was created by using Coccinelle. Signed-off-by: Nam Cao Acked-by: Steven Rostedt (Google) --- Cc: Steven Rostedt --- kernel/trace/trace_osnoise.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/kernel/trace/trace_osnoise.c b/kernel/trace/trace_osnoise.c index 1439064f65d6..e50f7a1aae6d 100644 --- a/kernel/trace/trace_osnoise.c +++ b/kernel/trace/trace_osnoise.c @@ -1896,8 +1896,7 @@ static int timerlat_main(void *data) tlat->count =3D 0; tlat->tracing_thread =3D false; =20 - hrtimer_init(&tlat->timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_PINNED_HARD); - tlat->timer.function =3D timerlat_irq; + hrtimer_setup(&tlat->timer, timerlat_irq, CLOCK_MONOTONIC, HRTIMER_MODE_A= BS_PINNED_HARD); tlat->kthread =3D current; osn_var->pid =3D current->pid; /* @@ -2461,8 +2460,7 @@ static int timerlat_fd_open(struct inode *inode, stru= ct file *file) tlat =3D this_cpu_tmr_var(); tlat->count =3D 0; =20 - hrtimer_init(&tlat->timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_PINNED_HARD); - tlat->timer.function =3D timerlat_irq; + hrtimer_setup(&tlat->timer, timerlat_irq, CLOCK_MONOTONIC, HRTIMER_MODE_A= BS_PINNED_HARD); =20 migrate_enable(); return 0; --=20 2.39.5 From nobody Mon Nov 25 09:17:22 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 CB7151DB360 for ; Mon, 28 Oct 2024 07:32:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100749; cv=none; b=f1bB+RwCIRueY1h8mKgqxoC5LgrAJB+Om1v9EvUnolaY2NxqTy/x4egs0awUMqyJJp0ZvioKzrIWuXpw/pdpKLK2xL7KpG9PV2gfQxgoPsU3518OGRca0hKO3739JuJIm8NtDC+4YGg8eJ04CP/+hL9FW3S0DfgBF/sJuXs6nwk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100749; c=relaxed/simple; bh=fferLxSF64tTCJV6ylfzClO0kBRcFPkVfO/chNQdXHc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=THS+0W29mkMDot2HGwI65iZY1C/Aag7K+AW2yZxH+Gt5ZP+kxCXVJ3t/WQSseYsmpZbYooOP+dBslL9byxaoCpH7IGqB9Qbxz8hwFkdl9KG+4VsPlAph+b5ICytn/+Jal8Pc/YH0YISeaFZ3CLN/WtoX5otaLhZ1TG6hthx2wxs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=qYnvkr1r; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=KudblmCy; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="qYnvkr1r"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="KudblmCy" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730100745; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+awgZ1IkZBVUFUbAPP/P6eD+NItkoQ24Ixi+M66CZuc=; b=qYnvkr1rYnUBHWMpHPWXTW9hEB/cD/ZySOnMdE2mU+k/F5OnYacKQV/vbyXzbmKRo8C92m E9oHn+t9kpRSKIM/U1HF6IL64BNLa9WGQcTE7ttpZ5Bj+tnmj4IJWY48V3ca/UdBUEZ/Ib PW+KAQ1klKP1jlyDQuDGuE20B9PQy4jt8NptDiwqqQWqcZTGZmrEjYlFWrVQsxOvgoNGEw sOZNCEA1FZfZxkjaZyVYLrj3uc6oTF6HyFrG7NYwE4Tv+5BY5zsmeqtmuBNq0ec7CkxL/7 XVxZwDBtJbQ1SFxR7T4PQxA2vsuvKZHKeXTjak7aSFGE4LydeYJhPFMWFMqIQg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730100745; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+awgZ1IkZBVUFUbAPP/P6eD+NItkoQ24Ixi+M66CZuc=; b=KudblmCynY90OV3IuCXaA3UzSmIxfqE/dLU3j/V2x4AYB1Cbsag3n6z7GOzIqEkVwHBS59 +6WT98NOqR+4kbAw== To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Andreas Hindborg , Alice Ryhl , Miguel Ojeda , Kees Cook , linux-kernel@vger.kernel.org Cc: Nam Cao , Jens Axboe Subject: [PATCH 25/31] block, bfq: Switch to use hrtimer_setup() Date: Mon, 28 Oct 2024 08:31:58 +0100 Message-Id: <5f34af8523a77a9f308ba90790ba4e5518f78695.1729864823.git.namcao@linutronix.de> 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: quoted-printable Content-Type: text/plain; charset="utf-8" There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function. Switch to use this new function. Patch was created by using Coccinelle. Signed-off-by: Nam Cao --- Cc: Jens Axboe --- block/bfq-iosched.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c index 0747d9d0e48c..7ce1ab0b65b4 100644 --- a/block/bfq-iosched.c +++ b/block/bfq-iosched.c @@ -7294,9 +7294,8 @@ static int bfq_init_queue(struct request_queue *q, st= ruct elevator_type *e) =20 INIT_LIST_HEAD(&bfqd->dispatch); =20 - hrtimer_init(&bfqd->idle_slice_timer, CLOCK_MONOTONIC, - HRTIMER_MODE_REL); - bfqd->idle_slice_timer.function =3D bfq_idle_slice_timer; + hrtimer_setup(&bfqd->idle_slice_timer, bfq_idle_slice_timer, CLOCK_MONOTO= NIC, + HRTIMER_MODE_REL); =20 bfqd->queue_weights_tree =3D RB_ROOT_CACHED; #ifdef CONFIG_BFQ_GROUP_IOSCHED --=20 2.39.5 From nobody Mon Nov 25 09:17:22 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 AAD081DA0E0 for ; Mon, 28 Oct 2024 07:32:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100750; cv=none; b=sy74Mu/+sgzx8VvCYLcbxI9j6J8KxhYrZ9oR6OCddSeFeMbPIRuvgTJdlUBB5unDtlt2twExp1m+f/U/bDpzikUEj89x/byDk/DgOnVHT1ANDMLoK/jNhXBzAvja5zDqU1WEr50KMSzin4/Xrw7wjUcReIhwieA1662a06E1lGs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100750; c=relaxed/simple; bh=MGKrfpZTfDRgBmEIFyYFYPSnBcuvfm2nLXvgfiyhRP8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ulkebjrlNXhMxOspUTLKYVtGbL2eopYTqDHAnOZmAFeeXZNq3Cgo5VkQKKpW4pTpYibFvB2qNR/3ElObxjkuH2lSKycgTajYTmDdqJy/FbahNlysAc4kQkS1dnBrW21Q2fgATiK74u4/IRKaXsUPPdJ/BwtR6xGd0PllK47er04= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=zUlk+eum; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=2zS7j8YX; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="zUlk+eum"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="2zS7j8YX" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730100745; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PPn7JOx6/bF7AcYZnwASeMF8q3ZxVgTkAErO6IDHn5Y=; b=zUlk+eumGqnDs+VL9bv+CvmdauZzoxRBB9gdlc8HrcUOddT+4ZtVHUgjmzzs5Jjgb5lGFK iuoYF0Ue92wDwDA13127Tz4aIsRJvVRwQKI7uKykeoHqAn4mVzG5Ej4CcOYgz8Sld+j3u/ jpveY1uIja1J1UZl3tSMkeF6k/r++FB0MGXmztmB6gBhfVXEzpGaPP1k+APjLKP7jguxGl 9OvqgkMJeaJIfsvohB7UIGJ29F4BhQD94unwlXPreWMgNIcrQjl+TffpQDvD6J2eHxodK2 HvIn6y78tbzWE912EuZkEqlfIjOFEdbAizYDA7COeMdwwrWPlh47FOrz29sh3w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730100745; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PPn7JOx6/bF7AcYZnwASeMF8q3ZxVgTkAErO6IDHn5Y=; b=2zS7j8YX5xbobtYXaWuYtwmN/Dg8WkGOGkCEYVnd2wrjp/aYOhyctf9J8/S1LHxTo4OSk1 OcwznRgCBs8YpkAA== To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Andreas Hindborg , Alice Ryhl , Miguel Ojeda , Kees Cook , linux-kernel@vger.kernel.org Cc: Nam Cao , Damien Le Moal Subject: [PATCH 26/31] ata: pata_octeon_cf: Switch to use hrtimer_setup() Date: Mon, 28 Oct 2024 08:31:59 +0100 Message-Id: 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: quoted-printable Content-Type: text/plain; charset="utf-8" There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function. Switch to use this new function. Patch was created by using Coccinelle. Signed-off-by: Nam Cao Acked-by: Damien Le Moal --- Cc: Damien Le Moal --- drivers/ata/pata_octeon_cf.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/ata/pata_octeon_cf.c b/drivers/ata/pata_octeon_cf.c index 0bb9607e7348..29be47fd8e03 100644 --- a/drivers/ata/pata_octeon_cf.c +++ b/drivers/ata/pata_octeon_cf.c @@ -935,9 +935,8 @@ static int octeon_cf_probe(struct platform_device *pdev) ap->mwdma_mask =3D enable_dma ? ATA_MWDMA4 : 0; =20 /* True IDE mode needs a timer to poll for not-busy. */ - hrtimer_init(&cf_port->delayed_finish, CLOCK_MONOTONIC, - HRTIMER_MODE_REL); - cf_port->delayed_finish.function =3D octeon_cf_delayed_finish; + hrtimer_setup(&cf_port->delayed_finish, octeon_cf_delayed_finish, CLOCK_= MONOTONIC, + HRTIMER_MODE_REL); } else { /* 16 bit but not True IDE */ base =3D cs0 + 0x800; --=20 2.39.5 From nobody Mon Nov 25 09:17:22 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 6FE1B1DB924 for ; Mon, 28 Oct 2024 07:32:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100749; cv=none; b=Jr77+zkGQ3JYnYoYKrTLgXQfoengTVVm56EdC9yQ8pMOTwpe6YV6jYWjVAAJWwOAzM7vZWrXBChtSoTGh1aHNmKYiv7Y4YmcWiy4VTI/gAKA1jTwK/hJSOcEPcRgWAjqK+Ey35tMq3SwHHlV94ZLaxDruxh7Rmv5SmLbj6WYJzI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100749; c=relaxed/simple; bh=nxP3duLca3yFYtlvgvspSj0s7ofgTz6ODF1JE7KT6hY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=qUlaAsN3JaRLyN4XwpRnKMZneVn2X8vBGtkkaP34Uoz3m8aD1kgvxiIJWC1pmI5uCpSCmUQ2neh+8nMDkxp1p2DIRyTsoXbdmXkWlrTdeynW4EvSqYHwuJVuxb4+z8aUwfQmL9YPtEXw/1VO3Qdo+4az0czRRTPvjZLjZGD6Ju8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=4FOdmIhi; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=mpKtidrU; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="4FOdmIhi"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="mpKtidrU" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730100746; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/S4respY/IH0zEpaeY1C+XtgRb1utITUk26WzJC8QFU=; b=4FOdmIhiLmX/kkpgjz/AezqjBCJjqFEUDUdaf5KlR+jHBoVPaAPm2R+wbd923FdOIvq4I9 b5coYOHDFlHmrPXu71NSJ1U443pOXNfaDf72N+oPAV4TPtnjfdldnuVBFTh2P2tHOyrOrv ob6yHGf9KhcDEm04nfhhhXlFU80INPZhl218uyDv6IUJrE+/yFEig1oKX6yzV1z46HCEJg iFFMCrFB13CemNEJY/kw9n/44uHbnVuEzAWbqgR0nRe/dmJRYdPP00PpYlGvRQW8u7yTob Hg8e1FxfT91Ebj2FW81ZM4lHP72e9apuffe8Nl+NJ/vtZhJ3/ELSCuP+HEJxww== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730100746; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/S4respY/IH0zEpaeY1C+XtgRb1utITUk26WzJC8QFU=; b=mpKtidrU+Kw20MbRmHDpgi35JkIr8mjI+ivnouffj05SD85G9Rk0Tm8pIeiFN+pRtNktw0 rmayKUPDY3sUI+AQ== To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Andreas Hindborg , Alice Ryhl , Miguel Ojeda , Kees Cook , linux-kernel@vger.kernel.org Cc: Nam Cao , Jens Axboe Subject: [PATCH 27/31] blk_iocost: Switch to use hrtimer_setup() Date: Mon, 28 Oct 2024 08:32:00 +0100 Message-Id: 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: quoted-printable Content-Type: text/plain; charset="utf-8" There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function. Switch to use this new function. Patch was created by using Coccinelle. Signed-off-by: Nam Cao --- Cc: Jens Axboe --- block/blk-iocost.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/block/blk-iocost.c b/block/blk-iocost.c index 9dc9323f84ac..5a89535c1303 100644 --- a/block/blk-iocost.c +++ b/block/blk-iocost.c @@ -2997,8 +2997,7 @@ static void ioc_pd_init(struct blkg_policy_data *pd) iocg->hweight_inuse =3D WEIGHT_ONE; =20 init_waitqueue_head(&iocg->waitq); - hrtimer_init(&iocg->waitq_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); - iocg->waitq_timer.function =3D iocg_waitq_timer_fn; + hrtimer_setup(&iocg->waitq_timer, iocg_waitq_timer_fn, CLOCK_MONOTONIC, H= RTIMER_MODE_ABS); =20 iocg->level =3D blkg->blkcg->css.cgroup->level; =20 --=20 2.39.5 From nobody Mon Nov 25 09:17:22 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 4296A1DC06B for ; Mon, 28 Oct 2024 07:32:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100750; cv=none; b=LWhavOPsqe88FkrcrHFE6G+uvXRU6SYnyXIAr1Vm36z9zBIh+rzsAg1dYyc3fxoXfPoGHsR01Xzlh1cZaeslaNMS0cpi23LASd8SK7Bd+NT/7fOzc/kpDsFNc9/3XrVEbTIdTKlE99PkI3LYUTvzr81GfaC2jqlXZEASJuf/5pY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100750; c=relaxed/simple; bh=KoGLP37VkEAx/sVraIGehUOfzr3ni3j2DVH+RYsW3sM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=er/jxVBZR6hLMHzJTxpaYus+6RqdI5jY3xiQVgR2LzFJXZ/2IuXszhdxYGJ0mC+j8BGrjkBxjZGuG44vrWkbEUlyJNpgGlPXBYD0m/lHxW9UrlcUlbF240IkPcLlIx0b7++Dz0EfAqGbIvhplcy1pcu2tClk0gUdWdSihxUWXfs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=VOeYa4eD; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=ke7cMsdc; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="VOeYa4eD"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="ke7cMsdc" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730100746; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lDAYiTMT42emkjEGqfni6QzESyG5h52ZcdrArqG2woA=; b=VOeYa4eDEflRJrojN7JtxaNi0r/Ppgv8p3BkDUG8fcA/wzEbBNODfVgBONJR+yoSsLnMe4 3Oko6BtaVr104W3tisdLXzNM4H5xIXE02Wqw4EesUIFLrSl++Fuw1LVOBffkyrG3gXML7C 2kvbIxd8DGqUBe7klPxBhPrcSMZKngHcDBv+eYACAhUi92+cWe2VIYKA4Wqy+SG0q0EMsp op7T1IotordCAaNQmQtG1HL0ORRq/VqUei7g5By6k/ILIqlEQMriRsX9hQ+wFhMx9F1mGQ rO8dYO6oDXEHD9WlvV98QgIAcanQzhOnY2ymgj206y8N0w84oUGBUE8VuSOeQQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730100746; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lDAYiTMT42emkjEGqfni6QzESyG5h52ZcdrArqG2woA=; b=ke7cMsdck7dx6xO7ImdiESo5ugFk76xDHpFkhqIBV0LbKhNj7SoNu9+Y6Kri69M9Kp+taB +zECrW0FkMMW2EDw== To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Andreas Hindborg , Alice Ryhl , Miguel Ojeda , Kees Cook , linux-kernel@vger.kernel.org Cc: Nam Cao , "Rafael J. Wysocki" Subject: [PATCH 28/31] PM: runtime: Switch to use hrtimer_setup() Date: Mon, 28 Oct 2024 08:32:01 +0100 Message-Id: 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: quoted-printable Content-Type: text/plain; charset="utf-8" There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function. Switch to use this new function. Patch was created by using Coccinelle. Signed-off-by: Nam Cao Acked-by: "Rafael J. Wysocki" --- Cc: "Rafael J. Wysocki" --- drivers/base/power/runtime.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c index 2ee45841486b..425c43b2d478 100644 --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c @@ -1764,8 +1764,8 @@ void pm_runtime_init(struct device *dev) INIT_WORK(&dev->power.work, pm_runtime_work); =20 dev->power.timer_expires =3D 0; - hrtimer_init(&dev->power.suspend_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS= ); - dev->power.suspend_timer.function =3D pm_suspend_timer_fn; + hrtimer_setup(&dev->power.suspend_timer, pm_suspend_timer_fn, CLOCK_MONOT= ONIC, + HRTIMER_MODE_ABS); =20 init_waitqueue_head(&dev->power.wait_queue); } --=20 2.39.5 From nobody Mon Nov 25 09:17:22 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 433911DC06D for ; Mon, 28 Oct 2024 07:32:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100750; cv=none; b=iHiVVvkd6XaGwNnMud1pd4m2phYfsRIjYmeU19axGAqsX294Jx8l5fhwsddsgvP0MmSDHdNvFsSbs1oTgLxklxSe1TMjZDiXcHzVwYVztevtS/Jta5iJoy0i7WRK8MTLmLtbyOl9/DAfoCWlm+nSh9xoMWWndUluKSX80IOG9qM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100750; c=relaxed/simple; bh=DhzKvqeRZCgzCbPwGfMFRCarwmIz8Pm4aHmF+hZLuGs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=qZ3ELFmcUfdJQAIu+RdEJUrHfsAIjWzbpyZdQHq9xHd1Y0EmaIm+xFOcxfyvjfelCLMlWN9A16amFbho9dVVlJXvDkM7prJLCNa7rGtuFM6FxdNxhwZux2rjQihb+irwFhyTJnMVXnUwBVE+RmM9r9wM20OH/2koNQOq7JcEirY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=Hi82KPv8; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=HeFKQPF2; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Hi82KPv8"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="HeFKQPF2" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730100746; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=THd1owm8cfZMhPubsxWYL3gOzIIwc2BWgS1eTHuFjoY=; b=Hi82KPv8X4UZ2OFonnyARFwVMq5lc/hnISeV7L/nb76evvBlFF+bXr+cYdC8I0PwQjrcZG r3/9WzkKURcPJ6hntn4OM2HgdHf/MuCQO781+OApoadrOfCKEbYQzaUVMAchE5h8M73YYK 4feOpPaqF+9kgKweD6QKvgZh+ShN5WtdOauT2KUXLJl+0SBcuynttrDzGa8MAqRqLfK60D 2EXePBKcAn2OeuKtqSYyCaIB0SbhcFQzLgyOKZf64gj6iRNRpiWeZY6qzGYwcoF5EfGHAJ /sghbBm2Yc712GVqZ2hGz5EoZiBuwrSFszCg0sKP9Rbd4SJdBK3ffaPqirmvBA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730100746; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=THd1owm8cfZMhPubsxWYL3gOzIIwc2BWgS1eTHuFjoY=; b=HeFKQPF2YyTRdZN0lVLuXPtnJuHmwZAjf/iubMmaITCOEI7laBRuKYANcQ2rxmioPsoxBv birnbG4HKqLBwYAA== To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Andreas Hindborg , Alice Ryhl , Miguel Ojeda , Kees Cook , linux-kernel@vger.kernel.org Cc: Nam Cao , Heiko Stuebner Subject: [PATCH 29/31] PM / devfreq: rockchip-dfi: Switch to use hrtimer_setup() Date: Mon, 28 Oct 2024 08:32:02 +0100 Message-Id: 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: quoted-printable Content-Type: text/plain; charset="utf-8" There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function. Switch to use this new function. Patch was created by using Coccinelle. Signed-off-by: Nam Cao --- Cc: Heiko Stuebner --- drivers/devfreq/event/rockchip-dfi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/devfreq/event/rockchip-dfi.c b/drivers/devfreq/event/r= ockchip-dfi.c index e2a1e4463b6f..0470d7c175f4 100644 --- a/drivers/devfreq/event/rockchip-dfi.c +++ b/drivers/devfreq/event/rockchip-dfi.c @@ -642,8 +642,7 @@ static int rockchip_ddr_perf_init(struct rockchip_dfi *= dfi) if (ret) return ret; =20 - hrtimer_init(&dfi->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); - dfi->timer.function =3D rockchip_dfi_timer; + hrtimer_setup(&dfi->timer, rockchip_dfi_timer, CLOCK_MONOTONIC, HRTIMER_M= ODE_REL); =20 switch (dfi->ddr_type) { case ROCKCHIP_DDRTYPE_LPDDR2: --=20 2.39.5 From nobody Mon Nov 25 09:17:22 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 387751AF0CF for ; Mon, 28 Oct 2024 07:32:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100751; cv=none; b=O/yVdkC88eIaN4SzJVN1vbQ+jy5KJ+2ENE421IK9KHb+mC1HXdpRG4BD0DPQ9VJYvXFPYiYydkQEYOhp3pyQoVJCCIXm5dBb2tbJ2EXBPiwwQ0/osC+KJF1JAn+3E1YUGBQC7pk2zG+nz0nNbbc1yGsemhhQx8JOXuewQv+yQxk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100751; c=relaxed/simple; bh=k0AhVer/COxuWP6iGY1J5RVKPazlMQyiNZuvVy7H9qU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=LeXSrXc+Jsincp6QcHi9QznwGfbg1I1l/GKRpnBcyYXnMpRc9MU8xUny1Qb9YGQmQdDajvfsTiGaEZvE4OyEzXqczapF1mrNpC6O+lmEjpv1yQB/OvRhQux9gHozwFF+dxSar6MG7ceag13+2tLteloaSSPNLcYR0PEyphf4tIA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=3vXenMPq; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=kRqDJQ+P; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="3vXenMPq"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="kRqDJQ+P" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730100747; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=790s+cOMBj/y5/dRJ9WI50uaiiyWoEp3JuylETTc5rY=; b=3vXenMPqNctfs6kufbGGAdlgsIYMmQBjYPNzB761vjf1wuWP7NWD0/MUkbKY9eqywO80/y 3cLw7+8wgD8C3xDD5bv+Vgzl0GFWX5ns55WQdte1aq0LAjy5VGNni4DAelfSLShdf3B1Kj BUSWEvO6YDGPYjDfKvqyvMW1gdb+5TnMuxE5doFFfesST1E4DIA3FHBszqcHASrcVJb1cw Mwqpqui44bszaZio9v117iKlm1OER3fGcMnZJpoiYn7Z68oEuNOYh7qJQXdl7cS5+nYQe3 M0HcXga2MmgaCpY2xfY3SSoIuEwNEKtLMG3rG8VH3DM21S9Iz1czOOT3ltWm7A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730100747; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=790s+cOMBj/y5/dRJ9WI50uaiiyWoEp3JuylETTc5rY=; b=kRqDJQ+PUMhFGuDd5xRgTeqzvpY7oldpTijFtw9+gYiI5v9LgTLbBl0KgTF95vDwomogDH qvT8Xok/B9h/oxBw== To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Andreas Hindborg , Alice Ryhl , Miguel Ojeda , Kees Cook , linux-kernel@vger.kernel.org Cc: Nam Cao , Jens Axboe Subject: [PATCH 30/31] null_blk: Switch to use hrtimer_setup() Date: Mon, 28 Oct 2024 08:32:03 +0100 Message-Id: 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: quoted-printable Content-Type: text/plain; charset="utf-8" There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function. Switch to use this new function. Patch was created by using Coccinelle. Signed-off-by: Nam Cao --- Cc: Jens Axboe --- drivers/block/null_blk/main.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c index 2f0431e42c49..b815b26b39d2 100644 --- a/drivers/block/null_blk/main.c +++ b/drivers/block/null_blk/main.c @@ -1418,8 +1418,7 @@ static void nullb_setup_bwtimer(struct nullb *nullb) { ktime_t timer_interval =3D ktime_set(0, TIMER_INTERVAL); =20 - hrtimer_init(&nullb->bw_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); - nullb->bw_timer.function =3D nullb_bwtimer_fn; + hrtimer_setup(&nullb->bw_timer, nullb_bwtimer_fn, CLOCK_MONOTONIC, HRTIME= R_MODE_REL); atomic_long_set(&nullb->cur_bytes, mb_per_tick(nullb->dev->mbps)); hrtimer_start(&nullb->bw_timer, timer_interval, HRTIMER_MODE_REL); } @@ -1596,8 +1595,8 @@ static blk_status_t null_queue_rq(struct blk_mq_hw_ct= x *hctx, might_sleep_if(hctx->flags & BLK_MQ_F_BLOCKING); =20 if (!is_poll && nq->dev->irqmode =3D=3D NULL_IRQ_TIMER) { - hrtimer_init(&cmd->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); - cmd->timer.function =3D null_cmd_timer_expired; + hrtimer_setup(&cmd->timer, null_cmd_timer_expired, CLOCK_MONOTONIC, + HRTIMER_MODE_REL); } cmd->error =3D BLK_STS_OK; cmd->nq =3D nq; --=20 2.39.5 From nobody Mon Nov 25 09:17:22 2024 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 EB718191F62 for ; Mon, 28 Oct 2024 07:32:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100751; cv=none; b=mOK+7ThyM/pOzqzPRARfDN/mlmSUjWehCzPK7X/XZ49Nv2+bHGNCByPAzy7qD3Eugt8HKidRE0RVDox8Lx+BLtp7cU7hIAjqqnrhKl9XiK2Q+VxkNwrlx2ziIFRmG3RcLSxAt4zZVSES0aIYx8xy8GWotuXRwv3PqNCD2tEYw4k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730100751; c=relaxed/simple; bh=kQ6BKIhl3w/6/TLxxrPq+qOApBwa/1iiAmh+swXeI4o=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=XbTzcV95x8AfMr+kmIBvvkgjm+taPgr02pbAhJgGKXlEYYHw8uIc+8n27Eozs4K7fIU/yx5qoNNtdrI8DjoebBGFvG+VeXr6sUufrHr2V1QupAVxRgohsxRcL4gyU81qBtYMKuLOZwxojGaiJgKJV1kb9dqrhHx2QoPvnfV+bVc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=lQfu1DYS; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=aBeYXwQS; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="lQfu1DYS"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="aBeYXwQS" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1730100747; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bP5cyQTok5lidmuCqIWmyhURfoTz6x70yCEPg03oU4M=; b=lQfu1DYS2CWIpWMjV7uqYcAvKiv4K2TkO8zm9QYKqNxKnnEZkdVo+SsZ0KMb89pNhwl9De vDsbGMZMiOPFX0a26FV/UbHEan22TR2aWGlMLKvx/RDENmhgQS3MlCICuLjamN1lDmD9vc RMbhlJZPkl3NegQEOrfFLXqglQkWYuK9vh72aSCDuzgxXkBcg0Z4gVN/kCVTsasiQZBdCO Y2aqXOZ2Q/HdzqZmclkdWsHR0ITS4RZTP74cHrDQWq6efD0w02b0/1t/HxVU832u0hXgw8 wmSPWU3OpIt0QDkOn8jXBlHoNOdalGgRszwirt1tiSdfdtpeAqDjgZ6Q63Xolg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1730100747; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bP5cyQTok5lidmuCqIWmyhURfoTz6x70yCEPg03oU4M=; b=aBeYXwQSX5RRCua3/0Tecbox2G06ieXX1w9dkw1Oiujwqs2Tjx5CR9R+yUTSqhN43mv5hj F8lUs4asnn9HPsAw== To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner , Andreas Hindborg , Alice Ryhl , Miguel Ojeda , Kees Cook , linux-kernel@vger.kernel.org Cc: Nam Cao , Herbert Xu Subject: [PATCH 31/31] hwrng: timeriomem: Switch to use hrtimer_setup() Date: Mon, 28 Oct 2024 08:32:04 +0100 Message-Id: <38019ad544cb1c2d0f2a678573611a4e05992040.1729864823.git.namcao@linutronix.de> 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: quoted-printable Content-Type: text/plain; charset="utf-8" There is a newly introduced hrtimer_setup() which will replace hrtimer_init(). This new function is similar to the old one, except that it also sanity-checks and initializes the timer's callback function. Switch to use this new function. Patch was created by using Coccinelle. Signed-off-by: Nam Cao --- Cc: Herbert Xu --- drivers/char/hw_random/timeriomem-rng.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/char/hw_random/timeriomem-rng.c b/drivers/char/hw_rand= om/timeriomem-rng.c index 65b8260339f5..27b0e2026d53 100644 --- a/drivers/char/hw_random/timeriomem-rng.c +++ b/drivers/char/hw_random/timeriomem-rng.c @@ -152,8 +152,7 @@ static int timeriomem_rng_probe(struct platform_device = *pdev) =20 priv->period =3D ns_to_ktime(period * NSEC_PER_USEC); init_completion(&priv->completion); - hrtimer_init(&priv->timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); - priv->timer.function =3D timeriomem_rng_trigger; + hrtimer_setup(&priv->timer, timeriomem_rng_trigger, CLOCK_MONOTONIC, HRTI= MER_MODE_ABS); =20 priv->rng_ops.name =3D dev_name(&pdev->dev); priv->rng_ops.read =3D timeriomem_rng_read; --=20 2.39.5