Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp343682pxf; Thu, 8 Apr 2021 04:28:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxsLMlpwPOiKln/timXtuNVnvsLTgTTZwDIFAq9Wu3tUqeH0Isc/VP8CwGpDN6ji4tx/snq X-Received: by 2002:a17:907:7b8a:: with SMTP id ne10mr2452775ejc.371.1617881282217; Thu, 08 Apr 2021 04:28:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1617881282; cv=pass; d=google.com; s=arc-20160816; b=rEC/yFFyR/KMjsNmCqukTCQ5k3tgr0Ky1pJEnlHVI6IWUY8ArabrOvOvWHZ2upWzZM LpuHfv4ReiZ0HRhknSKRSS0FsSNhazvPezOQextd429tQdtDrf1iBKET8Mk2jSsrV0DD A3QQJeloHUd7Iq8Zzc7ed9MS+27cWW4BU2i/5b1XBWwP5bqZP8iHlrZhwp39GN+f9uyO PqlFIJ4vI8RUW5BHDxI1ZCMKaxXw03KQVQ5xCfGQCZzxEZKDOs53eoVcxKL9WgrY/dMK c0AMPw0ke4n58oTKWxs73q6+2lRNt0wXf0HuCpg23QQVS/Omd2X8FAS8/yBYmnaD11M1 SXEQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=W6nUXeQqefxKe+jBMnHze3fW0jQtSJ2Ek48XiydazlA=; b=xhzmV9l2wm8WTGCHQsPNoenFSFu3FvEoZRipYQNYS/OpeWBPOSe/ab1dwHm9827Q31 1GjbXEA5oTPABtW3OMvdWZIxLdwLZC5PR4c+tvhnjaHiRYwHXvhWNndHCkNf4E7Co04S lVEPupcydQ7sS1gA5xRbZeZApRBz2OgazlAG/YK0uxMe30n4nufjJcOuyVHgQ/XER/J7 mtCfHpMZrnD/4xM+/3CnCxttpPjVf+QRtm63mpRt0w0AXWJAnGPxgM7/vgN1AdXE7OhG Ho0CEBKO1H/PusnOcFyamkDKiMUp/DnaRBZyQBBgu/0DM90B+EuoOsm6e9nn6rvu7w7R VDig== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Synaptics.onmicrosoft.com header.s=selector2-Synaptics-onmicrosoft-com header.b="V6uji/W5"; arc=pass (i=1 spf=pass spfdomain=synaptics.com dkim=pass dkdomain=synaptics.com dmarc=pass fromdomain=synaptics.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=synaptics.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q14si8249524ejn.450.2021.04.08.04.27.39; Thu, 08 Apr 2021 04:28:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@Synaptics.onmicrosoft.com header.s=selector2-Synaptics-onmicrosoft-com header.b="V6uji/W5"; arc=pass (i=1 spf=pass spfdomain=synaptics.com dkim=pass dkdomain=synaptics.com dmarc=pass fromdomain=synaptics.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=synaptics.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231132AbhDHLY7 (ORCPT + 99 others); Thu, 8 Apr 2021 07:24:59 -0400 Received: from mail-bn8nam12on2063.outbound.protection.outlook.com ([40.107.237.63]:36097 "EHLO NAM12-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230411AbhDHLY6 (ORCPT ); Thu, 8 Apr 2021 07:24:58 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SiJH1EVytfQ3Z0MIl2+OEF6ZYa6NKxnBobQC5g7aD4ZQkcs6CPpS5YvamcOxsHezrj6q6z4ZhatHBF6DCoa3Kv0FVct6eXcFF0ubL7f1c4bZmfo5+b8UJ9iNNeE7Y+YGnAHehF5msCSPvghNWgtGDzfpWtKj4HXKnz53Q9Z/RYZBm0VJiVygf0IZ8e3ViyCJFxI1pxe7XEieIVmbby10VxI8eb9hySleG5XbzcNkC/IaxIgF9AQTAwD6T5N3nrXTtpEcFm9V5Xewy5Vr8LDHTwvCocC3+V9U3YxnGof+vwnoqSTAjHqbAV5KgH7QQZMkkt4hJc/yvTY/t5GgnehXjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=W6nUXeQqefxKe+jBMnHze3fW0jQtSJ2Ek48XiydazlA=; b=TtQB2G0uKmp+nsjnbhIkEkvIN5rHdq/cNf6I0MrumDD6BB4PQzu/Wk6aCxwrtAW9MHX3ItVP5KucC9a4fxixJ21BwX62nrkij5j12XmkyohPa86Kp9MZTNUnRvL0EcbixjzTd4+6cfbY929NWa1BsK5bkPtl+/i3lX9xMtAxGE+xWkBesbSHbyoGvwZUGTNs/yChdiBJQb0uxbwC3Scr73nKViq4Cz/ayWbM/R50Hw4ITHF3+y7kSxNCEPx/A8qxenWMqNUixhk/K0xQUOQJxgCDyi+lBSXGCsjcMoOTK+ZYA4mjooAXQLGzT3D5t+9SKtqoeasQsU7jN8+DcGdNAw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=synaptics.com; dmarc=pass action=none header.from=synaptics.com; dkim=pass header.d=synaptics.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Synaptics.onmicrosoft.com; s=selector2-Synaptics-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=W6nUXeQqefxKe+jBMnHze3fW0jQtSJ2Ek48XiydazlA=; b=V6uji/W5r9T3io35Tro+w/NrezDaOv8GianvMPfitUmboy9JWrssSswXU3UQIqSW1Eo8sx6qHA2kF9Hcn1hQ9xMIEpqbMTM4H890ILYDJwG98HbRy4E1J9OVhLO469vau3GSdviTXmJSWnLEi4T0+ZPUsG+fpy0l8F+KOeWbOoc= Authentication-Results: orcam.me.uk; dkim=none (message not signed) header.d=none;orcam.me.uk; dmarc=none action=none header.from=synaptics.com; Received: from BY5PR03MB5345.namprd03.prod.outlook.com (2603:10b6:a03:219::16) by BYAPR03MB4423.namprd03.prod.outlook.com (2603:10b6:a03:c6::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.16; Thu, 8 Apr 2021 11:24:45 +0000 Received: from BY5PR03MB5345.namprd03.prod.outlook.com ([fe80::8569:341f:4bc6:5b72]) by BY5PR03MB5345.namprd03.prod.outlook.com ([fe80::8569:341f:4bc6:5b72%9]) with mapi id 15.20.3999.033; Thu, 8 Apr 2021 11:24:45 +0000 Date: Thu, 8 Apr 2021 19:23:48 +0800 From: Jisheng Zhang To: "Maciej W. Rozycki" Cc: Masami Hiramatsu , Jisheng Zhang , Paul Walmsley , Palmer Dabbelt , Albert Ou , Guo Ren , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] riscv: keep interrupts disabled for BREAKPOINT exception Message-ID: <20210408192348.1d50c588@xhacker.debian> In-Reply-To: References: <20210330021624.2b776386@xhacker> <20210330183316.942215efe8e6e8455ad14113@kernel.org> <20210331222244.45a5807c@xhacker> <20210401093036.037f2abbce7ed5d1e68466b7@kernel.org> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Originating-IP: [192.147.44.204] X-ClientProxiedBy: BY5PR16CA0036.namprd16.prod.outlook.com (2603:10b6:a03:1a0::49) To BY5PR03MB5345.namprd03.prod.outlook.com (2603:10b6:a03:219::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from xhacker.debian (192.147.44.204) by BY5PR16CA0036.namprd16.prod.outlook.com (2603:10b6:a03:1a0::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.17 via Frontend Transport; Thu, 8 Apr 2021 11:24:42 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8130316d-07b3-45ba-aa9d-08d8fa80e95e X-MS-TrafficTypeDiagnostic: BYAPR03MB4423: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qHfohw170oZWeiqI9WKcHEeif11G/paGCrqZoxD4foyjY8PA2ib1I5bKNR75SjyoIoZPST70mRr1jzMzuZOQFUDx9DCy2O7F7qxhR3o09pClLIxIOG91/VF/nYtf+YQBPK/uuNdU5ni73XgeP8IxwcMKbpgk+/8Se8WPvvnKqwf/7SV2MFdncmCB5x18GMads33WFJl1R/aRRYIdOZIU1B9AFpcdH3O+afmeZnc7zOK6I6Je7znjs7BphGsdUpluFIDC9RS9FQvD5PfefYgBnWVaSpvw4Kwsx8GT9vLpLTN6XNKFRDZ2ISxjYfYfN+F3nHePNOu/SmSPYBNTH7Hp7SHZIExotqWFbZFeVMOVWCZ0lWpxc22GhqDms9bsh84JETNcufJbcLmJ98OfWfUKurezLYtUlI8t9HYQ6+v3nApmgG0CfmH271mUJJuRD/b+JtNvTt3XB+Fj0cPcY0ayVhDFi3KiI2enEg2rUuPzyZo41uJtpgkZk9Q+mmXvQKkW0IJP9vxqwhQMvKgEc/WsE+tp/Any5VqKxXmi7YI8mrZvrRYL6hrfujeaXuwXqQuSZN5gn1EJr4bTF9X1jknTVN4zmgNf7MRquNCqYV6BCYKLYhOXte6KMZZttg+Ko0dWNmdoSYe0G90cZUozz3NuxNmBj8N+1HGPRkDeZa+PIiPvuPEWaJ2P9RvNmdev6mNt X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR03MB5345.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(396003)(376002)(366004)(39860400002)(346002)(136003)(2906002)(9686003)(52116002)(7696005)(4326008)(5660300002)(55016002)(66946007)(26005)(6506007)(86362001)(38100700001)(66476007)(66556008)(186003)(478600001)(316002)(8676002)(83380400001)(6916009)(54906003)(38350700001)(1076003)(956004)(8936002)(16526019);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?544R491pXTDksRYrmIzCsgx0+UfZfoclw4cCwuFoF8pmSxGPkmniIxg+h8y8?= =?us-ascii?Q?giI5uSZSGXwNRUJPZMP/SZku19RlbqoW3P9SR+JJ7L+61Bac2y4Im+sF+yoX?= =?us-ascii?Q?+gAU+yYJ1FcxRLDNgbioE6i+RIVRnx7o1L/3GQKgRTyHKeFrpBhFUpoddqtg?= =?us-ascii?Q?VCZgBI62ltLj4d2W60B7hBVgXSgGHUVv6bFT9TRoGby2OImOeToYTXF8MajM?= =?us-ascii?Q?NuFWDHHmY+fdFdbbW6Tt4GnqksGqewuXbsjhoZ8NpzkLiXqBNG5P1FREKXud?= =?us-ascii?Q?HUWQhgoB/Bf+hqoZVL4jdGBrAzk2U4ov0lfkLLYsY7mRtNI2yVGl6m7G6uST?= =?us-ascii?Q?HzAfi/+jtSdBJlYazgFfoxBxhjUeJ3vExbcxQ3XMPefwhU6pVaq/LNANqbDE?= =?us-ascii?Q?ur9wpFOs2VuCKmyF107QWsHqHLfLelp9ZRfJi9zI38rMb++mRxxxF9UpY/tK?= =?us-ascii?Q?oJoF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X-MS-Exchange-CrossTenant-Network-Message-Id: 8130316d-07b3-45ba-aa9d-08d8fa80e95e X-MS-Exchange-CrossTenant-AuthSource: BY5PR03MB5345.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Apr 2021 11:24:45.2342 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335d1fbc-2124-4173-9863-17e7051a2a0e X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 8v48ak4WF4Kn9oOMM0xyERmyVZekGM6wpX0TQaVHnZdJj5TTnb1NI0zqoXSb/BZOgC/mn7K7Ds6dhtm+D5uEYw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR03MB4423 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 3 Apr 2021 20:30:53 +0200 (CEST) "Maciej W. Rozycki" wrote: > CAUTION: Email originated externally, do not click links or open attachments unless you recognize the sender and know the content is safe. > > > On Thu, 1 Apr 2021, Masami Hiramatsu wrote: > > > > > > Current riscv's kprobe handlers are run with both preemption and > > > > > interrupt enabled, this violates kprobe requirements. Fix this issue > > > > > by keeping interrupts disabled for BREAKPOINT exception. > > > > > > > > Not only while the breakpoint exception but also until the end of > > > > the single step (maybe you are using __BUG_INSN_32 ??) need to be > > > > disable interrupts. Can this do that? > > > > > > > > > > interrupt is disabled during "single step" by kprobes_save_local_irqflag() > > > and kprobes_restore_local_irqflag(). The code flow looks like: > > > > > > do_trap_break() // for bp > > > kprobe_breakpoint_handler() > > > setup_singlestep() > > > kprobes_restore_local_irqflag() > > > > > > do_trap_break() // for ss > > > kprobe_single_step_handler() > > > kprobes_restore_local_irqflag() > > > > OK, thanks for the confirmation! > > Is this approach guaranteed to keep interrupt handling latency low enough > for the system not to be negatively affected, e.g. for the purpose of NTP > timekeeping? IMHO, interrupt latency can't be ensured if kprobes is triggered. thanks