Received: by 10.213.65.68 with SMTP id h4csp298128imn; Wed, 28 Mar 2018 03:56:05 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+BSfEoJZe++n/9wWVLOQBm6+6+An4mPBVP/ZtEel/Kb2+ly/rXLcrr6Ru6mp70m0kpFy92 X-Received: by 10.99.146.30 with SMTP id o30mr2239352pgd.115.1522234565578; Wed, 28 Mar 2018 03:56:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522234565; cv=none; d=google.com; s=arc-20160816; b=CHxHOqtwLxSjgFRED99zfEv6ol6sZ2TsTP8DkWnPyJwZM6W/eSE562Jtoei2co4DM+ adJF+SQkRLIn6Q9eJuL9oBGB0etI4xOej6MRrL2enhbnWTNchN0A0w6SiDzHiTgfJfhi vfexwU9F4NE8d+DbyqaoaEkjpC2Oiy0nRdBxHwhLQI8r4ZmWM1mzUUKT04L1oYoOqX0a sC75zDgGz47xVBCLbgWwWqt5e7mbGY53crB6rXr/p5OoNpiTIEis1ANSrV7S/qyV3NU6 pozQgcorCRGlx0VWr0k9CtIwb+Zgv76dwPn/ZvnziOPwl8DWFSKgCT44m8r7AVQbCYGR Jqmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=/bBApxna/EmDZhiJNantW03tD/Glng9gMR/x7IoaMpc=; b=juZkEVxwyQHZba/L1hWMs12bB70aUbzHqpxS8JXBTVxAfEnvzcbNdZvKN+9Bo1f/zd 8WpC4EzwkgmXso+Qh8IA/6Tb44oLraZNEZ5ewABf9m3j6hx6lfpMtsJ+Bd/4sv2K7nCV 6BsCsmOxSWA01Glm4ef0L4F3f1uexGuN+hiK0SBmhvsiyVMJJMy8Jk7tjvnovSGTO9ix gIgcIS6OLN+oiQv/EBW1ZngWMlH+lxWGVPN981k9S7u0Z/dkMeezih4nw5Qi3XORxKpu UB9V/3APJLF0By5/wWkKejb+2+yIiY0NPBOrrpHfghz7yJwJDZZuI8RID24qxZgnTEYJ Rp4g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w31-v6si3526162pla.193.2018.03.28.03.55.51; Wed, 28 Mar 2018 03:56:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752965AbeC1KH6 (ORCPT + 99 others); Wed, 28 Mar 2018 06:07:58 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:50185 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752754AbeC1KHz (ORCPT ); Wed, 28 Mar 2018 06:07:55 -0400 Received: from localhost ([127.0.0.1] helo=bazinga.breakpoint.cc) by Galois.linutronix.de with esmtp (Exim 4.80) (envelope-from ) id 1f17zh-00017s-Pa; Wed, 28 Mar 2018 12:07:50 +0200 From: Sebastian Andrzej Siewior To: linux-rt-users@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Thomas Gleixner , Steven Rostedt , Sebastian Andrzej Siewior , stable-rt@vger.kernel.org Subject: [PATCH RT 2/3] posix-timers: user proper timer while waiting for alarmtimer Date: Wed, 28 Mar 2018 12:07:45 +0200 Message-Id: <20180328100746.18668-2-bigeasy@linutronix.de> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180328100746.18668-1-bigeasy@linutronix.de> References: <20180328100746.18668-1-bigeasy@linutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On RT the timer can be preempted while running and therefore we wait with timer_wait_for_callback() for the timer to complete (instead of busy looping). The POSIX timer has an hrtimer underneath and this hrtimer is used to wait for its completion. The alartimer has also an hrtimer but at a different location. Instead of checking for ->timer_set which is the same for the alarmtimer and the "posix-timers" I instead check for ->arm which is only used by the "posix-timers". To match the alarmtimer I check for the alarm_clock struct. Cc: stable-rt@vger.kernel.org Signed-off-by: Sebastian Andrzej Siewior --- kernel/time/posix-timers.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c index 0b568087bd64..8a16cb8f684a 100644 --- a/kernel/time/posix-timers.c +++ b/kernel/time/posix-timers.c @@ -802,8 +802,10 @@ SYSCALL_DEFINE1(timer_getoverrun, timer_t, timer_id) static void timer_wait_for_callback(const struct k_clock *kc, struct k_iti= mer *timr) { #ifdef CONFIG_PREEMPT_RT_FULL - if (kc->timer_set =3D=3D common_timer_set) + if (kc->arm =3D=3D common_hrtimer_arm) hrtimer_wait_for_timer(&timr->it.real.timer); + else if (kc =3D=3D alarm_clock) + hrtimer_wait_for_timer(&timr->it.alarm.alarmtimer.timer); else /* FIXME: Whacky hack for posix-cpu-timers */ schedule_timeout(1); --=20 2.16.3