Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp15431889ybl; Tue, 31 Dec 2019 07:41:14 -0800 (PST) X-Google-Smtp-Source: APXvYqw4Ajd7tF1ssGXgrBU0A2/Tm2AHXQTWDqVR6svuT7xgtYOh5jTGZH9KQGvPJjj3j3Y0wquO X-Received: by 2002:a17:907:4366:: with SMTP id nd6mr78070931ejb.333.1577806874353; Tue, 31 Dec 2019 07:41:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577806874; cv=none; d=google.com; s=arc-20160816; b=yInoE0TUD/1BAQvEUoWSfQhxKNzPS6mAX8o4UiQQoAxPd3ILaoqCg7/QoBm6LVCy+P S6akq5i9LdA2Fg1e9jyVrf1O3WU+P0w+fOls1M8ZWRXFzx89Xd+pLRvWFHCwJ0yHXx/T 4avznJ7GNRC7NNs+datexzROnf1aEumylPtn3GkpN9wYp0zOwKrNm6mkx5Aqk8COlFh5 HELbAREv2B+Q1e7hv9K06CYXgnsx/UKFYI9yRw/A4SlgNaXFEwCtA7n1kffk5Pn2iHT3 z0S7owjHNUFST+7P+IfRb6coOgsoraSX80ZtGOrHSoPf9QBPjdJDCa+d8SyPtjUQTy4x Po7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=0zI0gfX4kyMk5ybZJW1MIBaMfCVRpcieMViMTdRuHHU=; b=Lq2dnyGAKr2O6oHWWqn1utFH+ErE5l3p+54r64gKVCYa6Cf0YjsmVyKRHZXruPEvap y8A97kN6zQJRSUWi2Gk3g2+1QC0tslViaK5K+JFi8pVkKZkWtjvzkS8mE5RnDgeF9iR2 dVDy9XzrXCjIfkDS0zSankO+tdRVOKrOKl9WZDow3JZ1LW6Tfa/cSormEgUR7vHBVcuT O0R1jrGVmj28ULVp5XMXkKlLaUb4qwKEb6aJQ72WqNwSbpFsyeSTydG8Hdq0dAGRfQpu onhCpXm7b3g58RyThotg4kwot0CU0nfUpWEGWaJAG53xLmCoBSlRjIcsXK//QDOIozph V+mQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=aelIqqsQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qh13si31968313ejb.428.2019.12.31.07.40.49; Tue, 31 Dec 2019 07:41:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=aelIqqsQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727064AbfLaPhG (ORCPT + 99 others); Tue, 31 Dec 2019 10:37:06 -0500 Received: from mail-pg1-f194.google.com ([209.85.215.194]:36658 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726060AbfLaPhG (ORCPT ); Tue, 31 Dec 2019 10:37:06 -0500 Received: by mail-pg1-f194.google.com with SMTP id k3so19671373pgc.3 for ; Tue, 31 Dec 2019 07:37:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=0zI0gfX4kyMk5ybZJW1MIBaMfCVRpcieMViMTdRuHHU=; b=aelIqqsQqz8e1Oh73A+P3E1dzERA7atsAp3gmXpIRWY6atThTgc5is5iVbjffudSYf kVT4yFnhWcrmbBk/cU2I43bz6/+55DE5sF5opHklS8kiiysK74GdYqGLGlaMzxTQ4FeR B/4W4GSEUYCkTGoUMeIQPppHYhe8d/sxCstIaGLziFCfVWxk8deLawp7dnlIuDCUdUCD zeq23U8KJxHRGMyFHYd+b5fDnFDbknzrVJwoCB1UabrZBGNmu/VtJzAeUT0qCpdHhAVY plKoTi4xbjMfxHnZ5IGYedegyGvlOcQCUm/gUbABffTy36v6j0Z8x7taXgcqM98bN2iS mEbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=0zI0gfX4kyMk5ybZJW1MIBaMfCVRpcieMViMTdRuHHU=; b=k0/DttE9r3iUqGDzbe7uCEdFaqvFBc4Y6lC0cC+p9upe4z02J9ZVrx4bOZucoi7ETD 6Q1vDkmiDa7cRwNkfV194Twz0bAzY9RIWmQyzXzA0p0kmyqHoA57nV21Jljwy5VIKolc vENtu5zRk24ug1GAhT7XRNFxXhuzgD/LRdMIZ9oKvONy/umECp3LpkjoA6UWHV6xVmnc +p3ZYSWf5LMDShfmkUroGT0gbgmnKCc17K3tK/E1tss4jhNo/AEhgT2Y028eDqzfMyK5 R0UHgqIhGZwxdAULXY6rylOZZ/lC98rknYysTHH5p2U5DqqmIidZeCjrQA2z/A9tlVG0 Iz1w== X-Gm-Message-State: APjAAAWaTqN2bv1/DNflCvgwTfZQM3HskS8QjnDIuZn1QGK1CwXSQdEU 9VL+LnVUnGurIfJ+jd105ZQ= X-Received: by 2002:a63:483:: with SMTP id 125mr77701373pge.217.1577806625492; Tue, 31 Dec 2019 07:37:05 -0800 (PST) Received: from localhost ([49.207.54.121]) by smtp.gmail.com with ESMTPSA id m101sm4068910pje.13.2019.12.31.07.37.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 31 Dec 2019 07:37:04 -0800 (PST) Date: Tue, 31 Dec 2019 21:07:03 +0530 From: afzal mohammed To: Russell King Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= , Catalin Marinas , Greg Ungerer , Vladimir Murzin Subject: Re: [RFC PATCH 2/2] ARM: !MMU: v7-M: preemption support Message-ID: <20191231153703.GA15302@afzalpc> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.3 (2018-01-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Mon, Dec 30, 2019 at 05:25:27PM +0530, afzal mohammed wrote: > A. Before this change, > > A.1 > ~ # cat /dev/mymisc > [ 28.099225] mymisc_open > [ 28.101625] mymisc_read: enter > > command prompt is not usable (expected), interrupts do happen during > this time. > B. After this change, > > B.1 > ~ # cat /dev/mymisc > [ 27.374821] mymisc_open > [ 27.377349] mymisc_read: enter > > though user will not get control back (as expected as it is fg process), > entering on prompt causes new line, doesn't know what to make out of > this behaviour, this doesn't happen in the A.1 case. Interrupts happen > here as well. Behaviour B.1 (which is how most of the system behaves) seems due to serial driver's threaded interrupt handler being able to preempt 'cat' process, this can't happen in the case of A.1 as preemption doesn't work. Also it seems that preemption does happen by tracking __schedule() at runtime, but issue mentioned in B.2 (below) remains. So it seems preemption is happening, but is very fragile. Regards afzal > B.2 > ~ # cat /dev/mymisc & > [1] 41 cat /dev/mymisc > ~ # [ 44.836417] mymisc_open > [ 44.838814] mymisc_read: enter > > though prompt is available under the control of user, upon typing > anything on the prompt (typed character doesn't get echoed), it crashes > as follows, > > [ 44.838814] mymisc_read: enter > [ 51.710314] > [ 51.710314] Unhandled exception: IPSR = 00000006 LR = fffffffd > [ 51.717576] CPU: 0 PID: 37 Comm: sh Not tainted 5.5.0-rc4-00004-g2328d01dbd85 #105 > [ 51.725078] Hardware name: STM32 (Device Tree Support) > [ 51.730206] PC is at 0x90195958 > [ 51.733329] LR is at 0x901c4df3 > [ 51.736471] pc : [<90195958>] lr : [<901c4df3>] psr: 21000000 > [ 51.742713] sp : 901e5a58 ip : 00000000 fp : 901d89fc > [ 51.747911] r10: 00000000 r9 : 00000000 r8 : 00000001 > [ 51.753143] r7 : 000000a8 r6 : 901e5a58 r5 : 901e5b08 r4 : ffffffff > [ 51.759643] r3 : 000000a8 r2 : ffffffff r1 : 00000001 r0 : 00000001 > [ 51.766122] xPSR: 21000000 > [ 51.768866] CPU: 0 PID: 37 Comm: sh Not tainted 5.5.0-rc4-00004-g2328d01dbd85 #105 > [ 51.776369] Hardware name: STM32 (Device Tree Support) > [ 51.781594] [<0800c0c9>] (unwind_backtrace) from [<0800b25b>] (show_stack+0xb/0xc) > [ 51.789166] [<0800b25b>] (show_stack) from [<0800b9eb>] (__invalid_entry+0x4b/0x4c) > > It is a Usage Fault happening while in thread(user) mode. PC & LR in the > dump is strange in the sense that they do not point to text section.