Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp555664img; Thu, 28 Feb 2019 04:13:45 -0800 (PST) X-Google-Smtp-Source: AHgI3IbCSuWTfEvFNIfW9tNBZAabXJGloDEJd4deaw8O3pffU5KBNZrAdrBI8zVwXos6Ci+/PTJH X-Received: by 2002:a17:902:e486:: with SMTP id cj6mr7635178plb.86.1551356025164; Thu, 28 Feb 2019 04:13:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551356025; cv=none; d=google.com; s=arc-20160816; b=FRNclMPAU/SIBGjnWsWHlU9BbwXuLe+DHj0m2MVvx4qJhraFrX7jDoXNovf3U1x4qi 4NvSVaMpUuvKNcn4dDx7p9ceZLVKNhXYrMd32A0AY/eWVIxrjf0WxbtnwD+WAx85RSKi AA70L2523CGvoXpovsZaa3mwcrP298zdH5KKp+OMfezkEOWLrnqUaDVgmGQNEnweDyFa fMB0ItgQXlz6AgLMvrD4sNs4gVKQNwLzKrGxv7jlRQfmtv4Dz7N7prgtCey+ScTmsuIT /okCkNqEFX62kk0B+EAacsYTs+G4n7Kg+Vhl+u8EOIRa22kqvRWpZ6ZneIroi+iLuJDb xfFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=7ITO7VoHceesrlJzLwvTY3Kyi5diDhZluE9weKl3xY0=; b=KR5zmVTUoG/SWHz3MLiv8vThtudxfluUtiYFTU+IgLP55DPLsYGNzQQ0zvc9Vcl6QL X9sGoRbgXvVY4ZnZYi5Njrq9VG2cUT2RXxAtJ4LCIatbzJkDL0VzsdvpCeFWQIAvEQgT gEAkWtgcyqv5IwzLrc1yCY7OhdeKqp6US73+UG5STB2BCkbyqDr6R8gpDQI/QdM8hvWb knSnbWhAnKOLV9lEeipza/4PU1h1cuPbnwckptyryGeD2dhFS0RiC6Ra8SzlEdYA3P0v m97VUFC9BlJiC2PiC22s1/LcF2tB7ZjToO3JL8LaFdFVSz5CT2zS4iOxtiy07MhmqbAL 1I7w== 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 o188si17793881pga.297.2019.02.28.04.13.29; Thu, 28 Feb 2019 04:13:45 -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; 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 S1730918AbfB1K5c (ORCPT + 99 others); Thu, 28 Feb 2019 05:57:32 -0500 Received: from 59-120-53-16.HINET-IP.hinet.net ([59.120.53.16]:12666 "EHLO ATCSQR.andestech.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727810AbfB1K5c (ORCPT ); Thu, 28 Feb 2019 05:57:32 -0500 X-Greylist: delayed 1516 seconds by postgrey-1.27 at vger.kernel.org; Thu, 28 Feb 2019 05:57:31 EST Received: from ATCSQR.andestech.com (localhost [127.0.0.2] (may be forged)) by ATCSQR.andestech.com with ESMTP id x1SAVbFZ086882 for ; Thu, 28 Feb 2019 18:31:37 +0800 (GMT-8) (envelope-from vincentc@andestech.com) Received: from mail.andestech.com (atcpcs16.andestech.com [10.0.1.222]) by ATCSQR.andestech.com with ESMTP id x1SAUwQJ086776; Thu, 28 Feb 2019 18:30:58 +0800 (GMT-8) (envelope-from vincentc@andestech.com) Received: from atcsqa06.andestech.com (10.0.15.65) by ATCPCS16.andestech.com (10.0.1.222) with Microsoft SMTP Server id 14.3.123.3; Thu, 28 Feb 2019 18:31:36 +0800 From: Vincent Chen To: , , , , , , CC: , Subject: [PATCH 0/3] riscv: Fix debug instruction check and support trap-based WARN() Date: Thu, 28 Feb 2019 18:31:28 +0800 Message-ID: <1551349891-22683-1-git-send-email-vincentc@andestech.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.0.15.65] X-DNSRBL: X-MAIL: ATCSQR.andestech.com x1SAUwQJ086776 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The handler for the debug exception will call is_valid_bugaddr(bugaddr) to check if the instruction in bugaddr is a real debug instruction. However, the expected instruction, ebreak, is possibly translated to c.ebreak by assmebler when C extension is supported. This patchset will add c.ebreak into the check mechanism. In addition, BUG() is currently unable to work in the kernel module due to an inappropriated condition in is_valid_bugaddr(). This issue will be fixed in this patchset. Finally, this patchset enables WARN() related functions to trap the code to help developers debug it. Vincent Chen (3): riscv: Add the support for c.ebreak check in is_valid_bugaddr() riscv: Support BUG() in kernel module riscv: Make WARN() related functions able to trigger a trap exception