Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1377208ybk; Sat, 16 May 2020 09:21:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9RPrDhn/jtroa8Me4hYwPORuFE5E3i5iXmUgoEoTVfrnSj22XjRndaatZ0Rkgd+s44Bi0 X-Received: by 2002:a17:906:f208:: with SMTP id gt8mr8261680ejb.358.1589646102533; Sat, 16 May 2020 09:21:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589646102; cv=none; d=google.com; s=arc-20160816; b=CxM9x4tTJNwMEk4YOgXF5N5ignOvQGtPsNhEkI78HrmQ3XGPOsoTmqtMIE5/o86Puf 0goW4pCHVQQ0WoUna+5jhXGr9K3pVdBwaKhzUh/bKz+Tfc11njljcvbF7d6nDIAmdf8v QMucgUwm/spiLUZtOCfRgA08DFoK9nqjNs8YOcYb/spNvKaSCpk2ODwZ5YKrHZp81FQX k5Eh1DSahKdyMSCK6Be5DYw7Raho2aiTF8cPLT3Pdaza1gN8VZXH4JydO9NCsa3kLZiS mDvNqRuB/aYGivmCiW57ynFjFop78ksmH354IH5/NExyV/gakhrf/vF2SMnMZMvukXpV HsIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=WhzEA2rdzJ/qx3T7SpNtVuwJgDYbiJVdLBcQA3bNs8A=; b=yKireQFluix7g4FkYzeSZdtxR9de6ceWLa0go8eEfLpxgTAeU7fN6XdpfyzXRP+fsR s7OGZxshtNUBLJJQiidEDCRoLKKqIhfD7dQMob/W+LoAYwaDjE/na9X3Hi53wldv02eb /bdcrqTYcokDOZhovVvElAy1lBN9To25limoq552MpMkBh65Lrcm5vdW6yWIJlwnwS0t swu65KbqGr/6izaMGMsHL3Zg4Y7n2UHWxoNiEJ8F9DDvE+bK5ggZDsO4fIzGgfUUiWrv 5InxFdbbQjU2KYsvCUSJdF7tXinL+q4lFI450u/C3y2NVsjlvCG7xaIJSJxXZpaRGt0N wh5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=YgBqetjJ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d60si3390251edc.337.2020.05.16.09.21.17; Sat, 16 May 2020 09:21:42 -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=@chromium.org header.s=google header.b=YgBqetjJ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726237AbgEPQRj (ORCPT + 99 others); Sat, 16 May 2020 12:17:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726210AbgEPQRi (ORCPT ); Sat, 16 May 2020 12:17:38 -0400 Received: from mail-vs1-xe42.google.com (mail-vs1-xe42.google.com [IPv6:2607:f8b0:4864:20::e42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88179C061A0C for ; Sat, 16 May 2020 09:17:38 -0700 (PDT) Received: by mail-vs1-xe42.google.com with SMTP id e20so2503190vsb.5 for ; Sat, 16 May 2020 09:17:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=WhzEA2rdzJ/qx3T7SpNtVuwJgDYbiJVdLBcQA3bNs8A=; b=YgBqetjJuGu+U2CSr3IXT7S0VcLJZklSs5FOWo9s5CkvscHIUC64gcW7V485YOzOC1 NNuphD5MyAq798pOdV2gcfVByhcfriBSf/54YWMa9faV1YKswN8X3eFgyNz3+hAG8l5L NtDorD3CsQFCeDSaWHDs6bojlLvtos36aOUvQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=WhzEA2rdzJ/qx3T7SpNtVuwJgDYbiJVdLBcQA3bNs8A=; b=d599n/swLYmLzuKAN2DmU2blywACd25qI5rLRuHVLRLtAxCeyfABBLH771RluHHG5K sd3Hsak3Y6lPFHRo5f/GeZhCSctG5Cs1S8m5nUZKuhrxFGl9NusGoSP2x1g6WR0pjtZR 3eMic1YwTuVLpHm0FeLPJFTnX4Mv3FWJ2+lLN7MWyt5rJcpCHLAFrzzWvi9rrTkWty2d tbtzV4XuNvRpthbfCdGeyCm2PHHgxz58DbgDMxd0hIuZ/YxYsOxf6FP8R9yi4ZX7x+e9 eMGZ297LcqgsPSqXNlDJC+Gf96tUARfrSp5q+ytVNTLejVRV++PvImPWA10sZ9/1km22 SWaw== X-Gm-Message-State: AOAM530yLJv8xrb8Krzj2V0cUd/r5q/DI+GlDPb3V2a3pVYwwVw1q+63 2sDDSf0BFU1MCwASEsrgpgxO9REYyvE= X-Received: by 2002:a67:b706:: with SMTP id h6mr6577398vsf.238.1589645857403; Sat, 16 May 2020 09:17:37 -0700 (PDT) Received: from mail-vk1-f177.google.com (mail-vk1-f177.google.com. [209.85.221.177]) by smtp.gmail.com with ESMTPSA id 66sm1330015vss.16.2020.05.16.09.17.36 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 16 May 2020 09:17:36 -0700 (PDT) Received: by mail-vk1-f177.google.com with SMTP id 134so1374571vky.2 for ; Sat, 16 May 2020 09:17:36 -0700 (PDT) X-Received: by 2002:a1f:4e46:: with SMTP id c67mr5887506vkb.92.1589645855867; Sat, 16 May 2020 09:17:35 -0700 (PDT) MIME-Version: 1.0 References: <20200509214159.19680-1-liwei391@huawei.com> <20200509214159.19680-3-liwei391@huawei.com> In-Reply-To: From: Doug Anderson Date: Sat, 16 May 2020 09:17:21 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 2/4] arm64: Extract kprobes_save_local_irqflag() and kprobes_restore_local_irqflag() To: "liwei (GF)" Cc: Daniel Thompson , Jason Wessel , Marc Zyngier , Mark Rutland , Masami Hiramatsu , David Miller , Will Deacon , Catalin Marinas , Linux ARM , LKML , liwei1412@163.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Sat, May 16, 2020 at 1:47 AM liwei (GF) wrote: > > >> - kprobes_save_local_irqflag(kcb, regs); > >> + kernel_prepare_single_step(&kcb->saved_irqflag, regs); > > > > Is there some reason to have two functions? It seems like every time > > you call kernel_enable_single_step() you'd want to call > > kernel_prepare_single_step(). ...and every time you call > > kernel_disable_single_step() you'd want to call > > kernel_cleanup_single_step(). > > > > Maybe you can just add the flags parameter to > > kernel_enable_single_step() / kernel_disable_single_step() and put the > > code in there? > > > > As kernel_enable_single_step() / kernel_disable_single_step() are also called in > breakpoint_handler() and watchpoint_handler(), i am not sure it's a right thing > to put the daif flag prepare/cleanup into them, especially we don't have a context > to save the flags. I think you misunderstood what I was suggesting. Maybe better with examples? I was suggesting doing this: kcb->saved_irqflag = kernel_enable_single_step(regs); ... kernel_disable_single_step(kcb->saved_irqflag, regs); To me that seems better than what you have now: kcb->saved_irqflag = kernel_prepare_single_step(regs); kernel_enable_single_step(regs); ... kernel_cleanup_single_step(kcb->saved_irqflag, regs); kernel_disable_single_step(); ...or am I confused? -Doug