All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: kbuild test robot <lkp@intel.com>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
	kbuild-all@lists.01.org, Vitaly Kuznetsov <vkuznets@redhat.com>,
	Alex Williamson <alex.williamson@redhat.com>,
	"Michael S . Tsirkin" <mst@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
	Christophe de Dinechin <dinechin@redhat.com>,
	Jason Wang <jasowang@redhat.com>,
	Kevin Tian <kevin.tian@intel.com>
Subject: Re: [PATCH v9 05/14] KVM: X86: Implement ring-based dirty memory tracking
Date: Mon, 25 May 2020 11:26:49 -0400	[thread overview]
Message-ID: <20200525152649.GF1058657@xz-x1> (raw)
In-Reply-To: <202005251058.wRNkniwm%lkp@intel.com>

On Mon, May 25, 2020 at 10:48:08AM +0800, kbuild test robot wrote:
> Hi Peter,
> 
> Thank you for the patch! Perhaps something to improve:
> 
> [auto build test WARNING on vhost/linux-next]
> [also build test WARNING on linus/master v5.7-rc7]
> [cannot apply to kvm/linux-next tip/auto-latest linux/master next-20200522]
> [if your patch is applied to the wrong git tree, please drop us a note to help
> improve the system. BTW, we also suggest to use '--base' option to specify the
> base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
> 
> url:    https://github.com/0day-ci/linux/commits/Peter-Xu/KVM-Dirty-ring-interface/20200524-070926
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git linux-next
> config: s390-randconfig-s002-20200524 (attached as .config)
> compiler: s390-linux-gcc (GCC) 9.3.0
> reproduce:
>         # apt-get install sparse
>         # sparse version: v0.6.1-240-gf0fe1cd9-dirty
>         # save the attached .config to linux build tree
>         make W=1 C=1 ARCH=s390 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kbuild test robot <lkp@intel.com>
> 
> All warnings (new ones prefixed by >>, old ones prefixed by <<):
> 
> arch/s390/kvm/../../../virt/kvm/kvm_main.c: In function 'kvm_page_in_dirty_ring':
> >> arch/s390/kvm/../../../virt/kvm/kvm_main.c:2932:16: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
> 2932 |  return (pgoff >= KVM_DIRTY_LOG_PAGE_OFFSET) &&
> |                ^~

Should be a false positive, since when KVM_DIRTY_LOG_PAGE_OFFSET==0 (true for
s390) then the code won't reach here at all due to the previous check [1].

I thought gcc should be able to directly remove the below code when it sees "if
(1) return false;", but it seems not...

I wanted to avoid using "#if" macros because I think it always makes the code
harder to read (especially when nested).  Maybe it's still ok to use one more
time here.

Thanks,

> 
> vim +2932 arch/s390/kvm/../../../virt/kvm/kvm_main.c
> 
>   2926	
>   2927	static bool kvm_page_in_dirty_ring(struct kvm *kvm, unsigned long pgoff)
>   2928	{
>   2929		if (!KVM_DIRTY_LOG_PAGE_OFFSET)
>   2930			return false;

[1]

>   2931	
> > 2932		return (pgoff >= KVM_DIRTY_LOG_PAGE_OFFSET) &&
>   2933		    (pgoff < KVM_DIRTY_LOG_PAGE_OFFSET +
>   2934		     kvm->dirty_ring_size / PAGE_SIZE);
>   2935	}
>   2936	


-- 
Peter Xu


WARNING: multiple messages have this Message-ID (diff)
From: Peter Xu <peterx@redhat.com>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH v9 05/14] KVM: X86: Implement ring-based dirty memory tracking
Date: Mon, 25 May 2020 11:26:49 -0400	[thread overview]
Message-ID: <20200525152649.GF1058657@xz-x1> (raw)
In-Reply-To: <202005251058.wRNkniwm%lkp@intel.com>

