From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-x531.google.com (mail-pg1-x531.google.com [IPv6:2607:f8b0:4864:20::531]) by sourceware.org (Postfix) with ESMTPS id B2CC83858D32 for ; Mon, 2 Jan 2023 18:10:49 +0000 (GMT) Received: by mail-pg1-x531.google.com with SMTP id f3so18731967pgc.2 for ; Mon, 02 Jan 2023 10:10:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=tSuyFgPbDU3RP4XdJ9JBAX9wJHhjH+isnye+U7yjh3w=; b=QgeXCGr1oagPUKMSyvMGJQfkDMeTCzC/dzUFqvsxcPwas96R+m4trJfcidXAzuj0MW Bvg9rKWRgAIQPDcN9y5/xoYuWM5PZVhwwjlzQ0datmb+tquZR0fHrjIHKkbtojwqNrcv suBom2+bNQ6ARRC2J0w0DvnoA7vOAhXqpuCpz6gNJpLRsBIsHa7uJIjOgJd65Nwcng8/ HhU+PJk3t+ev+hE7KP1/E0V6nIOofifNK6g3kIPLyphQB6BdZCVXNw5bxvcR816ZP79a P1VCDpx3M5BB0LK1xtCImNNxnjTZwpiVu7Owz1XRgBMtU9kz5A2PzABHx2MuiPJxenpY e9eA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=tSuyFgPbDU3RP4XdJ9JBAX9wJHhjH+isnye+U7yjh3w=; b=wgckL3MZ4+GEI99fb53TsSW2dbktzbGTXOAdPpfie8IYcqzkpH/I1TsJRp5ANvDHkn axHLhUoxeqNUGCB7esJbswWeUK18MG1Lv8P6fx63T/mMUCWYUxfQc0gq9fjkhtxfgvtM wZKSMuEBM7tAGPH6ZXyr3CJx8z+CaBRjgkt9oVpNJtvX3hZIMtRhuxnhkL94ZWJ2Jxpe TchFWcTXNyR5NGnyerMWEXYfNQRme70bpgJpfwoDgmBoDYN4SKvAvT1zCuLwvhN6FfOM F15W3p8gIPdan+7zJ1j2TYjGA10MvhOcQX93UiEGhDnLuYwib7QLej7u6fXHIlZ1Fnis VQww== X-Gm-Message-State: AFqh2kpJhrBdT5iCWMvxHp6TMRAJ0BKUUFq9WVvCf6kzaIW5tUcSlmL7 dN72WyM/EWYcm9BFlso/wZZDiWWkzIlm6bZ607bEVCccQCA= X-Google-Smtp-Source: AMrXdXskGmsreOBFX3kzxV6LliAlYT3J+W5yUkWwhGxLobpkYOSYkHAogXqcK/pJctGlucjXBGS5MWEnPJg3T192HR4= X-Received: by 2002:a63:751:0:b0:434:7885:6ade with SMTP id 78-20020a630751000000b0043478856ademr2877287pgh.243.1672683048544; Mon, 02 Jan 2023 10:10:48 -0800 (PST) MIME-Version: 1.0 References: <87tu18naqq.fsf@oldenburg.str.redhat.com> In-Reply-To: From: Andrew Pinski Date: Mon, 2 Jan 2023 10:10:35 -0800 Message-ID: Subject: Re: Hardware watchpoints on GNU/Linux AArch64 To: Florian Weimer Cc: gdb@sourceware.org, Dmitry Belyavskiy Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,KAM_NUMSUBJECT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Mon, Jan 2, 2023 at 9:39 AM Andrew Pinski wrote: > > On Mon, Jan 2, 2023 at 9:28 AM Andrew Pinski wrote: > > > > On Mon, Jan 2, 2023 at 8:49 AM Florian Weimer via Gdb > > wrote: > > > > > > Running > > > > > > gdb-12.1-10.fc38.aarch64 > > > kernel-6.2.0-0.rc1.20221230gitbff687b3dad6.15.fc38.aarch64 > > > > > > I do not seem to be able to use hardware watchpoints. GDB just logs > > > warnings: > > > > > > warning: Unable to determine the number of hardware watchpoints available. > > > warning: Unable to determine the number of hardware breakpoints available. > > > > This shows up when the ptrace either fails or ptrace returns an > > unknown value for AARCH64_DEBUG_ARCH value. > > In the boot log there should be a message saying how many HW > > breakpoint and watchpoints there are and what version of the debug > > arch is there. > > The supported values for debug arch are: > > #define AARCH64_DEBUG_ARCH_V8 0x6 > > #define AARCH64_DEBUG_ARCH_V8_1 0x7 > > #define AARCH64_DEBUG_ARCH_V8_2 0x8 > > #define AARCH64_DEBUG_ARCH_V8_4 0x9 > > > > I don't know of any other values that can be reported, especially for > > Neoverse-N1 (which should be 8_2). Neoverse-N2 is 8_4. > > The kernel fills in that field with ptrace via: > u8 debug_monitors_arch(void) > { > return cpuid_feature_extract_unsigned_field(read_sanitised_ftr_reg(SYS_ID_AA64DFR0_EL1), > ID_AA64DFR0_EL1_DebugVer_SHIFT); > } > > So either kvm/qemu is setting that EL1 (system) register incorrectly > or the KVM Invocation didn't turn on HW breakpoints. Or KVM does not > support HW breakpoints yet. Looking KVM sources (arch/arm64/kvm/sys_regs.c) inside the kernel we see: /* Limit debug to ARMv8.0 */ val &= ~ARM64_FEATURE_MASK(ID_AA64DFR0_EL1_DebugVer); val |= FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64DFR0_EL1_DebugVer), 6); Which was added by 94893fc9ad8cd for 5.12 unless this changed post Linux 6.0 . So a value of 6 should be good to go. Thanks, Andrew Pinski > > Thanks, > Andrew > > > > > > Thanks, > > Andrew Pinski > > > > > > > > I see AArch64-specific code in GDB, so this is a bit of a surprise to > > > me. > > > > > > The machine uses virtualization: > > > > > > Architecture: aarch64 > > > CPU op-mode(s): 32-bit, 64-bit > > > Byte Order: Little Endian > > > CPU(s): 3 > > > On-line CPU(s) list: 0-2 > > > Vendor ID: ARM > > > BIOS Vendor ID: QEMU > > > Model name: Neoverse-N1 > > > BIOS Model name: virt-rhel8.6.0 CPU @ 2.0GHz > > > BIOS CPU family: 1 > > > Model: 1 > > > Thread(s) per core: 1 > > > Core(s) per socket: 1 > > > Socket(s): 3 > > > Stepping: r3p1 > > > BogoMIPS: 50.00 > > > Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp > > > asimdhp cpuid asimdrdm lrcpc dcpop asimddp ssbs > > > > > > Is this actually expected to work? Would we have more luck on a > > > bare-metal system? > > > > > > Thanks, > > > Florian > > >