From patchwork Fri Sep 23 07:33:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 76828 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp425184qgf; Fri, 23 Sep 2016 00:26:51 -0700 (PDT) X-Received: by 10.98.67.139 with SMTP id l11mr10044663pfi.16.1474615611128; Fri, 23 Sep 2016 00:26:51 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id sq10si6552364pab.73.2016.09.23.00.26.50; Fri, 23 Sep 2016 00:26:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965101AbcIWH0u (ORCPT + 3 others); Fri, 23 Sep 2016 03:26:50 -0400 Received: from mail-pf0-f174.google.com ([209.85.192.174]:33709 "EHLO mail-pf0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934103AbcIWH0t (ORCPT ); Fri, 23 Sep 2016 03:26:49 -0400 Received: by mail-pf0-f174.google.com with SMTP id 21so39307809pfy.0 for ; Fri, 23 Sep 2016 00:26:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=8Wn1g09mJaP6mkRox9RkIti4zRq/OBwQAaivMXzMClA=; b=fCvD2cj4NEgxRUuGsaappAZlGN8FJr5uX41qlQzZ/gocsAZOrJQwMtEQelKMrAdEb+ 6m4PwYK6zyEdbDqF46uhKFWs42WESNlurmIEROL3LmjdLhd8nEjdgeraTkEU2qWFJ5Rj Ihht3bcMrUTq4flEoeh2dG7t+PXeBoIleSGc8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=8Wn1g09mJaP6mkRox9RkIti4zRq/OBwQAaivMXzMClA=; b=glQVJKfeOgHEG2l4idXBqIVWlfr2je593USFIf3Vnx0ldsDHSX6rvJj3LWONZon1Jl mRRHIWS78hgktPoWd0UIu8yRZgLAAJ4iVupvsPyU/ysX4qv+446YAKZ3kPw83TJxmTxd UjrdPUob6+q6FiCk6KAbupmVNlgjY5xnfLxWfzXTVpv+aBPXjvdshhDFRZfQf6YccbVQ gI9tY4uVKfqZKKvTuuiBAgzBnCtP4tvU/+Tc2qZ65Xmi2n5K9LEnW1dukpq433UgeTiu m7J0hHttGeITwXXaxiyGMsiAy/31uLvKt0Lhszb/pEp5O0r77k4CyuE0BIE9bIXXkXVR +Glg== X-Gm-Message-State: AE9vXwP9jg3n4fTdaszO1e/nodYC4xGeHjfn/ClBBB771CGZ5oqoOBA9XwTH6CO/EVFt9/1F X-Received: by 10.98.220.93 with SMTP id t90mr10108993pfg.30.1474615609109; Fri, 23 Sep 2016 00:26:49 -0700 (PDT) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id f16sm8823802pfd.84.2016.09.23.00.26.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Sep 2016 00:26:48 -0700 (PDT) From: AKASHI Takahiro To: catalin.marinas@arm.com, will.deacon@arm.com, jason.wessel@windriver.com Cc: linux-arm-kernel@lists.infradead.org, kgdb-bugreport@lists.sourceforge.net, stable@vger.kernel.org, AKASHI Takahiro Subject: [PATCH v2 1/3] arm64: kgdb: fix single stepping Date: Fri, 23 Sep 2016 16:33:25 +0900 Message-Id: <20160923073327.9657-2-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.10.0 In-Reply-To: <20160923073327.9657-1-takahiro.akashi@linaro.org> References: <20160923073327.9657-1-takahiro.akashi@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org After entering kgdb mode, the first 'stepi' can succeed, but the following 'stepi' never executes the next instruction. This is because a software step cannot get enabled as the software step bit(SS) in SPSR, which is cleared by the first single stepping, will not be set again for the following 's' commands. Please note that this bit, as well as the software step control bit(SS) in MDSCR, must be set before resuming the execution. kernel_active_single_step() called by kgdb_arch_handle_exception() checks only for the bit in MDSCR, and so kgdb_enable_single_step() will never be called. This patch removes kgdb_disable_single_step() from 'c' command handling and enables/disables a single step explicitly at every entry and exit of 's' command handling. Signed-off-by: AKASHI Takahiro Cc: Catalin Marinas Cc: Will Deacon Cc: Jason Wessel Cc: # 3.15- --- arch/arm64/kernel/kgdb.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) -- 2.10.0 -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/arm64/kernel/kgdb.c b/arch/arm64/kernel/kgdb.c index 8c57f64..afe5f90 100644 --- a/arch/arm64/kernel/kgdb.c +++ b/arch/arm64/kernel/kgdb.c @@ -189,14 +189,6 @@ int kgdb_arch_handle_exception(int exception_vector, int signo, * over and over again. */ kgdb_arch_update_addr(linux_regs, remcom_in_buffer); - atomic_set(&kgdb_cpu_doing_single_step, -1); - kgdb_single_step = 0; - - /* - * Received continue command, disable single step - */ - if (kernel_active_single_step()) - kernel_disable_single_step(); err = 0; break; @@ -211,8 +203,6 @@ int kgdb_arch_handle_exception(int exception_vector, int signo, */ kgdb_arch_update_addr(linux_regs, remcom_in_buffer); atomic_set(&kgdb_cpu_doing_single_step, raw_smp_processor_id()); - kgdb_single_step = 1; - /* * Enable single step handling */ @@ -244,6 +234,9 @@ NOKPROBE_SYMBOL(kgdb_compiled_brk_fn); static int kgdb_step_brk_fn(struct pt_regs *regs, unsigned int esr) { + kernel_disable_single_step(); + atomic_set(&kgdb_cpu_doing_single_step, -1); + kgdb_handle_exception(1, SIGTRAP, 0, regs); return 0; }