[-- Attachment #1: Type: text/plain, Size: 2538 bytes --]

On Mon, May 25, 2020 at 10:48:08AM +0800, kbuild test robot wrote:
> Hi Peter,
> 
> Thank you for the patch! Perhaps something to improve:
> 
> [auto build test WARNING on vhost/linux-next]
> [also build test WARNING on linus/master v5.7-rc7]
> [cannot apply to kvm/linux-next tip/auto-latest linux/master next-20200522]
> [if your patch is applied to the wrong git tree, please drop us a note to help
> improve the system. BTW, we also suggest to use '--base' option to specify the
> base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
> 
> url:    https://github.com/0day-ci/linux/commits/Peter-Xu/KVM-Dirty-ring-interface/20200524-070926
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git linux-next
> config: s390-randconfig-s002-20200524 (attached as .config)
> compiler: s390-linux-gcc (GCC) 9.3.0
> reproduce:
>         # apt-get install sparse
>         # sparse version: v0.6.1-240-gf0fe1cd9-dirty
>         # save the attached .config to linux build tree
>         make W=1 C=1 ARCH=s390 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kbuild test robot <lkp@intel.com>
> 
> All warnings (new ones prefixed by >>, old ones prefixed by <<):
> 
> arch/s390/kvm/../../../virt/kvm/kvm_main.c: In function 'kvm_page_in_dirty_ring':
> >> arch/s390/kvm/../../../virt/kvm/kvm_main.c:2932:16: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
> 2932 |  return (pgoff >= KVM_DIRTY_LOG_PAGE_OFFSET) &&
> |                ^~

Should be a false positive, since when KVM_DIRTY_LOG_PAGE_OFFSET==0 (true for
s390) then the code won't reach here at all due to the previous check [1].

I thought gcc should be able to directly remove the below code when it sees "if
(1) return false;", but it seems not...

I wanted to avoid using "#if" macros because I think it always makes the code
harder to read (especially when nested).  Maybe it's still ok to use one more
time here.

Thanks,

> 
> vim +2932 arch/s390/kvm/../../../virt/kvm/kvm_main.c
> 
>   2926	
>   2927	static bool kvm_page_in_dirty_ring(struct kvm *kvm, unsigned long pgoff)
>   2928	{
>   2929		if (!KVM_DIRTY_LOG_PAGE_OFFSET)
>   2930			return false;

[1]

>   2931	
> > 2932		return (pgoff >= KVM_DIRTY_LOG_PAGE_OFFSET) &&
>   2933		    (pgoff < KVM_DIRTY_LOG_PAGE_OFFSET +
>   2934		     kvm->dirty_ring_size / PAGE_SIZE);
>   2935	}
>   2936	


-- 
Peter Xu

  reply	other threads:[~2020-05-25 15:26 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-23 22:56 [PATCH v9 00/14] KVM: Dirty ring interface Peter Xu
2020-05-23 22:56 ` [PATCH v9 01/14] KVM: X86: Change parameter for fast_page_fault tracepoint Peter Xu
2020-05-23 22:56 ` [PATCH v9 02/14] KVM: Cache as_id in kvm_memory_slot Peter Xu
2020-05-23 22:56 ` [PATCH v9 03/14] KVM: X86: Don't track dirty for KVM_SET_[TSS_ADDR|IDENTITY_MAP_ADDR] Peter Xu
2020-05-23 22:56 ` [PATCH v9 04/14] KVM: Pass in kvm pointer into mark_page_dirty_in_slot() Peter Xu
2020-05-23 22:56 ` [PATCH v9 05/14] KVM: X86: Implement ring-based dirty memory tracking Peter Xu
2020-05-25  2:48   ` kbuild test robot
2020-05-25  2:48     ` kbuild test robot
2020-05-25 15:26     ` Peter Xu [this message]
2020-05-25 15:26       ` Peter Xu
2020-05-25 14:54   ` kbuild test robot
2020-05-25 14:54     ` kbuild test robot
2020-05-25 15:33     ` Peter Xu
2020-05-25 15:33       ` Peter Xu
2020-05-23 22:56 ` [PATCH v9 06/14] KVM: Make dirty ring exclusive to dirty bitmap log Peter Xu
2020-05-23 22:56 ` [PATCH v9 07/14] KVM: Don't allocate dirty bitmap if dirty ring is enabled Peter Xu
2020-05-26 15:05   ` kbuild test robot
2020-05-26 15:05     ` kbuild test robot
2020-05-26 15:21     ` Peter Xu
2020-05-26 15:21       ` Peter Xu
2020-05-26 19:21   ` kbuild test robot
2020-05-26 19:21     ` kbuild test robot
2020-05-27 12:53   ` kbuild test robot
2020-05-27 12:53     ` kbuild test robot
2020-05-23 22:56 ` [PATCH v9 08/14] KVM: selftests: Always clear dirty bitmap after iteration Peter Xu
2020-05-23 22:56 ` [PATCH v9 09/14] KVM: selftests: Sync uapi/linux/kvm.h to tools/ Peter Xu
2020-05-23 22:56 ` [PATCH v9 10/14] KVM: selftests: Use a single binary for dirty/clear log test Peter Xu
2020-05-23 22:56 ` [PATCH v9 11/14] KVM: selftests: Introduce after_vcpu_run hook for dirty " Peter Xu
2020-05-23 22:56 ` [PATCH v9 12/14] KVM: selftests: Add dirty ring buffer test Peter Xu
2020-05-23 23:06 ` [PATCH v9 13/14] KVM: selftests: Let dirty_log_test async for dirty ring test Peter Xu
2020-05-23 23:06 ` [PATCH v9 14/14] KVM: selftests: Add "-c" parameter to dirty log test Peter Xu
2020-05-23 23:14 ` [PATCH v9 00/14] KVM: Dirty ring interface Peter Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200525152649.GF1058657@xz-x1 \
    --to=peterx@redhat.com \
    --cc=alex.williamson@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=dinechin@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=kbuild-all@lists.01.org \
    --cc=kevin.tian@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=vkuznets@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.