Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp1280342pxb; Fri, 21 Jan 2022 14:13:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJxUpCEU7hctmOFKr5fSCvN9doHStELTOjPj6cF3Dvtc6pyLQe+uJOFK881/PbbWjH5ozn0Q X-Received: by 2002:a17:902:e0c4:b0:14a:9ad7:9a02 with SMTP id e4-20020a170902e0c400b0014a9ad79a02mr5304538pla.109.1642803187656; Fri, 21 Jan 2022 14:13:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642803187; cv=none; d=google.com; s=arc-20160816; b=JWoBgFbXeagwHXeM+6URe9R+gtgRXzZqL3TNzDv2R/l3F94dF0hc2FjdnK1aeAv117 OpC7j4UvqwYmCKL5Q5DDUd7zO0CnL6ta1bAx7PR1WCMkQlIjcgJSTZrUaaVu4WYgyu9I DOGKOVt4S4fPosqF+SKK6zWi5RCjcNQvj9WNNe6nWWsBGG9a4rzlGM3GjqHDhyX5H3So rNOJRlskmmtc+NWLPXx/VMxMCgKSWNqMxDYC8nxGfAH3WFsaQpWIlUGyX1i7HbMkC6Jc cWPCK/6oiz48LwereMq91INQGhvBGoFMJuLi3g7JJy1HxStoaTP0Z6IgeHCdE7HGlsTF EqcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=Q517tTr/OE7+FoaZ4PZQ3o74fISYYqKhdrrzJPqaSQQ=; b=Z8Co8FswzEo+5pruYfvSeubnbCSx2U0iN9wqGnIjK/1OHzYNuY1Lkn/2nFsKmizhqD EbrfyDGrVnzfWSYnEd3Xl7hqRj+PNtA19vbcssxynaZjpbsYUDAN4IgCW5qp0+ihKUu1 3GH7sbadYcu5tPRe7PwqwtAZIjj+pkgoDQvhdZJ6muncf1hnSva0U2DGBOfNklVWFWAJ yFk1dYUJ+++82gmJ+SP192ESwuk3OPrlW0ioGuB/NlvfLy0hVKfHZVMaDnzZHKB95lEQ +2B7qJF+EZrE3FZ9Bur9EKVep0ktiUon2Yjmzi2I6RdHAIyHZSyVF9tI5tSRBAvuyp4j e6BQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=uM7q3qTx; dkim=neutral (no key) header.i=@suse.de header.b=MCIQBGHa; 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=suse.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r11si4041613plr.178.2022.01.21.14.12.55; Fri, 21 Jan 2022 14:13:07 -0800 (PST) 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=@suse.de header.s=susede2_rsa header.b=uM7q3qTx; dkim=neutral (no key) header.i=@suse.de header.b=MCIQBGHa; 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=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245344AbiATOB3 (ORCPT + 99 others); Thu, 20 Jan 2022 09:01:29 -0500 Received: from smtp-out2.suse.de ([195.135.220.29]:47998 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244837AbiATOB2 (ORCPT ); Thu, 20 Jan 2022 09:01:28 -0500 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 4ADBA1F3AA; Thu, 20 Jan 2022 14:01:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1642687287; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Q517tTr/OE7+FoaZ4PZQ3o74fISYYqKhdrrzJPqaSQQ=; b=uM7q3qTxQ7p4QrOXIJDqYls0Zt1hb2zDc36VDlSMFrRy6PhK6lNN9CyRIZcK9EyQZlS9hL e5ALY10l7aDXyaW4Q0UMX3eW9wKgItXbucy0W0Zjc4Hm32mmuALOd2OQiIM53kkHpyazHu hGhzMUtkrRVDxR5D2i2OCXILBxyABNM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1642687287; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Q517tTr/OE7+FoaZ4PZQ3o74fISYYqKhdrrzJPqaSQQ=; b=MCIQBGHaDTkl0bR7Skcjq7aBnAqega56KbTNGP7MXskdWP+fJ4YRx7myX4C4XK2Ix0o5kO VGOnC919zDVVVOAA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 2675113EA6; Thu, 20 Jan 2022 14:01:27 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id LxaeCTdr6WHRDgAAMHmgww (envelope-from ); Thu, 20 Jan 2022 14:01:27 +0000 Date: Thu, 20 Jan 2022 15:01:26 +0100 From: Daniel Wagner To: Ming Lei Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Jens Axboe , Hannes Reinecke Subject: Re: [PATCH 2/2] block: hold queue lock while iterating in diskstats_show Message-ID: <20220120140126.ntzvrcmczd7pph75@carbon.lan> References: <20220120105248.117025-1-dwagner@suse.de> <20220120105248.117025-3-dwagner@suse.de> <20220120131936.mlug7nhnoe73abx5@carbon.lan> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="z5lccj23sq3wwiaf" Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --z5lccj23sq3wwiaf Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Jan 20, 2022 at 09:51:18PM +0800, Ming Lei wrote: > Then Can you figure out where blk_mq_queue_tag_busy_iter+0x1e4 points to > in source code? And what is NULL pointer? Here we go: /usr/src/debug/kernel-default-5.3.18-59.27.1.x86_64/linux-5.3/linux-obj/../include/linux/sbitmap.h: 249 0xffffffffb244a254 : mov (%rax),%rdx 234static inline void __sbitmap_for_each_set(struct sbitmap *sb, 235 unsigned int start, 236 sb_for_each_fn fn, void *data) 237{ 238 unsigned int index; 239 unsigned int nr; 240 unsigned int scanned = 0; 241 242 if (start >= sb->depth) 243 start = 0; 244 index = SB_NR_TO_INDEX(sb, start); 245 nr = SB_NR_TO_BIT(sb, start); 246 247 while (scanned < sb->depth) { 248 unsigned long word; 249 unsigned int depth = min_t(unsigned int, 250 sb->map[index].depth - nr, 251 sb->depth - scanned); --z5lccj23sq3wwiaf Content-Type: application/vnd.mobius.dis Content-Disposition: attachment; filename="blk_mq_queue_tag_busy_iter.dis" Content-Transfer-Encoding: quoted-printable 0xffffffffbaa4a070 : nopl 0x0(%rax,%rax,1) [F= TRACE NOP]=0A0xffffffffbaa4a075 : push %r15= =0A0xffffffffbaa4a077 : push %r14=0A0xfffff= fffbaa4a079 : push %r13=0A0xffffffffbaa4a07= b : push %r12=0A0xffffffffbaa4a07d : push %rbp=0A0xffffffffbaa4a07e : push %rbx=0A0xffffffffbaa4a07f : sub $0x60,%rsp=0A0xffffffffbaa4a083 : mov %rdi,0x8(%rsp)=0A0xffffffffbaa4a088 : mov %rsi,0x10(%rsp)=0A0xffffffffbaa4a08d : mov %rdx,0x18(%rsp)=0A0xffffffffbaa4a092 : mov %gs:0x28,%rcx=0A0xffffffffbaa4a09b : mov %rcx,0x58(%rsp)=0A0xffffffffbaa4a0a0 : xor %ecx,%ecx=0A0xffffffffbaa4a0a2 : mov 0x600(%rdi),%rax=0A0xffffffffbaa4a0a9 : test $0x3,%al=0A0xffffffffbaa4a0ab : jne 0xffffffffbaa4a2ea =0A0xffffff= ffbaa4a0b1 : incq %gs:(%rax)=0A0xffffffffb= aa4a0b5 : mov 0x8(%rsp),%rax=0A0xffffffff= baa4a0ba : movl $0x0,0x4(%rsp)=0A0xfffffff= fbaa4a0c2 : mov 0x40(%rax),%edx=0A0xfffff= fffbaa4a0c5 : test %edx,%edx=0A0xffffffffb= aa4a0c7 : je 0xffffffffbaa4a19a =0A0xffffffffbaa4a0cd : mov 0x8(%rsp),%rdi=0A0xffffffffbaa4a0d2 : movslq 0x4(%rsp),%rax=0A0xffffffffbaa4a0d7 : mov 0x38(%rdi),%rdx=0A0xffffffffbaa4a0db : mov (%rdx,%rax,8),%r13=0A0xffffffffbaa4a0df : cmpw $0x0,0xf6(%r13)=0A0xffffffffbaa4a0e8 : mov 0x138(%r13),%r14=0A0xffffffffbaa4a0ef : je 0xffffffffbaa4a183 =0A0xffffffffbaa4a0f5 : test %r14,%= r14=0A0xffffffffbaa4a0f8 : je 0xfffffff= fbaa4a183 =0A0xffffffffbaa4a0fe : mov 0x4(%r14),%eax=0A0xffffffffbaa4a102 : test %eax,%eax=0A0xffffffffbaa4a104 : jne 0xffffffffbaa4a207 =0A0xffffffffbaa4a10a : mov 0x10(%r= sp),%rax=0A0xffffffffbaa4a10f : mov 0x10= (%r14),%r15=0A0xffffffffbaa4a113 : xor %= ebp,%ebp=0A0xffffffffbaa4a115 : mov %r13= ,0x38(%rsp)=0A0xffffffffbaa4a11a : movb $= 0x0,0x50(%rsp)=0A0xffffffffbaa4a11f : xor = %r13d,%r13d=0A0xffffffffbaa4a122 : mov = %rax,0x40(%rsp)=0A0xffffffffbaa4a127 : mov= 0x18(%rsp),%rax=0A0xffffffffbaa4a12c : = mov %rax,0x48(%rsp)=0A0xffffffffbaa4a131 : mov (%r15),%ebx=0A0xffffffffbaa4a134 = : test %ebx,%ebx=0A0xffffffffbaa4a136 : j= e 0xffffffffbaa4a183 =0A0xffffffffbaa4a= 138 : mov %ebp,%eax=0A0xffffffffbaa4a13a= : sub %r13d,%ebx=0A0xffffffffbaa4a13d <= blk_mq_queue_tag_busy_iter+205>: lea (%rax,%rax,2),%rax=0A0xffffffffbaa4= a141 : shl $0x6,%rax=0A0xffffffffbaa4a14= 5 : add 0x10(%r15),%rax=0A0xffffffffbaa4= a149 : mov (%rax),%rdx=0A0xffffffffbaa4a= 14c : cmp %edx,%ebx=0A0xffffffffbaa4a14e= : cmovae %edx,%ebx=0A0xffffffffbaa4a151 : mov 0x80(%rax),%rdx=0A0xffffffffbaa4a158= : add %ebx,%r13d=0A0xffffffffbaa4a15b <= blk_mq_queue_tag_busy_iter+235>: not %rdx=0A0xffffffffbaa4a15e : and 0x40(%rax),%rdx=0A0xffffffffbaa4a162 : test %rdx,%rdx=0A0xffffffffbaa4a165 : mov %rdx,0x30(%rsp)=0A0xffffffffbaa4a16a : jne 0xffffffffbaa4a1c7 =0A0xffffffffbaa4a16c : add $= 0x1,%ebp=0A0xffffffffbaa4a16f : cmp 0x8(= %r15),%ebp=0A0xffffffffbaa4a173 : mov (%= r15),%ebx=0A0xffffffffbaa4a176 : mov $0x= 0,%eax=0A0xffffffffbaa4a17b : cmovae %eax,%= ebp=0A0xffffffffbaa4a17e : cmp %r13d,%eb= x=0A0xffffffffbaa4a181 : ja 0xffffffffb= aa4a138 =0A0xffffffffbaa4a183 : mov 0x8(%rsp),%rcx=0A0xffffffffbaa4a188 : addl $0x1,0x4(%rsp)=0A0xffffffffbaa4a18d : mov 0x4(%rsp),%eax=0A0xffffffffbaa4a191 : cmp %eax,0x40(%rcx)=0A0xffffffffbaa4a194 : ja 0xffffffffbaa4a0cd =0A0xffffffffbaa4a19a : mov = 0x8(%rsp),%rdi=0A0xffffffffbaa4a19f : callq= 0xffffffffbaa3b820 =0A0xffffffffbaa4a1a4 : mov 0x58(%rsp),%rax=0A0xffffffffbaa4a1a9 : xor %gs:0x28,%rax=0A0xffffffffbaa4a1b2 : jne 0xffffffffbaa4a344 =0A0xffffffffbaa4a1b8 : add $0x60,%= rsp=0A0xffffffffbaa4a1bc : pop %rbx=0A0x= ffffffffbaa4a1bd : pop %rbp=0A0xffffffff= baa4a1be : pop %r12=0A0xffffffffbaa4a1c0= : pop %r13=0A0xffffffffbaa4a1c2 : pop %r14=0A0xffffffffbaa4a1c4 : pop %r15=0A0xffffffffbaa4a1c6 : retq =0A0xffffffffbaa4a1c7 : m= ov %ebx,%r14d=0A0xffffffffbaa4a1ca : xor= %edx,%edx=0A0xffffffffbaa4a1cc : jmp = 0xffffffffbaa4a1d3 =0A0xffffffffbaa4a1ce <= blk_mq_queue_tag_busy_iter+350>: lea 0x1(%r12),%edx=0A0xffffffffbaa4a1d3= : lea 0x30(%rsp),%rdi=0A0xffffffffbaa4a= 1d8 : mov %r14,%rsi=0A0xffffffffbaa4a1db= : callq 0xffffffffbaa8b2d0 =0A0xffffffffbaa4a1e0 : cmp %eax,%ebx= =0A0xffffffffbaa4a1e2 : mov %rax,%r12=0A= 0xffffffffbaa4a1e5 : jbe 0xffffffffbaa4a= 16c =0A0xffffffffbaa4a1e7 : mov 0x4(%r15),%ecx=0A0xffffffffbaa4a1eb : mov %ebp,%esi=0A0xffffffffbaa4a1ed : lea 0x38(%rsp),%rdx=0A0xffffffffbaa4a1f2 : mov %r15,%rdi=0A0xffffffffbaa4a1f5 : shl %cl,%esi=0A0xffffffffbaa4a1f7 : add %eax,%esi=0A0xffffffffbaa4a1f9 : callq 0xffffffffbaa49880 =0A0xffffffffbaa4a1fe : test %al,%al=0A0xffffffffbaa4a200 : jne 0xffffffffbaa4a1ce =0A0xffffffffbaa4a202 : jmpq 0xfffffff= fbaa4a183 =0A0xffffffffbaa4a207 : mov 0x10(%rsp),%rax=0A0xffffffffbaa4a20c : mov 0x18(%r14),%r15=0A0xffffffffbaa4a210 : xor %r12d,%r12d=0A0xffffffffbaa4a213 : mov %r13,0x38(%rsp)=0A0xffffffffbaa4a218 : movb $0x1,0x50(%rsp)=0A0xffffffffbaa4a21d = : xor %ebp,%ebp=0A0xffffffffbaa4a21f : mov %rax,0x40(%rsp)=0A0xffffffffbaa4a224 = : mov 0x18(%rsp),%rax=0A0xffffffffbaa4a2= 29 : mov %rax,0x48(%rsp)=0A0xffffffffbaa= 4a22e : mov (%r15),%ebx=0A0xffffffffbaa4= a231 : test %ebx,%ebx=0A0xffffffffbaa4a23= 3 : je 0xffffffffbaa4a10a =0A0xffffffffbaa4a239 : = mov %r13,0x20(%rsp)=0A0xffffffffbaa4a23e : mov %r14,0x28(%rsp)=0A0xffffffffbaa4a243 : mov %ebp,%eax=0A0xffffffffbaa4a245 : sub %r12d,%ebx=0A0xffffffffbaa4a248 := lea (%rax,%rax,2),%rax=0A0xffffffffbaa4a24c : shl $0x6,%rax=0A0xffffffffbaa4a250 : add 0x10(%r15),%rax=0A0xffffffffbaa4a254 : mov (%rax),%rdx=0A0xffffffffbaa4a257 : cmp %edx,%ebx=0A0xffffffffbaa4a259 : cmovae %edx,%ebx=0A0xffffffffbaa4a25c : = mov 0x80(%rax),%rdx=0A0xffffffffbaa4a263 : add %ebx,%r12d=0A0xffffffffbaa4a266 := not %rdx=0A0xffffffffbaa4a269 : and = 0x40(%rax),%rdx=0A0xffffffffbaa4a26d : test= %rdx,%rdx=0A0xffffffffbaa4a270 : mov = %rdx,0x30(%rsp)=0A0xffffffffbaa4a275 : jne = 0xffffffffbaa4a29d =0A0xffffffffbaa4a277= : add $0x1,%ebp=0A0xffffffffbaa4a27a : cmp 0x8(%r15),%ebp=0A0xffffffffbaa4a27e = : mov (%r15),%ebx=0A0xffffffffbaa4a281 <= blk_mq_queue_tag_busy_iter+529>: mov $0x0,%eax=0A0xffffffffbaa4a286 : cmovae %eax,%ebp=0A0xffffffffbaa4a289 : cmp %r12d,%ebx=0A0xffffffffbaa4a28c : ja 0xffffffffbaa4a243 =0A0xffffffffbaa4a28e : mov 0x20= (%rsp),%r13=0A0xffffffffbaa4a293 : mov 0= x28(%rsp),%r14=0A0xffffffffbaa4a298 : jmpq = 0xffffffffbaa4a10a =0A0xffffffffbaa4a29d = : xor %r8d,%r8d=0A0xffffffffbaa4a2a0 : mov %ebx,%r13d=0A0xffffffffbaa4a2a3 : mov %r8d,%edx=0A0xffffffffbaa4a2a6 : jmp 0xffffffffbaa4a2ac =0A0xffffffffbaa4a2a8 : lea 0x1= (%r14),%edx=0A0xffffffffbaa4a2ac : lea 0= x30(%rsp),%rdi=0A0xffffffffbaa4a2b1 : mov = %r13,%rsi=0A0xffffffffbaa4a2b4 : callq 0= xffffffffbaa8b2d0 =0A0xffffffffbaa4a2b9 : cmp %eax,%ebx=0A0xffffffffbaa4a2bb : mov %rax,%r14=0A0xffffffffbaa4a2be : jbe 0xffffffffbaa4a277 =0A0xffff= ffffbaa4a2c0 : mov 0x4(%r15),%ecx=0A0xff= ffffffbaa4a2c4 : mov %ebp,%esi=0A0xfffff= fffbaa4a2c6 : lea 0x38(%rsp),%rdx=0A0xff= ffffffbaa4a2cb : mov %r15,%rdi=0A0xfffff= fffbaa4a2ce : shl %cl,%esi=0A0xffffffffb= aa4a2d0 : add %eax,%esi=0A0xffffffffbaa4= a2d2 : callq 0xffffffffbaa49880 = =0A0xffffffffbaa4a2d7 : test %al,%al=0A0x= ffffffffbaa4a2d9 : jne 0xffffffffbaa4a2a= 8 =0A0xffffffffbaa4a2db : mov 0x20(%rsp),%r13=0A0xffffffffbaa4a2e0 : mov 0x28(%rsp),%r14=0A0xffffffffbaa4a2e5 : jmpq 0xffffffffbaa4a10a =0A0xffffffffbaa4a2ea : mov 0x8(%rsp= ),%rax=0A0xffffffffbaa4a2ef : mov 0x5f8(= %rax),%rdx=0A0xffffffffbaa4a2f6 : test %r= dx,%rdx=0A0xffffffffbaa4a2f9 : je 0xfff= fffffbaa4a327 =0A0xffffffffbaa4a2fb : mov 0x8(%rsp),%rdi=0A0xffffffffbaa4a300 : lea 0x1(%rdx),%rcx=0A0xffffffffbaa4a304 : mov %rdx,%rax=0A0xffffffffbaa4a307 : lea 0x5f8(%rdi),%rsi=0A0xffffffffbaa4a30e : lock cmpxchg %rcx,0x5f8(%rdi)=0A0xffffffffb= aa4a317 : jne 0xffffffffbaa4a32c =0A0xffffffffbaa4a319 : test %rdx,%rdx=0A0xffffffffbaa4a31c : jne 0xffffffffbaa4a0b5 =0A0xffffffffba= a4a322 : jmpq 0xffffffffbaa4a1a4 =0A0xffffffffbaa4a327 : jmpq 0xffffffffbaa4a1a4 =0A0xfffffff= fbaa4a32c : test %rax,%rax=0A0xffffffffba= a4a32f : mov %rax,%rdx=0A0xffffffffbaa4a= 332 : je 0xffffffffbaa4a319 =0A0xffffffffbaa4a334 = : lea 0x1(%rdx),%rcx=0A0xffffffffbaa4a338 : mov %rdx,%rax=0A0xffffffffbaa4a33b := lock cmpxchg %rcx,(%rsi)=0A0xffffffffbaa4a340 : je 0xffffffffbaa4a319 =0A0xffffff= ffbaa4a342 : jmp 0xffffffffbaa4a32c =0A0xffffffffbaa4a344 : callq 0xffffffffba69d3c0 <__stack_chk_fail>=0A0xffffffffbaa4a349 = : nopl 0x0(%rax)=0A --z5lccj23sq3wwiaf--